How to create rdf:parseType="Resource" in XML serialization?

14 views
Skip to first unread message

koni...@googlemail.com

unread,
Jan 4, 2018, 7:16:21 PM1/4/18
to rdflib-dev
Hi all,
I parsed some RDF from XML and now want to serialize it back to XML. How can I generate rdf:parseType="Resource" in the serialization to avoid all the inner nodes.

To show what I mean: The following is the the XML the pretty-xml serializer is generating

<rdf:Description rdf:about="./results/tellurium_plot_1.pdf">
<dcterms:modified>
<rdf:Description rdf:nodeID="N599f63215c884114b6de1769bf6838e1">
<dcterms:W3CDTF>2018-01-04 23:12:16.426596+00:00</dcterms:W3CDTF>
</rdf:Description>
</dcterms:modified>
<dcterms:created>
<rdf:Description rdf:nodeID="N0fa557e629a149d2b79ec4d9db0abf68">
<dcterms:W3CDTF rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2018-01-04T23:12:16.426596+00:00</dcterms:W3CDTF>
</rdf:Description>
</dcterms:created>
</rdf:Description>

But I want to generate the compact XML of the form

<dcterms:created rdf:parseType="Resource">
<dcterms:W3CDTF>2017-12-16T00:09:20Z</dcterms:W3CDTF>
</dcterms:created>
<dcterms:modified rdf:parseType="Resource">
<dcterms:W3CDTF>2017-12-16T00:09:20Z</dcterms:W3CDTF>
</dcterms:modified>

which is what the XML schema is expecting.
So how can I generate the rdf:parseType="Resource" when serializing my RDF graph.

Thanks so much for any help.
Best Matthias

Reply all
Reply to author
Forward
0 new messages