[ 
https://issues.apache.org/jira/browse/JENA-2019?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17283586#comment-17283586
 ] 

Andy Seaborne commented on JENA-2019:
-------------------------------------

Note: fix was 2020-12-20 and that is after the last release 3.17.0 on 
2020-12-01.

Which code did you pull from the repo? (which commit id?)

Does
{code}
@prefix my: <http://test/expressions#> .

# Rule including string "("
[(?a my:text "(") -> ]
{code}
And a call to 
{code:java}
List<Rule> rules = Rule.rulesFromURL(my_rules_path)
{code}
work for you?

Note: https://github.com/apache/jena/commit/58de541/ -- it is in the test suite.

The report example works for me with the latest  code (note the branch is now 
"main").

comma does not work.

This works for me:
{noformat}
@prefix my: <http://test/dream#> .

[ -> print('test jena!') ]
[(?a my:text "(") -> ]
-> print("(").
-> print('(').
[ -> print('(') ]
-> print(')') .
## -> print(",").
## -> print(',').
-> print(".").
-> print("->").
-> print("[").
-> print("]").
-> print(":").
-> print("?").
-> print("<<").
{noformat}

 

> Rule$ParserException in Jena rules when string literal equals to open 
> parenthesis
> ---------------------------------------------------------------------------------
>
>                 Key: JENA-2019
>                 URL: https://issues.apache.org/jira/browse/JENA-2019
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Jena
>    Affects Versions: Jena 3.16.0, Jena 3.17.0
>         Environment: _> java -version_
> openjdk version "1.8.0_232"
> OpenJDK Runtime Environment (build 1.8.0_232-BellSoft-b10)
> OpenJDK 64-Bit Server VM (build 25.232-b10, mixed mode)
> Windows 8.1
>            Reporter: rdfman
>            Assignee: Andy Seaborne
>            Priority: Major
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> I have some [Jena 
> rules|https://jena.apache.org/documentation/inference/#RULEsyntax] and I 
> {color:#172b4d}need {color}to test a string literal in them:
> {code:java}
> @prefix my: <http://test/expressions#> .
> # Rule including string "("
> [(?a my:text "(") -> ]      # fails for '(' is single quotes too
> {code}
> And a call to 
> {code:java}
> List<Rule> rules = Rule.rulesFromURL(my_rules_path)
> {code}
> throws:
> {noformat}
> Exception in thread "main" 
> org.apache.jena.reasoner.rulesys.Rule$ParserException: Expected ')' at end of 
> clause, found ]
> At '[ ( ?a my:text " ( " ) -> ] '
>         at 
> org.apache.jena.reasoner.rulesys.Rule$Parser.parseNodeList(Rule.java:987)
>         at 
> org.apache.jena.reasoner.rulesys.Rule$Parser.parseNode(Rule.java:906)
>         at 
> org.apache.jena.reasoner.rulesys.Rule$Parser.parseNodeList(Rule.java:983)
>         at 
> org.apache.jena.reasoner.rulesys.Rule$Parser.parseClause(Rule.java:998)
>         at 
> org.apache.jena.reasoner.rulesys.Rule$Parser.doParseRule(Rule.java:1057)
>         at 
> org.apache.jena.reasoner.rulesys.Rule$Parser.parseRule(Rule.java:1030)
>         at org.apache.jena.reasoner.rulesys.Rule.parseRules(Rule.java:666)
>         at org.apache.jena.reasoner.rulesys.Rule.rulesFromURL(Rule.java:515)
>         at org.apache.jena.reasoner.rulesys.Rule.rulesFromURL(Rule.java:526)
>         at ru.vstu.Main.runReasoning(Main.java:64){noformat}
> This crash happens if the string is exactly equal to *"("* (the use of double 
> quotes or single quotes does not matter). Escaping also with backslash *"\ 
> ("* does not help.
>  Changing the original string from *"("* to *"()"* , *"(("* , *"-("* or *")"* 
> eliminates the exception (but this is not what i want).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to