You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Martynas Jusevičius (JIRA)" <ji...@apache.org> on 2015/09/18 13:01:04 UTC

[jira] [Updated] (JENA-1030) Rule.toString() prevents roundtripping rules between objects and strings

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

Martynas Jusevičius updated JENA-1030:
--------------------------------------
    Description: 
I have a {{List<Rule>}} created using {{Rule.parseRules}} from a string:

{noformat}[inheritance: (?template rdf:type <http://graphity.org/gp#Template>),
(?template ?p ?o), (?p rdf:type owl:AnnotationProperty), (?p
rdfs:isDefinedBy <http://graphity.org/gp#>), (?subClass
rdfs:subClassOf ?template), noValue(?subClass ?p) -> (?subClass ?p ?o)
]{noformat}

When the list is serialized using {{toString()}}, I get

{noformat}[[ inheritance: (?template rdf:type http://graphity.org/gp#Template)
(?template ?p ?o) (?p rdf:type owl:AnnotationProperty) (?p
rdfs:isDefinedBy http://graphity.org/gp#) (?subClass rdfs:subClassOf
?template) noValue(?subClass ?p) -> (?subClass ?p ?o) ]]{noformat}

Notice the missing {{< >}} brackets on URIs. Reparsing the string gives an
exception:

{noformat}com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Malformed rule
At 'http://graphity.org/gp# ) ( ?subClass rdfs:subClassOf ?template )
noValue ( ?subClass ?p ) -> ( ?subClass ?p ?o ) ] ] '{noformat}

  was:
I have a {{List<Rule>}} created using {{Rule.parseRules}} from a string:

{{[inheritance: (?template rdf:type <http://graphity.org/gp#Template>),
(?template ?p ?o), (?p rdf:type owl:AnnotationProperty), (?p
rdfs:isDefinedBy <http://graphity.org/gp#>), (?subClass
rdfs:subClassOf ?template), noValue(?subClass ?p) -> (?subClass ?p ?o)
]}}

When the list is serialized using {{toString()}}, I get

{{[[ inheritance: (?template rdf:type http://graphity.org/gp#Template)
(?template ?p ?o) (?p rdf:type owl:AnnotationProperty) (?p
rdfs:isDefinedBy http://graphity.org/gp#) (?subClass rdfs:subClassOf
?template) noValue(?subClass ?p) -> (?subClass ?p ?o) ]]}}

Notice the missing {{< >}} brackets on URIs. Reparsing the string gives an
exception:

{{com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Malformed rule
At 'http://graphity.org/gp# ) ( ?subClass rdfs:subClassOf ?template )
noValue ( ?subClass ?p ) -> ( ?subClass ?p ?o ) ] ] '}}


> Rule.toString() prevents roundtripping rules between objects and strings
> ------------------------------------------------------------------------
>
>                 Key: JENA-1030
>                 URL: https://issues.apache.org/jira/browse/JENA-1030
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Reasoners
>    Affects Versions: Jena 2.11.0
>            Reporter: Martynas Jusevičius
>            Priority: Minor
>
> I have a {{List<Rule>}} created using {{Rule.parseRules}} from a string:
> {noformat}[inheritance: (?template rdf:type <http://graphity.org/gp#Template>),
> (?template ?p ?o), (?p rdf:type owl:AnnotationProperty), (?p
> rdfs:isDefinedBy <http://graphity.org/gp#>), (?subClass
> rdfs:subClassOf ?template), noValue(?subClass ?p) -> (?subClass ?p ?o)
> ]{noformat}
> When the list is serialized using {{toString()}}, I get
> {noformat}[[ inheritance: (?template rdf:type http://graphity.org/gp#Template)
> (?template ?p ?o) (?p rdf:type owl:AnnotationProperty) (?p
> rdfs:isDefinedBy http://graphity.org/gp#) (?subClass rdfs:subClassOf
> ?template) noValue(?subClass ?p) -> (?subClass ?p ?o) ]]{noformat}
> Notice the missing {{< >}} brackets on URIs. Reparsing the string gives an
> exception:
> {noformat}com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Malformed rule
> At 'http://graphity.org/gp# ) ( ?subClass rdfs:subClassOf ?template )
> noValue ( ?subClass ?p ) -> ( ?subClass ?p ?o ) ] ] '{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)