public TopicIF getReifier() { return assoc.getReifier(); }
protected static void deleteTopic(TopicIF topic) { // first remove all topics that reifies any of the topic's associations Iterator iter = topic.getRoles().iterator(); while (iter.hasNext()) { AssociationRoleIF role = (AssociationRoleIF)iter.next(); AssociationIF assoc = role.getAssociation(); // if reifier topic found, then remove it TopicIF reifier = assoc.getReifier(); if (reifier != null) { // remove reifier topic log.trace(" -A-reifier " + topic + " " + reifier + " -> " + assoc); reifier.remove(); } } // remove topic (and identities) log.debug(" -T " + topic); topic.remove(); }
protected static void deleteTopic(TopicIF topic) { // first remove all topics that reifies any of the topic's associations for (AssociationRoleIF role : topic.getRoles()) { AssociationIF assoc = role.getAssociation(); // if reifier topic found, then remove it TopicIF reifier = assoc.getReifier(); if (reifier != null) { // remove reifier topic log.trace(" -A-reifier {} {} -> {}", new Object[] {topic, reifier, assoc}); reifier.remove(); } } // remove topic (and identities) log.debug(" -T {}", topic); topic.remove(); }
TopicIF reifier1 = assoc1.getReifier(); Collection<TopicIF> reifiers1 = (reifier1 == null ? Collections.<TopicIF>emptySet() : Collections.singleton(reifier1)); TopicIF reifier2 = assoc2.getReifier(); Collection<TopicIF> reifiers2 = (reifier2 == null ? Collections.<TopicIF>emptySet() : Collections.singleton(reifier2)); reifiers1 = filterCollection(reifiers1);
if (assoc.getRoles().size() != 2 || !assoc.getScope().isEmpty() || assoc.getReifier() != null) continue;
addReifier(tassoc, sassoc.getReifier(), tfilter, sfilter, tracker); Iterator<AssociationRoleIF> it2 = sassoc.getRoles().iterator(); while (it2.hasNext()) {
TopicIF reifier = assoc.getReifier(); if (reifier != null) removeTopic(reifier, relation, entity, tuple, ctx);
TopicIF reifier = assoc.getReifier(); if (reifier != null) removeTopic(reifier, relation, entity, tuple, ctx);
TopicIF reifier = assoc.getReifier(); if (reifier == null || !filterOk(reifier)) subject = getResource();
public void testReifiesDynamic() throws InvalidQueryException, IOException { load("jill.xtm"); TopicIF topic = getTopicById("jill-ontopia-topic"); AssociationIF reified = (AssociationIF) topic.getReified(); update("delete reifies($T, $A) from instance-of($T, employment), reifies($T, $A)"); assertTrue("topic retains reified after delete", topic.getReified() == null); assertTrue("reified retains reifier after delete", reified.getReifier() == null); }
assertTrue("reifier was lost", assoc.getReifier() != null); assertTrue("reifiers were not merged", assoc.getReifier().getTopicNames().size() == 2);
public void testMergeReifiedAssociation() { // build TM TopicIF reifier = builder1.makeTopic(); TopicIF at = builder1.makeTopic(); TopicIF nrt = builder1.makeTopic(); TopicIF nrp = builder1.makeTopic(); TopicIF drt = builder1.makeTopic(); TopicIF drp = builder1.makeTopic(); TopicIF target = builder1.makeTopic(); AssociationIF assoc = builder1.makeAssociation(at); AssociationRoleIF nrole = builder1.makeAssociationRole(assoc, nrt, nrp); AssociationRoleIF drole = builder1.makeAssociationRole(assoc, drt, drp); assoc.setReifier(reifier); // merge MergeUtils.mergeInto(target, nrp); // previous line checks if moving association from nrp to target causes it to lose // its reifier // check AssociationRoleIF newrole = (AssociationRoleIF)target.getRoles().iterator().next(); AssociationIF newassoc = newrole.getAssociation(); assertTrue("Association lost reifier on merge", newassoc.getReifier() == reifier); assertTrue("Topic lost reified on merge", reifier.getReified() == newassoc); }
@Test public void testAssociation() throws Exception { AssociationIF assoc = tm1.getBuilder().makeAssociation(foo1); tm1.getBuilder().makeAssociationRole(assoc, tm1.getBuilder().makeTopic(), tm1.getBuilder().makeTopic()); assoc.setReifier(foo1); // todo: assoc.addTheme(foo1); pending #265 concurrentCommit(); // verify no inconsistenties were created check(tm1, assoc.getType(), "Association", "type"); check(tm1, assoc.getReifier(), "Association", "reifier"); // todo: check(tm1, assoc.getScope().iterator().next().getObjectId(), "Association", "scope"); pending #265 }