private TopicIF makeTopic(String psi) throws MalformedURLException { TopicIF topic = builder.makeTopic(); topic.addSubjectIdentifier(new URILocator(psi)); return topic; }
@Override public TopicIF makeTopicBySubjectIdentifier(LocatorIF subjid) { TopicIF topic = topicmap.getTopicBySubjectIdentifier(subjid); if (topic == null) { topic = builder.makeTopic(); topic.addSubjectIdentifier(subjid); } return topic; }
protected TopicIF addSubjectIdentifier(TopicIF topic, LocatorIF subjectIndicator) { topic.addSubjectIdentifier(subjectIndicator); // handle implicit reification if (!(topic instanceof LazyTopic)) { TMObjectIF reified = topicmap.getObjectByItemIdentifier(subjectIndicator); if (reified != null && reified instanceof ReifiableIF) return reify((ReifiableIF)reified, topic); } return topic; }
private TopicIF getLastModifiedTopic(TopicMapIF topicmap) { TopicIF lastmod = topicmap.getTopicBySubjectIdentifier(psi); if (lastmod == null) { lastmod = topicmap.getBuilder().makeTopic(); lastmod.addSubjectIdentifier(psi); } return lastmod; }
protected static void renameSubjectIdentifier(TopicMapIF topicmap, LocatorIF base_on, String oldId, String newId) { TopicIF identityType = getTopic(topicmap, base_on, oldId); identityType.addSubjectIdentifier(base_on.resolveAbsolute(newId)); identityType.removeSubjectIdentifier(base_on.resolveAbsolute(oldId)); }
private TopicIF getDefaultNameType() { TopicIF nameType = tm.getTopicBySubjectIdentifier(PSI.getSAMNameType()); if (nameType == null) { nameType = makeTopic(); nameType.addSubjectIdentifier(PSI.getSAMNameType()); } return nameType; }
protected static void renameSubjectIdentifier(TopicMapIF topicmap, LocatorIF base_on, String oldId, String newId) { TopicIF identityType = getTopic(topicmap, base_on, oldId); identityType.addSubjectIdentifier(base_on.resolveAbsolute(newId)); identityType.removeSubjectIdentifier(base_on.resolveAbsolute(oldId)); }
private TopicIF getDefaultNameType() { TopicIF nameType = tm.getTopicBySubjectIdentifier(PSI.getSAMNameType()); if (nameType == null) { nameType = makeTopic(); nameType.addSubjectIdentifier(PSI.getSAMNameType()); } return nameType; }
private TopicIF getDefaultNameType() { TopicMapIF tm = getTopicMap(); TopicIF nameType = tm.getTopicBySubjectIdentifier(PSI.getSAMNameType()); if (nameType == null) { nameType = tm.getBuilder().makeTopic(); nameType.addSubjectIdentifier(PSI.getSAMNameType()); } return nameType; }
private TopicIF getDefaultNameType() { TopicMapIF tm = getTopicMap(); TopicIF nameType = tm.getTopicBySubjectIdentifier(PSI.getSAMNameType()); if (nameType == null) { nameType = tm.getBuilder().makeTopic(); nameType.addSubjectIdentifier(PSI.getSAMNameType()); } return nameType; }
@Test public void testURI() throws URISyntaxException { TopicIF t1 = builder.makeTopic(); TopicIF t2 = builder.makeTopic(); t1.addSubjectIdentifier(URILocator.create("http://example.com/?q=a")); t2.addSubjectIdentifier(URILocator.create("http://example.com/?q=A")); topicmap.getStore().commit(); Assert.assertEquals(2, topicmap.getTopics().size()); topicmap.getTopicBySubjectIdentifier(URILocator.create("http://example.com/?q=a")).remove(); topicmap.getStore().commit(); Assert.assertEquals(1, topicmap.getTopics().size()); }
public void testSimpleLookupSucceeds() throws MalformedURLException { URILocator loc = new URILocator("http://psi.example.org/test"); topic.addSubjectIdentifier(loc); registry.registerPrefix("tst", "http://psi.example.org/"); TopicIF found = q.lookup("tst:test"); assertTrue("lookup returned wrong topic", topic == found); }
@Override public void run() { AssociationIF a = getAssociation(); TopicIF type = builder.makeTopic(); // create type type.addSubjectIdentifier(URILocator.create("type:cleared")); a.setType(type); TopicIF xtype = (TopicIF)this.data.remove("type"); // remove type xtype.remove(); this.objectId = a.getObjectId(); } });
@Override public void run() { AssociationRoleIF r = getAssociationRole(); TopicIF type = builder.makeTopic(); // create type type.addSubjectIdentifier(URILocator.create("type:cleared")); r.setType(type); TopicIF xtype = (TopicIF)this.data.remove("type"); // remove type xtype.remove(); this.objectId = r.getObjectId(); } });
public void testBug1790() { // test case for bug #1790 TopicIF t1 = builder1.makeTopic(); t1.addSubjectIdentifier(makeLocator("http://www.ontopia.net")); t1.addItemIdentifier(makeLocator("http://www.ontopia.net")); TopicIF t2 = builder1.makeTopic(); MergeUtils.mergeInto(t2, t1); assertTrue("topics merged incorrectly", topicmap1.getTopics().size() == 1); }
public void testSourceLocSubjIndConflict() { // used to have a bug on this, hence the test TopicIF t1 = builder1.makeTopic(); t1.addSubjectIdentifier(makeLocator("http://www.ontopia.net")); TopicIF t2 = builder2.makeTopic(); t2.addItemIdentifier(makeLocator("http://www.ontopia.net")); MergeUtils.mergeInto(topicmap1, topicmap2); assertTrue("incorrect number of topics in merged topic map", topicmap1.getTopics().size() == 1); }
private void concurrentCommit() { // store2: merge foo into bar TopicIF bar = tm2.getBuilder().makeTopic(); bar.addSubjectIdentifier(URILocator.create("bar:foo")); MergeUtils.mergeInto(bar, foo2); // commit store2 store2.commit(); // then store 1 store1.commit(); } }
private void prepare() throws IOException { TopicMapStoreIF store = reference.createStore(false); TopicMapIF tm = store.getTopicMap(); tm.getBuilder().makeTopic().addSubjectIdentifier(psi); store.commit(); store.close(); }
@Override public void createTypedIFs(TopicMapBuilderIF builder, TopicIF type) { type.addSubjectIdentifier(URILocator.create("foo:bar")); builder.makeTopicName(builder.makeTopic(), type, "foo1"); builder.makeTopicName(builder.makeTopic(), type, "foo2"); builder.makeTopicName(builder.makeTopic(), type, "foo3"); }
public void testShouldTopicIsSubjectIndicatorReverse() { TopicIF t1 = builder1.makeTopic(); t1.addItemIdentifier(makeLocator("http://www.ontopia.net")); TopicIF t2 = builder2.makeTopic(); t2.addSubjectIdentifier(makeLocator("http://www.ontopia.net")); assertTrue("claims topics should not merge when one is subject indicator of other", MergeUtils.shouldMerge(t2, t1)); }