public static String toString(String impl, AssociationRoleIF role) { String id = UNASSIGNED; try { if (role.getTopicMap() != null) id = role.getObjectId(); return "[" + impl + ", " + id + ", type: " + role.getType() + "]"; } catch (Throwable t) { return "[" + impl + ", " + role.getObjectId() + "!]"; } }
public TMRoleEdge(TMAssociationNode an, TMTopicNode tn, AssociationRoleIF r, TopicIF aScopingTopic) { super(an, tn); this.role = r; //Just for role lengths, set the length to a quarter of the default. //This makes the resulting view more managable this.setLength(this.getLength() / 4); this.setScopingTopic(aScopingTopic); this.setID(r.getObjectId()); }
@Override public void run() { AssociationIF a = getAssociation(); AssociationRoleIF r = (AssociationRoleIF)this.data.remove("AssociationRoleIF"); this.objectId = r.getObjectId(); r.remove(); } });
public void testBothBoundTrue() throws InvalidQueryException, IOException { load("bb-test.ltm"); List matches = new ArrayList(); TopicIF teacher = getTopicById("larer"); AssociationRoleIF role = (AssociationRoleIF) teacher.getRoles().iterator().next(); matches.add(new HashMap()); verifyQuery(matches, "role-player(@" + role.getObjectId() + ", larer)?"); }
public void testBothBoundFalse() throws InvalidQueryException, IOException { load("bb-test.ltm"); List matches = new ArrayList(); TopicIF teacher = getTopicById("larer"); AssociationRoleIF role = (AssociationRoleIF) teacher.getRoles().iterator().next(); verifyQuery(matches, "role-player(@" + role.getObjectId() + ", gdm)?"); }
public void testLiteralType() throws InvalidQueryException, IOException { load("bug662.xtm"); TopicIF topic = getTopicById("history"); AssociationRoleIF role = (AssociationRoleIF) topic.getRoles().iterator().next(); String rid = role.getObjectId(); findNothing(OPT_TYPECHECK_OFF + "example-of(@" + rid + " : illustrated, $E : example)?"); }
public void testBothBoundTrue() throws InvalidQueryException, IOException { load("bb-test.ltm"); List matches = new ArrayList(); TopicIF teacher = getTopicById("larer"); AssociationRoleIF role = (AssociationRoleIF) teacher.getRoles().iterator().next(); AssociationIF assoc = role.getAssociation(); matches.add(new HashMap()); verifyQuery(matches, "association-role(@" + assoc.getObjectId() + ", @" + role.getObjectId() + ")?"); closeStore(); }
@Override public void run() { AssociationRoleIF r = getAssociationRole(); TopicIF type = builder.makeTopic(); // create type this.data.put("type", type); r.setType(type); this.objectId = r.getObjectId(); this.value = type.getObjectId(); } });
@Override public void run() { AssociationRoleIF r = getAssociationRole(); r.addItemIdentifier(URILocator.create("x:source-locator")); this.objectId = r.getObjectId(); } });
public void testBothBoundFalse() throws InvalidQueryException, IOException { load("bb-test.ltm"); List matches = new ArrayList(); TopicIF teacher = getTopicById("gdm"); Iterator it = teacher.getRoles().iterator(); AssociationRoleIF role = (AssociationRoleIF) it.next(); AssociationRoleIF role2 = (AssociationRoleIF) it.next(); AssociationIF assoc = role2.getAssociation(); verifyQuery(matches, "association-role(@" + assoc.getObjectId() + ", @" + role.getObjectId() + ")?"); closeStore(); }
@Override public void run() { AssociationIF a = getAssociation(); AssociationRoleIF r = builder.makeAssociationRole(a, builder.makeTopic(), builder.makeTopic()); this.data.put("AssociationRoleIF", r); this.objectId = r.getObjectId(); } });
@Override public void run() { AssociationRoleIF r = getAssociationRole(); r.removeItemIdentifier(URILocator.create("x:source-locator")); this.objectId = r.getObjectId(); } });
public void testSpecificRole() throws InvalidQueryException, IOException { load("bb-test.ltm"); List matches = new ArrayList(); TopicIF teacher = getTopicById("larer"); AssociationRoleIF role = (AssociationRoleIF) teacher.getRoles().iterator().next(); AssociationIF assoc = role.getAssociation(); addMatch(matches, "ASSOC", assoc); verifyQuery(matches, "association-role($ASSOC, @" + role.getObjectId() + ")?"); closeStore(); }
@Override public void run() { AssociationRoleIF r = getAssociationRole(); TopicIF player = getTopic(); r.setPlayer(player); this.objectId = r.getObjectId(); this.value = player.getObjectId(); } });
@Override public void run() { AssociationRoleIF r = getAssociationRole(); TopicIF type = builder.makeTopic(); // create type type.addSubjectIdentifier(URILocator.create("type:cleared")); r.setType(type); TopicIF xtype = (TopicIF)this.data.remove("type"); // remove type xtype.remove(); this.objectId = r.getObjectId(); } });
public void testBothBoundTrue() throws InvalidQueryException, IOException { makeEmpty(); TopicIF atype = builder.makeTopic(); TopicIF rtype = builder.makeTopic(); TopicIF player = builder.makeTopic(); TopicIF other = builder.makeTopic(); AssociationIF assoc = builder.makeAssociation(atype); AssociationRoleIF role = builder.makeAssociationRole(assoc, rtype, player); AssociationRoleIF role2 = builder.makeAssociationRole(assoc, rtype, other); List matches = new ArrayList(); matches.add(new HashMap()); verifyQuery(matches, "type(@" + role.getObjectId() + ", @" + rtype.getObjectId() + ")?"); }
public void testRolePlayerPredicate1b() throws InvalidQueryException, IOException { makeEmpty(); TopicIF atype = builder.makeTopic(); TopicIF rtype = builder.makeTopic(); TopicIF player = builder.makeTopic(); AssociationIF assoc = builder.makeAssociation(atype); AssociationRoleIF role = builder.makeAssociationRole(assoc, rtype, player); List matches = new ArrayList(); addMatch(matches, "PLAYER", player); verifyQuery(matches, "role-player(@" + role.getObjectId() + ", $PLAYER)?"); }
public void testRoleType() throws InvalidQueryException, IOException { makeEmpty(); TopicIF atype = builder.makeTopic(); TopicIF rtype = builder.makeTopic(); TopicIF player = builder.makeTopic(); AssociationIF assoc = builder.makeAssociation(atype); AssociationRoleIF role = builder.makeAssociationRole(assoc, rtype, player); List matches = new ArrayList(); addMatch(matches, "TYPE", rtype); verifyQuery(matches, "type(@" + role.getObjectId() + ", $TYPE)?"); }
public void testBothBoundFalse() throws InvalidQueryException, IOException { makeEmpty(); TopicIF atype = builder.makeTopic(); TopicIF rtype = builder.makeTopic(); TopicIF player = builder.makeTopic(); AssociationIF assoc = builder.makeAssociation(atype); AssociationRoleIF role = builder.makeAssociationRole(assoc, rtype, player); AssociationRoleIF role2 = builder.makeAssociationRole(assoc, player, player); List matches = new ArrayList(); verifyQuery(matches, "type(@" + role2.getObjectId() + ", @" + rtype.getObjectId() + ")?"); }
@Override public void run() { AssociationRoleIF r = getAssociationRole(); TopicIF oldPlayer = r.getPlayer(); TopicIF player = builder.makeTopic(); // create player player.addSubjectIdentifier(URILocator.create("player:cleared")); r.setPlayer(player); this.objectId = r.getObjectId(); this.value = oldPlayer.getObjectId(); } });