From: Lars H. <tm...@qu...> - 2004-12-28 12:35:43
|
Hi George, I try to answer your bug report here. > Summary: TMAPI "features" [...] > propsprops.setProperty > ("http://tmapi.org/features/readOnly", > "true"); > mapFeatures.put > ("http://tmapi.org/features/readOnly", Boolean.TRUE); > TMAPITopicMapSystemImpl tmApiSystImpl = new > TMAPITopicMapSystemImpl > (providerFactory.getClass().getName(), props, mapFeatures); This is not the way how you should work with TMAPI. You've to create an instance of the TopicMapSystemFactory first. import org.tmapi.core.*; TopicMapSystem tmSys = null; TopicMapSystemFactory tmSysFac = TopicMapSystemFactory.newInstance(); try { tmSysFac.setFeature("http://tmapi.org/features/readOnly", true); tmSys = tmSysFac.newTopicMapSystem(); catch (TMAPIException ex) { // Do something useful here. } It is a bad thing to use the TMAPITopicMapSystemImpl directly, because you cannot switch between the underlying topicmap processor and the one goal of TMAPI goes away. > URI uri = ... > InputStream is = uri.toURL().openStream (); > TopicMap tm = OpenXtmSupport.readXtm (is, [...] Here you've switched to the TM4J API again. You should not do it. You should only use the TMAPI. IMO the failure that the TopicMapSystem does not throw an UnsupportedOperationException if you try to change the readOnly TopicMapSystem instance goes back to the switching between TM4J API and TMAPI. You should only use TMAPI interfaces and not work with the wrapped TM4J objects directly (or if you have to work with them, do it carefully and only if really necessary). IMO the bug, that no exception is thrown if the TopicMapSystem is read only was fixed in 0.98 (Look into the source of the TMAPI objects, there must be something like a call to "checkIfReadOnly()" or something like that). > but still I don't get Exception when I change the TopicMap. > also I can't merge without TopicName (they merge > TopicNames) I'm not sure but I think disabling merging by TopicName is not supported by TM4J... . Best regards, Lars |