Here's my workaround: https://github.com/Graphity/graphity-processor/blob/master/src/main/java/org/graphity/processor/util/RulePrinter.java
Not tested really, but solves my immediate problem. On Fri, Sep 18, 2015 at 1:00 PM, Martynas Jusevičius <[email protected]> wrote: > Done: https://issues.apache.org/jira/browse/JENA-1030 > > On Fri, Sep 18, 2015 at 11:00 AM, Martynas Jusevičius > <[email protected]> wrote: >> Should we create a ticket for this at least? Let me know if you want >> me to do it. >> >> On Fri, Sep 18, 2015 at 10:55 AM, Dave Reynolds >> <[email protected]> wrote: >>> Hi Martynas, >>> >>> On 18/09/15 09:25, Martynas Jusevičius wrote: >>>> >>>> I'm on SPIN API 1.3.1 = Jena 2.11.0. >>> >>> >>> Ah, so patching Jena, even Jena2, won't help anyway unless you can upgrade. >>> >>>> There is no other way of serializing Rules to String though? It would make >>>> sense for toString() to do this, but for now I guess I'll need to work >>>> around this with my own printer. >>> >>> >>> No there's no separate serializer. It would make sense for the toString to >>> be round trippable and if it's just the URIs that are broken then as I say >>> that's easy to fix. >>> >>> I could put a fix in the Jena2 branch if that would help but if you are >>> stuck on 2.11.0 then I guess it doesn't actually solve your immediate >>> problem. >>> >>> Dave >>> >>> >>>> On Fri 18 Sep 2015 at 09:58 Dave Reynolds <[email protected]> >>>> wrote: >>>> >>>>> Hi Martynas, >>>>> >>>>> On 17/09/15 23:37, Martynas Jusevičius wrote: >>>>>> >>>>>> Hit send too soon! >>>>>> >>>>>> When the list is serialized back to String again, 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 ) ] ] ' >>>>>> >>>>>> Can you confirm this is a bug? I need to roundtrip Rules from Strings >>>>>> to objects and back. >>>>> >>>>> >>>>> There's no guarantee that Rule.toString will round trip, it's just there >>>>> for debugging, that's why the javadoc says "Printable string describing >>>>> the rule". >>>>> >>>>> However, it ought to be easy to put <> round the absolute URIs and if >>>>> that's enough to give you round tripping then great. >>>>> >>>>> Can't do this myself at present - I don't have a working built of Jena3, >>>>> still on Jena2. Are you on Jena2 or Jena3? >>>>> >>>>> Dave >>>>> >>>> >>>
