public static String toString(String impl, TopicNameIF basename) { String id = UNASSIGNED; try { if (basename.getTopicMap() != null) id = basename.getObjectId(); if (basename.getValue() != null) return "[" + impl + ", " + id + ", '" + basename.getValue() + "']"; else return "[" + impl + ", " + id + "]"; } catch (Throwable t) { return "[" + impl + ", " + basename.getObjectId() + "!]"; } }
@Override public void run() { TopicNameIF bn = builder.makeTopicName(getTopic(), ""); this.data.put("TopicNameIF", bn); this.objectId = bn.getObjectId(); } });
@Override public void run() { TopicIF t = getTopic(); TopicNameIF bn = (TopicNameIF)this.data.remove("TopicNameIF"); this.objectId = bn.getObjectId(); bn.remove(); } });
public void testWithBothBoundTrue() throws InvalidQueryException, IOException { load("family2.ltm"); List matches = new ArrayList(); TopicIF topic = getTopicById("marriage"); TopicNameIF bn = topic.getTopicNames().iterator().next(); matches.add(new HashMap()); verifyQuery(matches, "topic-name(marriage, @" + bn.getObjectId() + ")?"); }
@Override public void run() { TopicNameIF bn = getTopicName(); bn.setValue(""); this.objectId = bn.getObjectId(); } });
@Override public void run() { TopicNameIF bn = getTopicName(); bn.setValue("New name"); this.objectId = bn.getObjectId(); } });
public void testWithBothBoundFalse() throws InvalidQueryException, IOException { load("family2.ltm"); List matches = new ArrayList(); TopicIF topic = getTopicById("marriage"); TopicNameIF bn = topic.getTopicNames().iterator().next(); verifyQuery(matches, "topic-name(parenthood, @" + bn.getObjectId() + ")?"); }
@Override public void run() { TopicNameIF bn = getTopicName(); TopicIF theme = (TopicIF)this.data.remove("scope"); bn.removeTheme(theme); this.objectId = bn.getObjectId(); this.value = theme.getObjectId(); } });
public void testWithBothBoundTrue() throws InvalidQueryException, IOException { load("family.ltm"); List matches = new ArrayList(); TopicIF topic = getTopicById("petter"); TopicNameIF bn = (TopicNameIF) topic.getTopicNames().iterator().next(); VariantNameIF vn = (VariantNameIF) bn.getVariants().iterator().next(); matches.add(new HashMap()); verifyQuery(matches, "variant(@" + bn.getObjectId() + ", @" + vn.getObjectId() + ")?"); closeStore(); }
public void testParam2() throws InvalidQueryException, IOException { load("subclasses.ltm"); TopicIF subclass = getTopicById("subclass"); TopicNameIF name = subclass.getTopicNames().iterator().next(); Map params = new HashMap(); params.put("v", "SUBCLASS"); update("update value(@" + name.getObjectId() + ", %v%)", params); assertTrue("name value not changed", name.getValue().equals("SUBCLASS")); }
public void testWithSpecificTopicName() throws InvalidQueryException, IOException { load("family2.ltm"); List matches = new ArrayList(); TopicIF topic = getTopicById("marriage"); TopicNameIF bn = topic.getTopicNames().iterator().next(); addMatch(matches, "TOPIC", topic); verifyQuery(matches, "topic-name($TOPIC, @" + bn.getObjectId() + ")?"); }
public void testWithBothBoundFalse() throws InvalidQueryException, IOException { load("family.ltm"); List matches = new ArrayList(); TopicIF topic1 = getTopicById("petter"); TopicNameIF bn1 = (TopicNameIF) topic1.getTopicNames().iterator().next(); TopicIF topic2 = getTopicById("asle"); TopicNameIF bn2 = (TopicNameIF) topic2.getTopicNames().iterator().next(); VariantNameIF vn = (VariantNameIF) bn2.getVariants().iterator().next(); verifyQuery(matches, "variant(@" + bn1.getObjectId() + ", @" + vn.getObjectId() + ")?"); closeStore(); }
@Override public void run() { TopicNameIF bn = getTopicName(); bn.addItemIdentifier(URILocator.create("x:source-locator")); this.objectId = bn.getObjectId(); } });
@Override public void run() { TopicNameIF bn = getTopicName(); bn.removeItemIdentifier(URILocator.create("x:source-locator")); this.objectId = bn.getObjectId(); } });
@Override public void run() { TopicNameIF bn = getTopicName(); TopicIF type = builder.makeTopic(); // create type bn.setType(null); TopicIF xtype = (TopicIF)this.data.remove("type"); // remove type xtype.remove(); this.objectId = bn.getObjectId(); } });
@Override public void run() { TopicNameIF bn = getTopicName(); TopicIF type = builder.makeTopic(); // create type this.data.put("type", type); bn.setType(type); this.objectId = bn.getObjectId(); this.value = type.getObjectId(); } });
@Override public void run() { TopicNameIF bn = getTopicName(); TopicIF theme = builder.makeTopic(); this.data.put("scope", theme); bn.addTheme(theme); this.objectId = bn.getObjectId(); this.value = theme.getObjectId(); } });
public void testSpecificTopicNameNoScope() throws InvalidQueryException, IOException { makeEmpty(); TopicIF type = builder.makeTopic(); TopicIF topic = builder.makeTopic(type); TopicNameIF bn = builder.makeTopicName(topic, "name"); List matches = new ArrayList(); verifyQuery(matches, "scope(@" + bn.getObjectId() + ", $THEME)?"); }
public void testTopicNameBound() throws InvalidQueryException, IOException { makeEmpty(); TopicIF theme = builder.makeTopic(); TopicIF topic = builder.makeTopic(); TopicNameIF thing = builder.makeTopicName(topic, "mybasename"); thing.addTheme(theme); List matches = new ArrayList(); addMatch(matches, "THEME", theme); verifyQuery(matches, "scope(@" + thing.getObjectId() + ", $THEME)?"); }
public void testTopicNameType() throws InvalidQueryException, IOException { makeEmpty(); TopicIF type1 = builder.makeTopic(); TopicIF type2 = builder.makeTopic(); TopicIF topic = builder.makeTopic(); TopicNameIF bname1 = builder.makeTopicName(topic, type1, ""); TopicNameIF bname2 = builder.makeTopicName(topic, type2, ""); TopicNameIF bnameN = builder.makeTopicName(topic, (TopicIF)null, ""); List matches = new ArrayList(); addMatch(matches, "TYPE", type2); verifyQuery(matches, "type(@" + bname2.getObjectId() + ", $TYPE)?"); }