Plugin serializers¶
These serializers are available in default RDFLib, you can use them by
passing the name to a graph’s serialize()
method:
print graph.serialize(format='n3')
It is also possible to pass a mime-type for the format
parameter:
graph.serialize(my_url, format='application/rdf+xml')
Name |
Class |
---|---|
json-ld |
|
n3 |
|
nquads |
|
nt |
|
hext |
|
pretty-xml |
|
trig |
|
trix |
|
turtle |
|
longturtle |
|
xml |
JSON-LD¶
JSON-LD - ‘json-ld’ - has been incorprated in rdflib since v6.0.0.
HexTuples¶
The HexTuples Serializer - ‘hext’ - uses the HexTuples format defined at https://github.com/ontola/hextuples.
For serialization of non-context-aware data sources, e.g. a single Graph
, the ‘graph’ field (6th variable in the
Hextuple) will be an empty string.
For context-aware (multi-graph) serialization, the ‘graph’ field of the default graph will be an empty string and the values for other graphs will be Blank Node IDs or IRIs.