public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (Objects.equals(nameIF.getType(), nType)) result.add(nameIF); } return result; }
private final void accumulateVariantsOfTopic(TopicIF topic, Collection variants) { if (topic != null) { Iterator iterBase = topic.getTopicNames().iterator(); while (iterBase.hasNext()) { TopicNameIF basename = (TopicNameIF) iterBase.next(); accumulateVariantsOfBasename(basename, variants); } } }
private static void copyTopicNames(TopicIF target, TopicIF source) { Iterator<TopicNameIF> it = source.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF o = it.next(); copyTopicName(target, o); } }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, String value) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (Objects.equals(nameIF.getValue(), value) && Objects.equals(nameIF.getType(), nType)) result.add(nameIF); } return result; }
protected Collection getAllTopicNames() { Collection all = new ArrayList(topicmap.getTopics().size() * 2); Iterator it = topicmap.getTopics().iterator(); while (it.hasNext()) { TopicIF topic = (TopicIF) it.next(); all.addAll(topic.getTopicNames()); } return all; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (ObjectUtils.equals(nameIF.getType(), nType)) result.add(nameIF); } return result; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, String value, Collection<TopicIF> scope) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (Objects.equals(nameIF.getValue(), value) && Objects.equals(nameIF.getType(), nType) && CollectionUtils.equalsUnorderedSet(nameIF.getScope(), scope)) result.add(nameIF); } return result; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, Collection<TopicIF> scope) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (ObjectUtils.equals(nameIF.getType(), nType) && CollectionUtils.equalsUnorderedSet(nameIF.getScope(), scope)) result.add(nameIF); } return result; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, String value) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (ObjectUtils.equals(nameIF.getValue(), value) && ObjectUtils.equals(nameIF.getType(), nType)) result.add(nameIF); } return result; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, String value, Collection<TopicIF> scope) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (ObjectUtils.equals(nameIF.getValue(), value) && ObjectUtils.equals(nameIF.getType(), nType) && CollectionUtils.equalsUnorderedSet(nameIF.getScope(), scope)) result.add(nameIF); } return result; }
private void addTopicNames(List matches, String var, TopicIF topic) { Iterator it = topic.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF bn = (TopicNameIF) it.next(); addMatch(matches, var, bn); } }
/** * PUBLIC: Remove all duplicated characteristics of the given topic, * except for duplicate associations the topic may participate in. */ public static void removeDuplicates(TopicIF topic) { // base name duplicates removeDuplicateTopicNames(topic.getTopicNames()); // occurrence duplicates removeDuplicateOccurrences(topic.getOccurrences()); // duplicate association roles are not removed here; that job must // be done by removing duplicate associations globally }
private void addVariantNames(List matches, String var, TopicIF topic) { Iterator it = topic.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF bn = (TopicNameIF) it.next(); Iterator it2 = bn.getVariants().iterator(); while (it2.hasNext()) { VariantNameIF vn = (VariantNameIF) it2.next(); addMatch(matches, var, vn); } } }
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() + ")?"); }
public void testBug1083a() throws InvalidQueryException, IOException { load("family.ltm"); TopicIF lmg = getTopicById("lmg"); List matches = new ArrayList(); Iterator it = lmg.getTopicNames().iterator(); while (it.hasNext()) addMatch(matches, "N", it.next()); verifyQuery(matches, "has-name($T, $N) :- topic-name($T, $N) . " + "has-name(lmg, $N)?"); }
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(); }
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 testName() { LocatorIF loc = base.resolveAbsolute("#topic-2"); TopicIF topic = (TopicIF)tm.getObjectByItemIdentifier(loc); TopicNameIF topic_name = (TopicNameIF)topic.getTopicNames().iterator().next(); tmobjectTest(topic_name, true, true); assertTrue("getTopicName", topic_name.getTopic() == topic); }
public void testName() throws InvalidQueryException, IOException { load("instance-of.ltm"); update("insert topic1 - \"Emne1\" ."); TopicIF topic = getTopicById("topic1"); assertTrue("topic did not get new name", topic.getTopicNames().size() == 2); }
public void testMergeTopicNameDuplicatesWithVariants() { TopicIF t1 = builder1.makeTopic(); TopicNameIF bn1 = builder1.makeTopicName(t1, "bn"); VariantNameIF vn1 = builder1.makeVariantName(bn1, "vn"); TopicIF t2 = builder1.makeTopic(); TopicNameIF bn2 = builder1.makeTopicName(t2, "bn"); VariantNameIF vn2 = builder1.makeVariantName(bn2, "vn"); MergeUtils.mergeInto(t1, t2); assertTrue("base name duplicates not suppressed", t1.getTopicNames().size() == 1); }