You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (Jira)" <ji...@apache.org> on 2020/12/20 21:58:01 UTC

[jira] [Resolved] (JENA-2019) Rule$ParserException in Jena rules when string literal equals to open parenthesis

     [ https://issues.apache.org/jira/browse/JENA-2019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andy Seaborne resolved JENA-2019.
---------------------------------
    Resolution: Fixed

> 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)