public TopicIF getReifier() { return tm.getReifier(); }
/** * Returns the name of the topic map, or null if it has none. */ public String getName() { TopicIF reifier = getTopicMapIF().getReifier(); return reifier == null ? null : TopicStringifiers.toString(reifier); }
public static String getReifierName(TopicMapIF topicmap) { TopicIF topicmapReifier = topicmap.getReifier(); if (topicmapReifier != null) { return TopicStringifiers.getDefaultStringifier() .toString(topicmapReifier); } return null; } }
public static String getReifierName(TopicMapIF topicmap) { TopicIF topicmapReifier = topicmap.getReifier(); if (topicmapReifier != null) { return TopicStringifiers.getDefaultStringifier() .toString(topicmapReifier); } return null; } }
/** * Returns the name of the topic map, or null if it has none. */ public String getName() { TopicIF reifier = getTopicMapIF().getReifier(); return reifier == null ? null : TopicStringifiers.toString(reifier); }
protected TopicIF makeReifier() { TopicIF reifier = getTopicMapIF().getReifier(); if (reifier == null) { // IMPORTANT: check old-style reification TopicMapIF tm = getTopicMapIF(); Iterator<LocatorIF> iter = tm.getItemIdentifiers().iterator(); while (iter.hasNext()) { LocatorIF srcloc = iter.next(); TopicIF _reifier = tm.getTopicBySubjectIdentifier(srcloc); if (_reifier != null) { if (reifier != null) MergeUtils.mergeInto(reifier, _reifier); else reifier = _reifier; } } if (reifier == null) reifier = tm.getBuilder().makeTopic(); tm.setReifier(reifier); reifier.addType(tm.getTopicBySubjectIdentifier(PSI.ON_TOPIC_MAP)); } return reifier; }
protected TopicIF makeReifier() { TopicIF reifier = getTopicMapIF().getReifier(); if (reifier == null) { // IMPORTANT: check old-style reification TopicMapIF tm = getTopicMapIF(); Iterator<LocatorIF> iter = tm.getItemIdentifiers().iterator(); while (iter.hasNext()) { LocatorIF srcloc = iter.next(); TopicIF _reifier = tm.getTopicBySubjectIdentifier(srcloc); if (_reifier != null) { if (reifier != null) MergeUtils.mergeInto(reifier, _reifier); else reifier = _reifier; } } if (reifier == null) reifier = tm.getBuilder().makeTopic(); tm.setReifier(reifier); reifier.addType(tm.getTopicBySubjectIdentifier(PSI.ON_TOPIC_MAP)); } return reifier; }
@Test public void testReifiedTopicMap() throws IOException { TopicMapIF tm = readTopicMap("reified-tm.xml"); TopicIF reifier = tm.getReifier(); Assert.assertTrue("Reification was not preserved", reifier != null); }
@Test public void testTopicMapReification() throws IOException { TopicMapIF tm = readTopicMap(testdataDirectory, "extra", "master-of-reified-tm.xtm"); Assert.assertTrue("topic map has been incorrectly merged with child topic map", tm .getReifier() == null); }
@Test public void testMergedInReifiedTopicMapWithBaseURI() throws IOException { TopicMapIF tm = read("baseuri-reifytm.ltm"); Assert.assertNull("Internal subject indicator ref affected by base URI", tm.getReifier()); }
private void initQueryContext() { try { this.qp = QueryUtils.getQueryProcessor(topicMapIF); // load built-in declarations this.dc = QueryUtils.parseDeclarations(topicMapIF, declarations); // load custom declarations TopicIF typeIf = OntopolyModelUtils.getTopicIF(this, PSI.ON_TOLOG_DECLARATIONS, false); if (typeIf != null) { TopicIF topicIf = getTopicMapIF().getReifier(); if (topicIf != null) { OccurrenceIF occ = OntopolyModelUtils.findOccurrence(typeIf, topicIf); if (occ != null) this.dc = QueryUtils.parseDeclarations(topicMapIF, declarations, this.dc); } } } catch (InvalidQueryException e) { throw new OntopiaRuntimeException(e); } }
private void initQueryContext() { try { this.qp = QueryUtils.getQueryProcessor(topicMapIF); // load built-in declarations this.dc = QueryUtils.parseDeclarations(topicMapIF, declarations); // load custom declarations TopicIF typeIf = OntopolyModelUtils.getTopicIF(this, PSI.ON_TOLOG_DECLARATIONS, false); if (typeIf != null) { TopicIF topicIf = getTopicMapIF().getReifier(); if (topicIf != null) { OccurrenceIF occ = OntopolyModelUtils.findOccurrence(typeIf, topicIf); if (occ != null) this.dc = QueryUtils.parseDeclarations(topicMapIF, declarations, this.dc); } } } catch (InvalidQueryException e) { throw new OntopiaRuntimeException(e); } }
@Test public void testTopicmap() throws Exception { tm1.setReifier(foo1); concurrentCommit(); // verify no inconsistenties were created check(tm1, tm1.getReifier(), "Topicmap", "reifier"); }
public void testTMReifier() { // build test case TopicIF reifier = builder2.makeTopic(); topicmap2.setReifier(reifier); // merge MergeUtils.mergeInto(topicmap1, topicmap2); // verify assertTrue("topicmap1 had reifier after merge", topicmap1.getReifier() == null); reifier = (TopicIF) topicmap1.getTopics().iterator().next(); assertTrue("imported topic still reifying old topic map", reifier.getReified() == null); }
@Test public void testOmittingIDsPreserveReification() throws IOException { prepareTopicMap(); TopicIF reifier = builder.makeTopic(); topicmap.setReifier(reifier); reload(); // now for the real test reifier = topicmap.getReifier(); Assert.assertTrue("reification connection broken on export", reifier != null); }
public void testMergeReifiedTargetTopicMap() { // build TMs TopicIF reifier = builder1.makeTopic(); topicmap1.setReifier(reifier); // merge MergeUtils.mergeInto(topicmap1, topicmap2); // previous line checks if moving topicmap causes it to lose // its reifier // check assertTrue("Topic map lost reifier on merge", topicmap1.getReifier() == reifier); assertTrue("Topic lost reified on merge", reifier.getReified() == topicmap1); }
@Override public String generateHTML(ContextTag contextTag) { if (contextTag == null) throw new OntopiaRuntimeException("Plugin must have a parent tolog:context tag."); TopicMapIF tm = contextTag.getTopicMap(); if (tm == null) return "<span>No topic map!</span>"; // get omnigator model String model = FrameworkUtils.getUser(contextTag.getPageContext()).getModel(); // get topic map id String tmid = contextTag.getTopicMapId(); // get topic map title String tmtitle = "[No name]"; TopicIF reifier = tm.getReifier(); if (reifier != null) tmtitle = TopicStringifiers.toString(reifier); else { TopicMapReferenceIF reference = tm.getStore().getReference(); if (reference != null) tmtitle = reference.getTitle(); } String tmids = getParameter("uri"); return "<a href=\"" + uri + "/models/topicmap_" + model + ".jsp?tm=" + tmid + "\" title=\"Link to topic map page.\">" + tmtitle + "</a>"; }
@Test public void testReificationMergeBug() throws IOException { // tests a tricky case where topics are merged because of reification, // and this causes the current topic to become a merged-away stub, thus // leading to failures down the line. // first read one topic map TopicMapIF tm = readTopicMap("various", "reification-bug-1.xtm"); // then import the second one into it String file = TestFileUtils.getTestInputFile("various", "reification-bug-2.xtm"); XTMTopicMapReader reader = new XTMTopicMapReader(TestFileUtils.getTestInputURL(file)); reader.importInto(tm); // this should not crash! // do some testing verifying that the XTM was interpreted correctly Assert.assertTrue("wrong number of topics", tm.getTopics().size() == 2); Assert.assertTrue("topic map is reified", tm.getReifier() != null); TopicIF reifier = getTopicById(tm, "reifier"); Assert.assertTrue("topic has no name", !reifier.getTopicNames().isEmpty()); }
public void testMergeReifiedSourceTopicMap() { // build TMs TopicIF reifier1 = builder1.makeTopic(); reifier1.addSubjectIdentifier(URILocator.create("test:reifier")); TopicIF reifier2 = builder2.makeTopic(); reifier2.addSubjectIdentifier(URILocator.create("test:reifier")); topicmap2.setReifier(reifier2); // merge MergeUtils.mergeInto(topicmap1, topicmap2); // previous line checks if moving topicmap causes it to lose // its reifier (which it should) // check assertTrue("Topic map did not lose reifier on merge", topicmap1.getReifier() == null); assertTrue("Topic did become reifier on merge", reifier1.getReified() == null); }
public void testMergeReifiedTopicMaps() { // build TMs TopicIF reifier1 = builder1.makeTopic(); reifier1.addSubjectIdentifier(URILocator.create("test:reifier")); topicmap1.setReifier(reifier1); TopicIF reifier2 = builder2.makeTopic(); reifier2.addSubjectIdentifier(URILocator.create("test:reifier")); topicmap2.setReifier(reifier2); // merge MergeUtils.mergeInto(topicmap1, topicmap2); // previous line checks if moving topicmap causes it to lose // its reifier // check assertTrue("Topic map lost reifier on merge", topicmap1.getReifier() == reifier1); assertTrue("Topic did become reifier on merge", reifier1.getReified() == topicmap1); }