How to influence the seralization

Hi,
Is there a way to influence the seralization of a query result. I don’t mean the option to choose the format (RDF/XML, Turtle, …) but within a given format.

For example, I have RDF-data ike this:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:s="http://example/schema/">
  <rdf:Description about="http://example/alice">
    <s:likes rdf:resource="http://example/strawberry"
       s:color="red"
       s:taste="sweet"/>
    <s:likes rdf:resource="http://example/river"
       s:color="blue"
       s:temperature="cold"/>
  </rdf:Description>
</rdf:RDF>

The point here is that the information is nested: alice likes two objects (strawberry, river) which have properties on their own.

Now, let’s query this data with this construct:

prefix : <http://example/>
prefix s: <http://example/schema/>

construct {
  ?person s:likes ?object.
  ?object ?property ?value.
}
where {
  ?person s:likes ?object.
  ?object ?property ?value.
}

this returns all the information of the original data above. However, stardog serializes it in flat a structure:

<rdf:RDF>
    <rdf:Description rdf:about="http://example/alice">
        <s:likes rdf:resource="http://example/strawberry"/>
    </rdf:Description>
    <rdf:Description rdf:about="http://example/strawberry">
        <s:color>red</s:color>
        <s:taste>sweet</s:taste>
    </rdf:Description>
    <rdf:Description rdf:about="http://example/alice">
        <s:likes rdf:resource="http://example/river"/>
    </rdf:Description>
    <rdf:Description rdf:about="http://example/river">
        <s:color>blue</s:color>
        <s:temperature>cold</s:temperature>
    </rdf:Description>
</rdf:RDF>

Is there a way to force stardog to try to group information whenever possible in such a scenario?

Cheers,
Immanuel

It sounds like you’re looking for the RDF/XML-ABBREV syntax. It’s not a formal syntax and I don’t believe that Stardog supports it. At least it’s not listed as a format when running stardog help query execute. There are third party tools that will convert from what you’ve got to that syntax such as the Jena riot command.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.