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

rdfman commented on JENA-2019:
------------------------------

I pulled the repo 2 days ago, the commit I used is on *master*: 
4321d11a9bfef4258104860c44b5d6d1991f5790 
(I will use *main* next time, thank you).

The code I originally posted: 
{code:java}
# Rule including string "("
[(?a my:text "(") -> ]
{code}
still does not work (the first FAIL in my pastebin snippet).

I used jdk14 for maven to compile *jena-core* only and substituted my project 
dependency on jena-core:3.17.0 with the built 3.18.0-SNAPSHOT. Maybe I have to 
rebuild more modules?

I used both openjdk 8 and jdk14 to run my code and experiences the same 
behaviour.

 

> 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