Skip to content

# `` results

Parsers and serializers for SPARQL Result formats

All builtin SPARQL result serializers available after a query are listed here. The serializer can be chosen during serialization of a result.

    import rdflib

    result : rdflib.query.Result
    g = rdflib.Graph().parse(format="ttl", data="""
        @base <http://example.org/> .
        <MyObject> a <MyClass>.
    """)
    result = g.query("SELECT ?x ?cls WHERE {?x a ?cls}")
    print(result.serialize(format="txt").decode("utf8"))

Registration of builtin and external plugins is described in `rdflib.plugin`.

Modules:

- `csvresults` –

  This module implements a parser and serializer for the CSV SPARQL result

- `graph` –
- `jsonresults` –

  A Serializer for SPARQL results in JSON:

- `rdfresults` –
- `tsvresults` –

  This implements the Tab Separated SPARQL Result Format

- `txtresults` –
- `xmlresults` –

  A Parser for SPARQL results in XML: