Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1030

Rule.toString() prevents roundtripping rules between objects and strings

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Jena 2.11.0
    • Fix Version/s: Jena 3.0.1
    • Component/s: Reasoners
    • Labels:
      None

      Description

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

        Attachments

          Activity

            People

            • Assignee:
              der Dave Reynolds
              Reporter:
              graphity Martynas Jusevičius
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: