public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (Objects.equals(occurIF.getType(), oType)) result.add(occurIF); } return result; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, LocatorIF datatype) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (Objects.equals(occurIF.getType(), oType) && Objects.equals(occurIF.getDataType(), datatype) ) result.add(occurIF); } return result; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (ObjectUtils.equals(occurIF.getType(), oType)) result.add(occurIF); } return result; }
public static OccurrenceIF findOccurrence(TopicIF oType, TopicIF topicIF) { Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (ObjectUtils.equals(occurIF.getType(), oType)) return occurIF; } return null; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, Collection<TopicIF> scope) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (Objects.equals(occurIF.getType(), oType) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) result.add(occurIF); } return result; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, String value, Collection<TopicIF> scope) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (Objects.equals(occurIF.getValue(), value) && Objects.equals(occurIF.getType(), oType) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) result.add(occurIF); } return result; }
public static OccurrenceIF findOccurrence(TopicIF oType, TopicIF topicIF, LocatorIF datatype, Collection<TopicIF> scope) { Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (Objects.equals(occurIF.getType(), oType) && Objects.equals(occurIF.getDataType(), datatype) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) return occurIF; } return null; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, LocatorIF datatype) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (ObjectUtils.equals(occurIF.getType(), oType) && ObjectUtils.equals(occurIF.getDataType(), datatype) ) result.add(occurIF); } return result; }
@Override public TypedIF getTyped(TopicIF topic) { if (topic.getOccurrences().size() == 0) { return null; } return topic.getOccurrences().iterator().next(); } });
protected Set<OccurrenceIF> fetchProperties(TopicMapIF topicmap) { TopicIF preferencePropertyType = TopicMapPreferencesOntology.PREFERENCEPROPERTY.t(topicmap); Set<OccurrenceIF> result = new HashSet<OccurrenceIF>(); for (OccurrenceIF property : revitalize(topic, topicmap).getOccurrences()) { if (property.getType().getTypes().contains(preferencePropertyType)) { result.add(property); } } return result; }
private String get(TopicIF topic, LocatorIF psi) { for (OccurrenceIF occ : topic.getOccurrences()) { TopicIF type = occ.getType(); if (type.getSubjectIdentifiers().contains(psi)) return occ.getValue(); } return null; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, String value, Collection<TopicIF> scope) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (ObjectUtils.equals(occurIF.getValue(), value) && ObjectUtils.equals(occurIF.getType(), oType) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) result.add(occurIF); } return result; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, LocatorIF datatype, Collection<TopicIF> scope) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (ObjectUtils.equals(occurIF.getType(), oType) && ObjectUtils.equals(occurIF.getDataType(), datatype) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) result.add(occurIF); } return result; }
public static OccurrenceIF findOccurrence(TopicIF oType, TopicIF topicIF, LocatorIF datatype, Collection<TopicIF> scope) { Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (ObjectUtils.equals(occurIF.getType(), oType) && ObjectUtils.equals(occurIF.getDataType(), datatype) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) return occurIF; } return null; }
private OccurrenceIF getOccurrence(TopicIF topic, TopicIF type) { Iterator it = topic.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occ = (OccurrenceIF) it.next(); if (type.equals(occ.getType())) return occ; } return null; }
private void addOccurrences(List matches, String var, TopicIF topic) { Iterator it = topic.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occ = (OccurrenceIF) it.next(); addMatch(matches, var, occ); } } }
public void testWithBothBoundFalse() throws InvalidQueryException, IOException { load("bb-test.ltm"); List matches = new ArrayList(); TopicIF topic = getTopicById("thequeen"); OccurrenceIF occ = (OccurrenceIF) topic.getOccurrences().iterator().next(); verifyQuery(matches, "occurrence(equation, @" + occ.getObjectId() + ")?"); }
public void testWithSpecificOccurrenceAndString() throws InvalidQueryException, IOException { load("int-occs.ltm", true); TopicIF topic = getTopicById("topic1"); OccurrenceIF oc = topic.getOccurrences().iterator().next(); String oid = oc.getObjectId(); // first argument must be unbound getParseError("value-like(@" + oid + ", \"topic1\")?"); }
public void testWithSpecificOccurrence() throws InvalidQueryException, IOException { load("bb-test.ltm"); List matches = new ArrayList(); TopicIF topic = getTopicById("thequeen"); OccurrenceIF occ = (OccurrenceIF) topic.getOccurrences().iterator().next(); addMatch(matches, "TOPIC", topic); verifyQuery(matches, "occurrence($TOPIC, @" + occ.getObjectId() + ")?"); }
public void testOccurrenceRemoval() { TopicIF type = builder.makeTopic(); TopicIF topic = builder.makeTopic(); OccurrenceIF occ = builder.makeOccurrence(topic, type, "duplicate"); occ = builder.makeOccurrence(topic, type, "duplicate"); DuplicateSuppressionUtils.removeDuplicates(topic); assertTrue("duplicate occurrence were not removed", topic.getOccurrences().size() == 1); }