From: Adriana <adr...@su...> - 2004-02-12 11:54:28
|
Hi all, I'm trying to do the following query: select $T from = PredicadoSemantico($T) ? Pat of the topic map is: <topic id=3D"PredicadoSemantico"> <instanceOf><topicRef xlink:href=3D"#Predicado"/></instanceOf> <subjectIdentity> <subjectIndicatorRef = xlink:href=3D"http://www.des.ime.eb.br/~Rosa/v1.0/#psi-predicadoSemantico= "/> </subjectIdentity><baseName id=3D"predicadoSemantico"> <baseNameString>PredicadoSemantico</baseNameString></baseName> </topic> <topic id=3D"fundamenta"> <instanceOf> <topicRef xlink:href=3D"#PredicadoSemantico"/> = </instanceOf> <baseName id=3D"x1j6o1bmoq-27"> = <baseNameString>fundamenta</baseNameString> </baseName> </topic> <topic id=3D"pre requisito"> <instanceOf> <topicRef xlink:href=3D"#PredicadoSemantico"/> = </instanceOf> <baseName id=3D"x1j6o1bmoq-c"> <baseNameString>pre = requisito</baseNameString> </baseName> </topic> <association id=3D"110"> <instanceOf><topicRef xlink:href=3D"#fundamenta"/></instanceOf> <member id=3D"x1j6o1bmoq-28"> <roleSpec> <topicRef xlink:href=3D"#agrupador"/> </roleSpec> <topicRef xlink:href=3D"#019"/> </member> <member id=3D"x1j6o1bmoq-2a"> <roleSpec><topicRef xlink:href=3D"#agrupado"/></roleSpec> <topicRef xlink:href=3D"#021"/> </member> </association> <association id=3D"107"> <instanceOf><topicRef xlink:href=3D"#pre requisito"/></instanceOf> <member id=3D"x1j6o1bmoq-d"> <roleSpec> <topicRef xlink:href=3D"#agrupador"/> </roleSpec> <topicRef xlink:href=3D"#002"/> </member> <member id=3D"x1j6o1bmoq-f"> <roleSpec><topicRef xlink:href=3D"#agrupado"/></roleSpec> <topicRef xlink:href=3D"#008"/> </member> </association> <association id=3D"hierarquia-predicado"> <instanceOf> <topicRef xlink:href=3D"#x1j6o1bn5p-13"/> </instanceOf> <member id=3D"x1j6o1bn5p-14"> <roleSpec> <topicRef xlink:href=3D"#x1j6o1bn5p-15"/> = </roleSpec> <topicRef xlink:href=3D"#Predicado"/> </member> <member id=3D"x1j6o1bn5p-16"> <roleSpec> <topicRef xlink:href=3D"#x1j6o1bn5p-17"/> </roleSpec> <topicRef xlink:href=3D"#PredicadoSemantico"/> </member> <member id=3D"x1j6o1bn5p-18"> <roleSpec> <topicRef xlink:href=3D"#x1j6o1bn5p-17"/> = </roleSpec> <topicRef xlink:href=3D"#Lista"/> </member> <member id=3D"x1j6o1bn5p-19"> <roleSpec> <topicRef xlink:href=3D"#x1j6o1bn5p-17"/> = </roleSpec> <topicRef xlink:href=3D"#Sacola"/> </member> </association> <topic id=3D"x1j6o1bn5p-17"> <subjectIdentity> <subjectIndicatorRef = xlink:href=3D"http://www.topicmaps.org/xtm/1.0/psi1.xtm#subclass"/> </subjectIdentity> </topic> <topic id=3D"x1j6o1bn5p-15"> <subjectIdentity> <subjectIndicatorRef = xlink:href=3D"http://www.topicmaps.org/xtm/1.0/psi1.xtm#superclass"/> </subjectIdentity> </topic> So.. when I search about PredicadoSemantico($T) the answer should be = all associations that are subclass too. If is impossible, how can I to do this if I don't know all = PredicadoSemantico (fundamenta, pre requisito, ... ) Thanks, Adriana. |
From: <zt...@sw...> - 2006-06-10 13:19:03
|
Hello, I want to use tolog in TMAPI to do some query about my topic map.How ca= n I do it? And is there any reference manual? Thanks in advance! zhouting |
From: Lars H. <he...@se...> - 2006-06-12 13:59:36
|
Hi, > I want to use tolog in TMAPI to do some query about my topic map.How can I > do it? And is there any reference manual? The current TM4J tolog implementation uses the TM4J native model (but you can use the tolog implementation with topic maps created with TMAPI). http://tm4j.org/docs/devguide/ch08.html#N11776 Note, that the tolog implementation is not feature complete, you cannot use all contructs described in the Ontopia Tolog guide. Best regards, Lars -- http://www.semagia.com http://www.topicgarden.com/mailinglist/ German Topic Maps mailinglist |
From: Lars H. <he...@se...> - 2006-06-12 14:13:12
|
Hi, [...] >> I want to use tolog in TMAPI to do some query about my topic map.How can I >> do it? And is there any reference manual? > The current TM4J tolog implementation uses the TM4J native model (but > you can use the tolog implementation with topic maps created with > TMAPI). > http://tm4j.org/docs/devguide/ch08.html#N11776 Note, that you've to "unwrap" the TMAPI topic map instance. Your code has to look like this: import org.tm4j.tmapi.helpers.Wrapper; // [...] // tmSystem points to your TopicMapSystem instance TopicMap tm = tmSystem.getTopicMap("http://example.org/"); QueryEvaluator qe = QueryEvaluatorFactory.newQueryEvaluator(Wrapper.unwrap(tm)); The Wrapper.unwrap call is important because the QueryEval.Fac. expects an instance of "org.tm4j.topicmap.TopicMap" (the native TM4j model). Best regards, Lars -- http://www.semagia.com http://www.topicgarden.com/mailinglist/ German Topic Maps mailinglist |
From: Dicheva, D. <dic...@ws...> - 2007-02-11 17:37:54
|
Hello all, In my effort to migrate TM4L to using TMAPI (which I recently renewed :-) I got to a problem in using the getScope() method of Variant. When I try=20 Collection vc =3D bn.getVariants(); Iterator it =3D vc.iterator(); while (it.hasNext()) { Variant var =3D (Variant) it.next(); Iterator si =3D var.getScope().iterator();=09 if (si.hasNext()){ Topic param =3D (Topic)si.next(); //***Exception Here**** I get: JavaLangClassCastException: Org.TM4J.TopicMap.Memory.TopicMapImpl It looks like the unmodifiable result set of var.getScope() is a set of TM4J topics and there is no way to cast them to TMAPI topics. Any ideas of how to solve this problem? Thanks, Darina |
From: Lars H. <he...@se...> - 2007-02-12 17:30:44
|
Hi Darina, [...] > Collection vc = bn.getVariants(); > Iterator it = vc.iterator(); > while (it.hasNext()) { > Variant var = (Variant) it.next(); > Iterator si = > var.getScope().iterator(); > if (si.hasNext()){ > Topic param = (Topic)si.next(); > //***Exception Here**** > I get: JavaLangClassCastException: > Org.TM4J.TopicMap.Memory.TopicMapImpl Are you sure that your "Variant" is a "org.tmapi.core.Variant" and not a "org.tm4j.topicmap.Variant"? I've the suspicion that you mix up the classes from TM4J and TMAPI by mistake. The name bound to "bn" must be an instance of type "org.tmapi.core.TopicName". If it is an instance of "org.tm4j.topicmap.BaseName", your iterator returns variants of type "org.tm4j.topicmap.Variant" and these instances return objects of type "org.tm4j.topicmap.Topic" if you call "getScope()". Please check if you're working with the TMAPI interfaces only. If you need to work with TM4J interfaces *and* TMAPI interfaces, the class "org.tm4j.tmapi.helpers.Wrapper" may help you to 'wrap' and 'unwrap' objects into both directions. Best regards, Lars -- http://www.semagia.com http://www.topicgarden.com/mailinglist/ German Topic Maps mailinglist |
From: Dicheva, D. <dic...@ws...> - 2007-02-12 20:01:17
|
Hi Lars, Thanks for your prompt reply. =20 > [...] > > Collection vc =3D bn.getVariants(); > > Iterator it =3D vc.iterator(); > > while (it.hasNext()) { > > Variant var =3D (Variant) it.next(); > > Iterator si =3D var.getScope().iterator(); =20 > > if (si.hasNext()){ > > Topic param =3D (Topic)si.next(); //***Exception Here**** >=20 > > I get: JavaLangClassCastException: > > Org.TM4J.TopicMap.Memory.TopicMapImpl >=20 > Are you sure that your "Variant" is a "org.tmapi.core.Variant" and not > a "org.tm4j.topicmap.Variant"? I've the suspicion that you mix up the > classes from TM4J and TMAPI by mistake. Well, the variant is TMAPI Variant - here is the value of "var" above: org.tm4j.tmapi.core.TMAPIVariantImpl@75327fd8 The name is also an TMAPI name:=20 I divided Iterator si =3D var.getScope().iterator(); into Set s =3D var.getScope(); Iterator si =3D s.iterator(); So, now the picture is: Collection vc =3D bn.getVariants(); Iterator it =3D vc.iterator(); while (it.hasNext()) { Variant var =3D (Variant) it.next(); Set s =3D var.getScope(); Iterator si =3D s.iterator(); =20 if (si.hasNext()){ Topic param =3D (Topic)si.next(); //***Exception Here**** =20 and just before the exception I have: var: org.tm4j.tmapi.core.TMAPIVariantImpl@75327fd8 but in the Set s: HashMap -> Table -> HashMap$Entry -> key [4] =3D org.tm4j.topicmap.memory.TopicImpl@d00f8c41 and the imports are: import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.tmapi.core.Locator; import org.tmapi.core.Topic; import org.tmapi.core.TopicMap; import org.tmapi.core.TopicName; import org.tmapi.core.Variant; import org.tmapi.index.core.TopicNamesIndex; So, I am not using TM4J directly, only TMAPI. Which means that the TMAPI getScope() applied on the TMAPI variant var returns an unmodifiable set of TM4J topics and that is why I am getting the cast exception. > If you need to work with TM4J interfaces *and* TMAPI interfaces, the > class "org.tm4j.tmapi.helpers.Wrapper" may help you to 'wrap' and > 'unwrap' objects into both directions. I don't really want to work with both interfaces, so I only use the TMAPI interface. Any further idea?=20 Thanks, Darina >=20 > Best regards, > Lars > --=20 > http://www.semagia.com > http://www.topicgarden.com/mailinglist/ German Topic Maps mailinglist >=20 >=20 |
From: Lars H. <he...@se...> - 2007-02-14 17:33:26
Attachments:
TestTMAPIVariant.java
|
Hi Darina, [...] > Well, the variant is TMAPI Variant - here is the value of "var" above: > org.tm4j.tmapi.core.TMAPIVariantImpl@75327fd8 That's strange. I found a bug in the Wrapper class (fixed in the CVS), but it was not related to the variant handling of TM4J. Which TM4J version are you using? Please use the CVS version, the official release is outdated. I've created a simple test case (attached) and everything works as expected, no exceptions. Please check, if the test case works with your TM4J installation. Best regards, Lars -- http://www.semagia.com http://www.topicmaps.de/mailinglist German Topic Maps mailinglist |
From: Lars H. <he...@se...> - 2007-02-15 15:09:15
|
Hi Darina, [...] > Variant var = (Variant) it.next(); > Set s = var.getScope(); > Iterator si = s.iterator(); > if (si.hasNext()){ > Topic param = (Topic)si.next(); //***Exception Here**** > I think, you're using an 'old' version of TM4J. While walking through the bug tracker, I've found this bug report here: <https://sourceforge.net/tracker/index.php?func=detail&aid=1433778&group_id=27895&atid=391879> This is exactly the same issue. It was fixed in Feb/2006. Best regards, Lars -- http://www.semagia.com http://www.topicmaps.de/mailinglist German Topic Maps mailinglist |
From: Dicheva, D. <dic...@ws...> - 2007-02-15 15:14:26
|
Thanks, Lars!=20 I will download the latest version from CVS. I do appreciate your help. All the best, Darina=20 > -----Original Message----- > From: tm4...@li...=20 > [mailto:tm4...@li...] On Behalf=20 > Of Lars Heuer > Sent: Thursday, February 15, 2007 10:11 AM > To: Dicheva, Darina > Cc: tm4...@li... > Subject: Re: [TM4J-users] Casting TMAPI - TM4J Topic Problem >=20 > Hi Darina, >=20 > [...] > > Variant var =3D (Variant) it.next(); > > Set s =3D var.getScope(); > > Iterator si =3D s.iterator(); =20 > > if (si.hasNext()){ > > Topic param =3D (Topic)si.next(); //***Exception Here**** > > =20 >=20 > I think, you're using an 'old' version of TM4J. >=20 > While walking through the bug tracker, I've found this bug=20 > report here: > <https://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D143 3778&group_id=3D27895&atid=3D391879> >=20 > This is exactly the same issue. > It was fixed in Feb/2006. >=20 > Best regards, > Lars > --=20 > http://www.semagia.com > http://www.topicmaps.de/mailinglist German Topic Maps mailinglist >=20 >=20 > -------------------------------------------------------------- > ----------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the=20 > chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge &CID=3DDEVDEV > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users >=20 |
From: Dicheva, D. <dic...@ws...> - 2007-02-16 15:49:43
|
Hi Lars, I downloaded the latest version of TM4J 0.9.8 from CVS, but now I have a different problem that reminds me though the problem I had in the very beginning of swiching to TMAPI and which was due to using differrent versions of TM4J in the complilion of TM4L anf TMAPI (see below).=20 After downloading TM4J, I created a binary which resulted in creating 6 jar files which I copied in the lib folder of my Eclipse TM4L project (I also deleted the 0.9.7 versions of those files from lib): tm4j-0.9.8.jar tm4jadmintool-0.9.8.jar tm4jdbc-0.9.8.jar tm4j-tmapi-0.9.8.jar tm4j-tologx-0.9.8.jar tm4ozone-0.9.8.jar=20 I am not sure was I supposed to do anything else?=20 Thanks, Darina ------------------- Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: org.tm4j.net.LocatorFactoryException: Could not instantiate locator for notation: 'URI' and address string 'file:C:\workspace\itm4l_api\xtm\try.xtm'. Cause: java.lang.reflect.InvocationTargetException. Nested cause: java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap at org.tm4j.tmapi.core.TMAPITopicMapSystemImpl.createTopicMap(TMAPITopicMap SystemImpl.java:105) at org.tm4j.tmapi.core.TMAPITopicMapSystemImpl.createTopicMap(TMAPITopicMap SystemImpl.java:89) at tm4l.utilities.utilitiesTM.UTopicMaps.createNewTopicMap(UTopicMaps.java: 118) at tm4l.ui.topicInfoTab.ButtonsPanel.actionPerformed(ButtonsPanel.java:187) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2 169) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.ja va:420) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonList ener.java:234) at java.awt.Component.processMouseEvent(Component.java:5488) at javax.swing.JComponent.processMouseEvent(JComponent.java:3093) at java.awt.Component.processEvent(Component.java:5253) at java.awt.Container.processEvent(Container.java:1966) at java.awt.Component.dispatchEventImpl(Component.java:3955) at java.awt.Container.dispatchEventImpl(Container.java:2024) at java.awt.Component.dispatchEvent(Component.java:3803) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822) at java.awt.Container.dispatchEventImpl(Container.java:2010) at java.awt.Window.dispatchEventImpl(Window.java:1766) at java.awt.Component.dispatchEvent(Component.java:3803) at java.awt.EventQueue.dispatchEvent(EventQueue.java:463) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThrea d.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread. java:163) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)=20 > -----Original Message----- > From: tm4...@li...=20 > [mailto:tm4...@li...] On Behalf=20 > Of Lars Heuer > Sent: Thursday, February 15, 2007 10:11 AM > To: Dicheva, Darina > Cc: tm4...@li... > Subject: Re: [TM4J-users] Casting TMAPI - TM4J Topic Problem >=20 > Hi Darina, >=20 > [...] > > Variant var =3D (Variant) it.next(); > > Set s =3D var.getScope(); > > Iterator si =3D s.iterator(); =20 > > if (si.hasNext()){ > > Topic param =3D (Topic)si.next(); //***Exception Here**** > > =20 >=20 > I think, you're using an 'old' version of TM4J. >=20 > While walking through the bug tracker, I've found this bug=20 > report here: > <https://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D143 3778&group_id=3D27895&atid=3D391879> >=20 > This is exactly the same issue. > It was fixed in Feb/2006. >=20 > Best regards, > Lars > --=20 > http://www.semagia.com > http://www.topicmaps.de/mailinglist German Topic Maps mailinglist >=20 >=20 > -------------------------------------------------------------- > ----------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the=20 > chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge &CID=3DDEVDEV > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users >=20 |
From: Dicheva, D. <dic...@ws...> - 2007-07-19 02:05:59
|
Hello all, I wonder how TOLOG can be used in a TMAPI-based app. We had it in TM4L before migrating to TMAPI... Any idea? Thanks, Darina |
From: Lars H. <he...@se...> - 2007-02-16 16:09:43
|
Hi Darina, > I downloaded the latest version of TM4J 0.9.8 from CVS, but now I have a Well, the CVS version isn't 0.9.8. It's newer. Do not use the binary downloads from TMJ, use the source. :) If you compile the source in from the CVS, you should get Jars in this form: tm4j-<builddate>.jar So, if you compile TM4J from source today, you'll get tm4j-20070215.jar tm4j-tmapi-20070215.jar ... [...] > I copied in the lib folder of my Eclipse TM4L project (I [Result from running TM4L] > java.lang.NoClassDefFoundError: > org/apache/commons/collections/map/LRUMap You need some additional libs in your build path. The error says, that the Apache Commons Collections lib is missing. The missing libs are located in the "tm4j/lib" folder (also in the CVS). You don't need all of them, but you add all of them into the build path if you want to be on the save side. :) Please note, that TM4J uses an old TMAPI release, you should use the TMAPI 1.0 SP1 release (you can find the release here: <http://sf.net/projects/tmapi/>) and remove the "tmapi-1_0.jar" the build path. Best regards, Lars -- http://www.semagia.com http://www.topicmaps.de/mailinglist German Topic Maps mailinglist |
From: Lars H. <he...@se...> - 2007-02-16 16:21:34
|
[...] > Please note, that TM4J uses an old TMAPI release, you should use the [...] Ok. If you check out TM4J *now* it ships with the correct TMAPI version (tmapi-1_0SP1.jar). :) Best regards, Lars -- http://www.semagia.com http://www.topicmaps.de/mailinglist German Topic Maps mailinglist |
From: Dicheva, D. <dic...@ws...> - 2007-02-16 16:26:32
|
Lars, Thanks so much for the quick fix and reply!! You save me quite a time :-)=20 Darina > -----Original Message----- > From: tm4...@li...=20 > [mailto:tm4...@li...] On Behalf=20 > Of Lars Heuer > Sent: Friday, February 16, 2007 11:26 AM > To: tm4...@li... > Subject: Re: [TM4J-users] Casting TMAPI - TM4J Topic Problem >=20 > [...] > > Please note, that TM4J uses an old TMAPI release, you should use the > [...] >=20 > Ok. If you check out TM4J *now* it ships with the correct TMAPI > version (tmapi-1_0SP1.jar). :) >=20 > Best regards, > Lars > --=20 > http://www.semagia.com > http://www.topicmaps.de/mailinglist German Topic Maps mailinglist >=20 >=20 > -------------------------------------------------------------- > ----------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the=20 > chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge &CID=3DDEVDEV > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users >=20 |
From: Dicheva, D. <dic...@ws...> - 2007-05-01 21:22:13
|
Hello, Can someone help? I am trying to set a Hibernate backend for TM4L but don't understand the concept of baseLocator for a topic map stored in a database. For example, what should be given in the create statement below, if "hibernate.connection.url" has a value of "jdbc:mysql://localhost/tm4l"=20 =09 createTopicMap(java.lang.String baseLocatorReference, java.lang.String baseLocatorNotation) Creates a new topic map with a specified base locator. Many thanks, Darina |
From: Lars H. <he...@se...> - 2007-05-07 13:39:38
|
Hi Darina, Please start a new thread for new topics and don't use the old "tolog" thread (from June 2006!) to post new questions. Thank you in advance. :) I assume, you're using the RDBMS backend through TMAPI? I've to admit that I never tried such a combination. > I am trying to set a Hibernate backend for TM4L but don't understand the > concept of baseLocator for a topic map stored in a database. For > example, what should be given in the create statement below, if > "hibernate.connection.url" has a value of "jdbc:mysql://localhost/tm4l" > > createTopicMap(java.lang.String baseLocatorReference, java.lang.String > baseLocatorNotation) > Creates a new topic map with a specified base locator. You can use any locator you like. It has nothing to do with the database URI. The base locator is just the URI of the topic map (the 'storage address', if you like). If you say tm = tmSys.reateTopicMap("http://www.example.org/my-tm"); A new topic map with the base locator "http://www.example.org/my-tm" is created. I assume, that you have to provide the connection URI via TopicMapSystemFactory tmSysFac = TopicMapSystemFactory.newInstance(); tmSysFac.setProperty("property-name", "property-value") TopicMapSystem tmSys = tmSysFac.newTopicMapSystem(); TopicMap m = tmSys.createTopicMap(......) or TopicMap m = tmSys.getTopicMap("your-base-locator-here"); Best regards, Lars -- http://www.semagia.com http://www.topicmaps.de/mailinglist German Topic Maps mailinglist |
From: Dicheva, D. <dic...@ws...> - 2008-05-12 02:12:32
|
Hello all, I have a problem in using the removeSubjectLocator(l) method - it just doesn't work for me ... I am copying a method to replace a subject locator of a topic with a new one - have no idea what I am doing wrong... Any help is highly appreciated. Thanks, Darina --------------- public static void replaceOldSubjectLocator(Topic t, String oldSubjectLocator, String newSubjectLocator, TopicMap tm) throws Exception { Collection sic = t.getSubjectLocators(); if (!sic.isEmpty()) { Iterator it = sic.iterator(); while (it.hasNext()) { Locator l = (Locator) it.next(); if (oldSubjectLocator.equals(l.getReference())) { t.removeSubjectLocator(l); } } } if (!newSubjectLocator.equals("")) { Locator siLoc = tm.createLocator(newSubjectLocator, "URI"); t.addSubjectLocator(siLoc); } } |
From: Lars H. <he...@se...> - 2008-05-14 13:39:06
|
Hi Darina, > I have a problem in using the removeSubjectLocator(l) method - it just > doesn't work for me ... What does not work? > I am copying a method to replace a subject locator of a topic with a new > one - have no idea what I am doing wrong... Possible problem: I believe that TM4J manages max. one subject locator (since XTM 1.0 allows just one). So, if you have a topic with subject locator "A" and you call your function with replaceOldSubjectLocator(t, "B", "C"); the existing subject locator ("A") would not have been matched with "B" and if you add "C", the locator "A" goes away since TM4J handles just one locator. (I am not sure if TM4J overrides any existing subject locator silently). Maybe you can drop in [tinyTiM] (for testing purposes) as TMAPI implementation and see if you get the expected results. tinyTiM handles 0..n subject locators and is more TMAPI compatible than TM4J. [tinyTiM] <http://sf.net/projects/tinytim> Best regards, Lars -- Semagia <http://www.semagia.com> |
From: Dicheva, D. <dic...@ws...> - 2008-05-14 14:47:00
|
Hi Lars, Thanks a lot for replying. > > I have a problem in using the removeSubjectLocator(l) method - it just > > doesn't work for me ... > > What does not work? Well, it just doesn't remove the subject locator: When I do: System.out.println("oldSubjectLocator: "+oldSubjectLocator); System.out.println("newSubjectLocator: "+newSubjectLocator); if (!oldSubjectLocator.equals("")) { Locator l = (Locator)t.getSubjectLocators().iterator().next(); System.out.println("loc 1: "+l.getReference()); System.out.println("loc 1: "+l.getNotation()); System.out.println("loc 1: "+l.toString()); t.removeSubjectLocator(l); Locator l2 = (Locator)t.getSubjectLocators().iterator().next(); System.out.println("loc 2: "+l2.getReference()); System.out.println("loc 2: "+l2.getNotation()); System.out.println("loc 2: "+l.toString()); } I get: [java] oldSubjectLocator: c:\\workspace\\TM4L_Plugins\\plugins\\XSLT\\out.xtm [java] newSubjectLocator: c:\\workspace\\TM4L_Plugins\\plugins\\XSLT\\out22.xtm [java] loc 1: c:\\workspace\\TM4L_Plugins\\plugins\\XSLT\\out.xtm [java] loc 1: URI [java] loc 1: org.tm4j.tmapi.core.TMAPILocatorImpl@1048d930 [java] loc 2: c:\\workspace\\TM4L_Plugins\\plugins\\XSLT\\out.xtm [java] loc 2: URI [java] loc 2: org.tm4j.tmapi.core.TMAPILocatorImpl@1048d930 obviously, the locator doesn't get removed, i.e. t.removeSubjectLocator(l); doesn't work ... And of course when after that I try to add the new subject locator, I get the error message that XTM1.0 doesn't allow more than 1 subject locator. > > > I am copying a method to replace a subject locator of a topic with a new > > one - have no idea what I am doing wrong... > > Possible problem: I believe that TM4J manages max. one subject locator > (since XTM 1.0 allows just one). So, if you have a topic with subject > locator "A" and you call your function with > > replaceOldSubjectLocator(t, "B", "C"); > > the existing subject locator ("A") would not have been matched with > "B" and if you add "C", the locator "A" goes away since TM4J handles > just one locator. > (I am not sure if TM4J overrides any existing > subject locator silently). Well, as you can see above, the locators "A" and "B" are the same ... > > Maybe you can drop in [tinyTiM] (for testing purposes) as TMAPI > implementation and see if you get the expected results. tinyTiM > handles 0..n subject locators and is more TMAPI compatible than TM4J. > > [tinyTiM] <http://sf.net/projects/tinytim> Thank you, however, if even I get it working there, this will not solve my problem in TM4L ... Any other idea that I can try? I really appreciate your effort to help. Darina > ------------------------------------------------------------------------ - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users |
From: Lars H. <he...@se...> - 2008-05-14 15:03:04
|
Hi Darina, [...] >> > I have a problem in using the removeSubjectLocator(l) method - it > just >> > doesn't work for me ... >> > Well, it just doesn't remove the subject locator: When I do: [...] > Any other idea that I can try? Seems to be a bug in the TMAPI impl: <http://tm4j.cvs.sourceforge.net/tm4j/tm4j/src/org/tm4j/tmapi/core/TMAPITopicImpl.java?revision=1.23&view=markup> 332 if (rawLoc.equals(m_obj.getSubject())) { 333 return; 334 } If the locator to be removed is equals to the current locator, that method returns. Strange. Correct impl: if (!rawLoc.equals(m_obj.getSubject())) { return; } If the locator IS NOT equal to the current locator, the method should do nothing. I'll try to commit the bug fix. I'll use the "TM4J_1_x" branch. So, you'll have to check out the "TM4J_1_x" branch and compile everything (at least the TMAPI stuff). Best regards, Lars -- Semagia <http://www.semagia.com> |
From: Lars H. <he...@se...> - 2008-05-14 15:27:17
|
[...] > If the locator IS NOT equal to the current locator, the method should > do nothing. > I'll try to commit the bug fix. I'll use the "TM4J_1_x" branch. So, > you'll have to check out the "TM4J_1_x" branch and compile everything > (at least the TMAPI stuff). Fixed in the CVS now. Remember: Use the TM4J_1_X branch! <https://sourceforge.net/tracker/index.php?func=detail&aid=1963893&group_id=27895&atid=391879> Best regards, Lars -- Semagia <http://www.semagia.com> |
From: Dicheva, D. <dic...@ws...> - 2008-05-15 18:28:22
|
Hi Lars, Many thanks for this. I checked out the corrected class (TMAPITopicImpl.java) and recompiled TM4J to get new jars, however, had a problem - I forgot that I had done some changes beforehand since TMAPI doesn't support TOLOG. So, TM4L cannot currently compile :-( Anyway, my question is, what is the smallest part containing the change that I can compile independently in a jar and add it to the other TM4J/TMAPI jars? Thanks, Darina > -----Original Message----- > From: tm4...@li... [mailto:tm4j-users- > bo...@li...] On Behalf Of Lars Heuer > Sent: Wednesday, May 14, 2008 11:28 AM > To: Lars Heuer > Cc: tm4...@li... > Subject: Re: [TM4J-users] Problem with removeSubjectLocator(l) > > [...] > > If the locator IS NOT equal to the current locator, the method should > > do nothing. > > > I'll try to commit the bug fix. I'll use the "TM4J_1_x" branch. So, > > you'll have to check out the "TM4J_1_x" branch and compile everything > > (at least the TMAPI stuff). > > Fixed in the CVS now. Remember: Use the TM4J_1_X branch! > <https://sourceforge.net/tracker/index.php?func=detail&aid=1963893&group _i > d=27895&atid=391879> > > Best regards, > Lars > -- > Semagia > <http://www.semagia.com> > > > > ------------------------------------------------------------------------ - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users |
From: Lars H. <he...@se...> - 2008-05-16 18:12:26
|
Hi Darina, [...] > doesn't support TOLOG. So, TM4L cannot currently compile :-( Anyway, my > question is, what is the smallest part containing the change that I can > compile independently in a jar and add it to the other TM4J/TMAPI jars? Search for "removeSubjectLocator" in your TMAPITopicImpl and change the the following lines from: if (rawLoc.equals(m_obj.getSubject())) { return; } into if (!rawLoc.equals(m_obj.getSubject())) { return; } Just add a ! in front to the rawLoc. In the original TMAPITopicImpl file that code appears in the lines 332 - 334. Best regards, Lars -- Semagia <http://www.semagia.com> |
From: Lars H. <he...@se...> - 2008-05-16 18:24:21
|
Hi Darina, [...] > question is, what is the smallest part containing the change that I can > compile independently in a jar and add it to the other TM4J/TMAPI jars? BTW, here is the coloured change set: <http://tm4j.cvs.sourceforge.net/tm4j/tm4j/src/org/tm4j/tmapi/core/TMAPITopicImpl.java?r1=1.23&r2=1.23.2.1&pathrev=TM4J_1_x> and here the patch: <http://tm4j.cvs.sourceforge.net/tm4j/tm4j/src/org/tm4j/tmapi/core/TMAPITopicImpl.java?r1=1.23&r2=1.23.2.1&view=patch&pathrev=TM4J_1_x> HTH, Lars -- Semagia <http://www.semagia.com> |