AssociationRoleIF nrole = builder1.makeAssociationRole(assoc, nrt, nrp); AssociationRoleIF drole = builder1.makeAssociationRole(assoc, drt, drp); drole.setReifier(reifier);
public void testMergeReifiedNearRole() { // 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); nrole.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 newnrole = (AssociationRoleIF)target.getRoles().iterator().next(); assertTrue("Near role lost reifier on merge", newnrole.getReifier() == reifier); assertTrue("Topic lost reified on merge", reifier.getReified() == newnrole); }
@Test public void testAssociationRole() throws Exception { AssociationIF assoc = tm1.getBuilder().makeAssociation(tm1.getBuilder().makeTopic()); AssociationRoleIF role = tm1.getBuilder().makeAssociationRole(assoc, foo1, foo1); role.setReifier(foo1); concurrentCommit(); // verify no inconsistenties were created check(tm1, role.getType(), "Association role", "type"); check(tm1, role.getPlayer(), "Association role", "player"); check(tm1, role.getReifier(), "Association role", "reifier"); }