From: Richard G. <ric...@ya...> - 2005-01-12 16:43:01
|
To answer my own question, I simply had to delete the braces "}" from my query and rule and it solved that problem. I also had to use replacement values, rather than having topic names, such as \"11.06.01 rRNA modification\", in my query, as the escaped double quote gave me the same error. This particular query runs fine now, and I now what to do in the future. What seemed strange, and had me really confused, was that it was only the closing brace "}", rather than the opening brace earlier in the rule which was giving me the exception. I still don't know why that was. Cheers, Richard. --- Richard Gregory <ric...@ya...> wrote: > Hi, > > I have the following code which adds a tolog rule and then executes a query using that rule, > based > on example 8.2 of the tm4j development guide. > > queryEval.addRule( > "func-loc($PROTEIN, $LOCATION, $FUNCTION) :- { " + > "at-located-in($LOCATION : tt-loc, $PROTEIN : tt-protein), " + > "at-has-function($FUNCTION : tt-function, $PROTEIN : tt-protein) }."); > > > TologResultsSet results = queryEval.execute( > "select $PROTEIN, $FUNCTION, $LOCATION from { " + > "topic-name($FUNCTION, $FUNCTION_NAME), " + > "value($FUNCTION_NAME, \"11.06.01 rRNA modification\"), " + > "topic-name($LOCATION, $LOCATION_NAME), " + > "value($LOCATION_NAME, \"70.10.07 nucleolus\"), " + > "func-loc($PROTEIN, $LOCATION, $FUNCTION) } " + > "order by $PROTEIN? "); > > However, when I run the code I get a TologParserException message, suggesting that it doesn't > like > the closing '}' in my rule. > > Exception caught: org.tm4j.tologx.TologParserException: Parser error in rule string. > org.tm4j.tologx.TologParserException: Parser error in rule string. > at org.tm4j.tologx.memory.QueryEvaluatorImpl.addRule(QueryEvaluatorImpl.java:136) > at mips.genre.topicmaps.TologTests.main(TologTests.java:71) > Caused by: line 1:169: unexpected token: } > at org.tm4j.tologx.parser.TologParser.orclause(TologParser.java:828) > at org.tm4j.tologx.parser.TologParser.clause(TologParser.java:729) > at org.tm4j.tologx.parser.TologParser.clauselist(TologParser.java:437) > at org.tm4j.tologx.parser.TologParser.rule(TologParser.java:314) > at org.tm4j.tologx.memory.QueryEvaluatorImpl.addRule(QueryEvaluatorImpl.java:132) > > I also tried using the addRulesModule() method, but I get the same exception generated by the > same > part of the rule. > > I anyone can tell me where I'm going wrong here (as I'm sure it's something I'm doing wrong), > I'd > be grateful. > > Cheers, > > Richard. > > > > > > > ___________________________________________________________ > ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users > ___________________________________________________________ ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com |