jena icon indicating copy to clipboard operation
jena copied to clipboard

Add support for literals with language tags to the GenericRuleReasoner's rules syntax

Open bnouwt opened this issue 1 year ago • 1 comments

Version

5.3.0

Feature

Loading the following rule with the Rule.parseRules(...) method gives an error.

-> (<http://example.org/#spiderman> <http://xmlns.com/foaf/0.1/name> "Человек-паук"@ru) .
org.apache.jena.reasoner.rulesys.Rule$ParserException: Triple with 4 nodes!
At '-> ( <http://example.org/#spiderman> <http://xmlns.com/foaf/0.1/name> " Человек-паук " @ru ) '
	at org.apache.jena.reasoner.rulesys.Rule$Parser.parseClause(Rule.java:1016)
	at org.apache.jena.reasoner.rulesys.Rule$Parser.doParseRule(Rule.java:1081)
	at org.apache.jena.reasoner.rulesys.Rule$Parser.parseRule(Rule.java:1046)
	at org.apache.jena.reasoner.rulesys.Rule.parseRules(Rule.java:664)
	at org.apache.jena.reasoner.rulesys.Rule.parseRules(Rule.java:678)
	at org.apache.jena.reasoner.rulesys.Rule.parseRules(Rule.java:690)
        ...
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

After checking the source it seems like literals with language tags are not supported by the current Rule syntax.

We ran into this issue because we are trying to convert a string with RDF in turtle format into a string with every triple converted into the following Apache Jena's rule format:

-> ( <subject> <predicate> <object> ) .

The lack of support for language tags is currently not blocking for us.

Are you interested in contributing a solution yourself?

Perhaps?

bnouwt avatar Mar 03 '25 16:03 bnouwt

Tangent:

The Data Shapes Working Group is going to working on "rules" and would appreciate use cases and requirements to scope and guide the work.

https://lists.w3.org/Archives/Public/public-shacl/2025Mar/0019.html

afs avatar Mar 03 '25 18:03 afs