/** * Removes the topic from the topic map. * @param listener listener that gets call back from the deleting this topic, and any dependencies.p */ public void remove(LifeCycleListener listener) { if (listener != null) listener.onBeforeDelete(this); topicIF.remove(); }
protected static void removeTopicIfExist(TopicMapIF topicmap, LocatorIF base_on, String ref) { LocatorIF loc = base_on.resolveAbsolute(ref); TopicIF topic = topicmap.getTopicBySubjectIdentifier(loc); if (topic != null) topic.remove(); }
@Override public void remove(LifeCycleListener listener) { // remove all associated role fields Iterator<RoleField> iter = getFieldsForRoles().iterator(); while (iter.hasNext()) { RoleField rf = iter.next(); rf.remove(listener); } // remove association type topic if (listener != null) listener.onBeforeDelete(this); getTopicIF().remove(); }
@Override public void remove(LifeCycleListener listener) { // remove all associated role fields Iterator<RoleField> iter = getFieldsForRoles().iterator(); while (iter.hasNext()) { RoleField rf = iter.next(); rf.remove(listener); } // remove association type topic if (listener != null) listener.onBeforeDelete(this); getTopicIF().remove(); }
protected void removeTopic(TopicMapIF topicmap, TopicIF topic) throws BackingStoreException { // specs: "If this method is invoked on a node that has been removed with the removeNode() method, // flushSpi() is invoked on this node, but not on others." // so, first remove children, then topic itself logger.debug("Removing topic " + TopicStringifiers.toString(topic)); for (TopicIF child : fetchChildren(topicmap, topic)) { removeTopic(topicmap, child); } topic.remove(); }
public void updateRecentFiles(File f) { TopicIF recentFile = this.getRecentFile(f); if (recentFile == null) recentFile = this.createRecentFile(f); // Update timestamp OccurrenceIF lastVisited = this.getOccurrence(recentFile, timestamp); lastVisited.setValue(Long.toString(new Date().getTime())); // Limit recent files list to 10 items List recentFiles = this.getRecentFiles(); if (recentFiles.size() == 10) this.getRecentFile((File) recentFiles.get(9)).remove(); }
@Override public void run() { TopicIF t = (TopicIF)this.data.remove("TopicIF"); this.objectId = t.getObjectId(); t.remove(); } });
public static void removeNullTopic(TopicMapIF topicmap) { TopicIF topic = topicmap.getTopicBySubjectIdentifier(nullPSI); if (topic != null) { if (topic.getReified() != null) return; ClassInstanceIndexIF cindex = (ClassInstanceIndexIF)topicmap.getIndex(ClassInstanceIndexIF.class.getName()); if (cindex.usedAsType(topic)) return; ScopeIndexIF sindex = (ScopeIndexIF)topicmap.getIndex(ScopeIndexIF.class.getName()); if (sindex.usedAsTheme(topic)) return; topic.remove(); } }
public void unregisterOntopolyTopicMap(String referenceId) { TopicMapIF systemtm = getSystemTopicMap(); QueryProcessorIF processor = QueryUtils.getQueryProcessor(systemtm); QueryMapper<TopicIF> qm = new QueryMapper<TopicIF>(processor); List<TopicIF> topics = qm.queryForList( "using ont for i\"http://psi.ontopia.net/ontology/\" " + "select $T from instance-of($T, ont:ted-topic-map), " + "ont:topic-map-id($T, %ID%)?", Collections.singletonMap("ID", referenceId)); for (TopicIF topic : topics) { topic.remove(); } saveSystemTopicMap(systemtm); }
protected static void removeTopic(TopicMapIF topicmap, LocatorIF base_on, String ref) { LocatorIF loc = base_on.resolveAbsolute(ref); TopicIF topic = topicmap.getTopicBySubjectIdentifier(loc); if (topic == null) throw new OntopiaRuntimeException("Cannot find topic with id " + loc.getAddress()); else topic.remove(); }
protected static void removeTopic(TopicMapIF topicmap, LocatorIF base_on, String ref) { LocatorIF loc = base_on.resolveAbsolute(ref); TopicIF topic = topicmap.getTopicBySubjectIdentifier(loc); if (topic == null) throw new OntopiaRuntimeException("Cannot find topic with id " + loc.getAddress()); else topic.remove(); }
public void testTypelessTopicName() { // first build test topic TopicIF topic = builder.makeTopic(); builder.makeTopicName(topic, "Test topic"); // now remove it so we get an NPE topic.remove(); } }
public void testTopicRemoval() { TopicIF t1 = builder.makeTopic(); TopicNameIF bn1 = builder.makeTopicName(t1, "bn1"); assertTrue("couldn't find base name via name", ix.getTopicNames("bn1").size() == 1); assertTrue("wrong base name found via latin1 string", ix.getTopicNames("bn1").iterator().next().equals(bn1)); t1.remove(); assertTrue("found base name after topic had been removed", ix.getTopicNames("bn1").size() == 0); }
@Override public void run() { TopicNameIF bn = getTopicName(); TopicIF type = builder.makeTopic(); // create type bn.setType(null); TopicIF xtype = (TopicIF)this.data.remove("type"); // remove type xtype.remove(); this.objectId = bn.getObjectId(); } });
public void testTopicRemovalPolicyTypeUse() { //! System.out.println("TM: " + tm.getTopics()); //! System.out.println("--0"); TopicIF topic = builder.makeTopic(); TopicIF other = builder.makeTopic(); //! System.out.println("--1"); other.addType(topic); //! System.out.println("--2"); topic.remove(); assertEquals("To many topics after remove", 0, topicmap.getTopics().size()); }
public void testDeleteInstanceOfSelf() { TopicIF topic = builder.makeTopic(); topic.addType(topic); topic.remove(); assertTrue("topic was not deleted", topic.getTopicMap() == null); }
@Override public void run() { OccurrenceIF o = getOccurrence(); TopicIF type = builder.makeTopic(); // create type type.addSubjectIdentifier(URILocator.create("type:cleared")); o.setType(type); TopicIF xtype = (TopicIF)this.data.remove("type"); // remove type xtype.remove(); this.objectId = o.getObjectId(); } });
@Test public void testURN() throws URISyntaxException { TopicIF t1 = builder.makeTopic(); TopicIF t2 = builder.makeTopic(); t1.addSubjectIdentifier(URILocator.create("urn:test1")); t2.addSubjectIdentifier(URILocator.create("urn:TEST1")); topicmap.getStore().commit(); Assert.assertEquals(2, topicmap.getTopics().size()); topicmap.getTopicBySubjectIdentifier(URILocator.create("urn:test1")).remove(); topicmap.getStore().commit(); Assert.assertEquals(1, topicmap.getTopics().size()); }
public void testTopicTypeDeletion() { TopicMapIF topicmap = makeTopicMap(); TopicMapBuilderIF builder = topicmap.getBuilder(); TopicIF morituri = builder.makeTopic(); TopicIF instance = builder.makeTopic(morituri); morituri.remove(); assertTrue("Topic still connected to topic map", morituri.getTopicMap() == null); assertTrue("Topic map not empty", topicmap.getTopics().size() == 0); }
@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()); }