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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Jena 2.11.0
    • Jena 3.0.1
    • Reasoners
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: