From: Thomas M. <th...@sn...> - 2006-01-31 18:45:54
|
Hi, is it possible with Tolog (from TM4J 0.9.7) to construct a query string that finds exactly one topic with a given id or source locator? I tried select $T from source-locator($T,s"mybase#myid") ? but it returns 0 matches. The source locator definitely exists, because if I use a non-existing locator, an exception is thrown. select $T,$LOC from source-locator($T,$LOC) ? works without problems and lists all topics and their locators. Any ideas? Thanks & bye, Thomas |
From: Lars H. <he...@se...> - 2006-02-05 18:31:11
|
Hi Thomas, [...] > is it possible with Tolog (from TM4J 0.9.7) to construct a query string that > finds exactly one topic with a given id or source locator? > select $T from source-locator($T,s"mybase#myid") ? [...] Just a guess (did not tried it): is the 's' prefix necessary? If you're calling the source-locator predicate tolog should already know that you're searching for a source locator. I believe that the tolog processor interprets the 's"mybase#myid" as the pattern it should match and since there is no source locator that matches the result is empty. Best regards, Lars -- http://semagia.com |
From: Thomas M. <th...@sn...> - 2006-02-06 11:17:04
|
Hi Lars, >> select $T from source-locator($T,s"mybase#myid") ? > Just a guess (did not tried it): is the 's' prefix necessary? Yes - if I omit it, I'll get a TologParserException. I tried another example from Ontopia's predicate reference, which should do exactly what I want: select $T from topic($T),source-locator($T,s"mybase#myid")? or simpler select $T from topic($T),source-locator($T,myid)? But again I get 0 results with TM4J-Tolog... Is there any other way of finding a topic by a given id or source locator? (It works if I use the Java API, but I need to use Tolog in this case.) bye, Thomas |
From: Lars H. <he...@se...> - 2006-02-07 12:36:58
|
Hi Thomas, [...] > I tried another example from Ontopia's predicate reference, which should do > exactly what I want: > select $T from topic($T),source-locator($T,s"mybase#myid")? I suspect that this is a valid example. s"something" refers to a topic map construct and this shouldn't be a valid input for the source-locator predicate. [...] > But again I get 0 results with TM4J-Tolog... Is there any other way of > finding a topic by a given id or source locator? (It works if I use the Java > API, but I need to use Tolog in this case.) I identified the problem: All predicates that are able to handle URIs (such as baselocator, subject-identifier, subject-locator, source-locator) check if the URI part is a Locator instance. But this condition never evaluates to true because the TologParser never creates Locator instances as input for predicates. They should check for a String instance instead of a Locator instance. And all results they produce should also be String instances (Locator.getAddress()) instead of the Locator object instances. But that does not solve the whole problem, because the TologParser does not handle URIs / Strings as input very well. This needs also be fixed. In short: There is no way to fecth an object by its item identifier, subject identifier, or subject locator until the parser and predicates are fixed. I'll provide some patches in the next few days. Best regards, Lars -- http://semagia.com |
From: Thomas M. <th...@sn...> - 2006-02-07 22:54:56
|
am 07.02.2006 13:41 Uhr schrieb Lars Heuer unter he...@se...: > I suspect that this is a valid example. s"something" refers to a > topic map construct and this shouldn't be a valid input for the > source-locator predicate. You're right, I substituted the string argument for a locator argument because Tolog would not acccept the string. > In short: There is no way to fecth an object by its item identifier, > subject identifier, or subject locator until the parser and predicates > are fixed. > I'll provide some patches in the next few days. Well, that'd be the perfect solution :-). Thanks a lot! bye, Thomas |