SPARQL Anything

Query any file with SPARQL

SPARQL Anything reads CSV, JSON, XML, spreadsheets, HTML, Markdown and other formats as RDF. You query them, and build knowledge graphs from them, with plain SPARQL 1.1. There is no mapping language to learn and no conversion step.

Version 1.3.0, released October 2026. Java 21 or later. Apache License 2.0.

people.csv
id,name,city
1,Ada,London
2,Grace,New York
Façade-X view (RDF)
[ rdf:type  fx:Root ;
  rdf:_1    [ xyz:id    "1" ;
              xyz:name  "Ada" ;
              xyz:city  "London" ] ;
  rdf:_2    [ xyz:id    "2" ;
              xyz:name  "Grace" ;
              xyz:city  "New York" ]
] .
CONSTRUCT { ?s ?p ?o } WHERE {
  SERVICE <x-sparql-anything:location=people.csv,csv.headers=true> { ?s ?p ?o }
}
people.json
{
  "people": [
    { "name": "Ada", "born": 1815,
      "languages": ["English", "French"] },
    { "name": "Grace", "born": 1906,
      "languages": ["English"] }
  ]
}
Façade-X view (RDF)
[ rdf:type    fx:Root ;
  xyz:people  [
    rdf:_1  [ xyz:name       "Ada" ;
              xyz:born       "1815"^^xsd:decimal ;
              xyz:languages  [ rdf:_1 "English" ;
                               rdf:_2 "French" ] ] ;
    rdf:_2  [ xyz:name       "Grace" ;
              xyz:born       "1906"^^xsd:decimal ;
              xyz:languages  [ rdf:_1 "English" ] ]
  ]
] .
CONSTRUCT { ?s ?p ?o } WHERE {
  SERVICE <x-sparql-anything:location=people.json> { ?s ?p ?o }
}
people.xml
<people xml:lang="en">
  <person id="1">Ada</person>
  <person id="2">Grace</person>
</people>
Façade-X view (RDF)
[ rdf:type  fx:Root , xyz:people ;
  xml:lang  "en" ;
  rdf:_1    [ rdf:type  xyz:person ;
              xyz:id    "1"@en ;
              rdf:_1    "Ada"@en ] ;
  rdf:_2    [ rdf:type  xyz:person ;
              xyz:id    "2"@en ;
              rdf:_1    "Grace"@en ]
] .
CONSTRUCT { ?s ?p ?o } WHERE {
  SERVICE <x-sparql-anything:location=people.xml> { ?s ?p ?o }
}
The same query over three formats, with the output of v1.3.0. JSON numbers keep their lexical form with an XSD type, and XML values carry their xml:lang tag. Each file becomes a Façade-X graph of containers, slots and values, which you then reshape with SPARQL.

Get started

You need Java 21 or later. This turns a CSV file into schema.org triples.

  1. Download the command-line tool

    curl -L -O https://github.com/SPARQL-Anything/sparql.anything/releases/download/v1.3.0/sparql-anything-v1.3.0.jar

    Or pick a jar from the release page. The -geosparql variants add GeoSPARQL support.

  2. Write a query

    Save this as query.rq, next to the people.csv file from the example above. Options go on fxe:properties, or in the SERVICE IRI as in the example at the top of the page.

    PREFIX fxe:    <http://sparql.xyz/facade-x/engine/>
    PREFIX xyz:    <http://sparql.xyz/facade-x/data/>
    PREFIX schema: <https://schema.org/>
    
    CONSTRUCT {
      ?person a schema:Person ;
        schema:name ?name ;
        schema:homeLocation ?city .
    } WHERE {
      SERVICE <x-sparql-anything:> {
        fxe:properties fxe:location "people.csv" ; fxe:csv.headers true .
        ?row xyz:id ?id ; xyz:name ?name ; xyz:city ?city .
      }
      BIND (IRI(CONCAT("http://example.org/person/", ?id)) AS ?person)
    }
  3. Run it

    java -jar sparql-anything-v1.3.0.jar -q query.rq
    <http://example.org/person/1>
            a                    schema:Person ;
            schema:homeLocation  "London" ;
            schema:name          "Ada" .
    
    <http://example.org/person/2>
            a                    schema:Person ;
            schema:homeLocation  "New York" ;
            schema:name          "Grace" .

    Use -f to pick another output format, such as nt or jsonld, and -o to write to a file. See the command-line reference.

From Python

pip install pysparql-anything
import pysparql_anything as sa
engine = sa.SparqlAnything()
engine.run(query="query.rq", format="ttl")

The jar is downloaded on first use. See PySPARQL Anything.

As a SPARQL endpoint

java -jar sparql-anything-server-v1.3.0.jar

Starts a Fuseki server at http://localhost:3000/sparql. Any SPARQL client can send it queries that use SERVICE <x-sparql-anything:…>.

From Java

Use the engine as a library inside Apache Jena. See the Java client example and the documentation.

How Façade-X works

Façade-X is the model SPARQL Anything uses to present every format in the same shape. It uses a small subset of RDF and no domain vocabulary, so the source content appears as it is. Your query then maps it to the ontology you need.

Containers
Each structure in the source becomes a container, a blank node: a table and its rows, a JSON object or array, an XML element. The outermost one is typed fx:Root.
Slots
Containers hold slots. Named parts, such as column headers, object keys and attributes, become properties in the xyz: namespace. Ordered parts, such as rows, array items and child nodes, become rdf:_1, rdf:_2 and so on.
Values
The content at the leaves becomes RDF literals, keeping the text as it appears in the source. Where the format says what a value is, it gets a datatype or a language tag: a JSON number becomes "1815"^^xsd:decimal, XML text under xml:lang="en" becomes "Ada"@en.
Types
Where the source gives a structure a name, such as an XML element or an HTML tag, the container gets that name as an rdf:type.
PREFIX fx:  <http://sparql.xyz/facade-x/ns/>
PREFIX xyz: <http://sparql.xyz/facade-x/data/>
PREFIX fxe: <http://sparql.xyz/facade-x/engine/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

The Façade-X primer walks through the model with examples. The metamodel specification defines it formally, and the format mappings say how each format is represented.

Features

Querying

  • Plain SPARQL 1.1. Point a SERVICE <x-sparql-anything:…> clause at a resource and set options in the IRI or with fxe:properties.
  • Build knowledge graphs with CONSTRUCT, or get tables with SELECT. Output RDF, RDF-star or tabular results.
  • Output follows the Façade-X specification 0.1, including datatypes for JSON numbers and language tags from xml:lang.
  • Join data from several sources in one query by combining SERVICE clauses.
  • A function library for container slots, strings, hashes and building entity IRIs.
  • Query templates: run a query once for each row of a SPARQL result set file, or for values given on the command line.

Reaching data

Large files

  • Slicing evaluates the query on one row, array item or element at a time, for CSV, JSON and XML.
  • An on-disk mode keeps the Façade-X graph in Apache Jena TDB2 instead of memory.
  • The command line can stream CONSTRUCT output triple by triple.

Running it

  • Command-line tool and a Fuseki-based SPARQL server.
  • Java library, built on Apache Jena ARQ.
  • Python library with results as RDFLib graphs, pandas data frames or NetworkX graphs.

Supported formats

Image metadata (EXIF) is also supported. You can add formats through the extension mechanism.

Tutorials and showcases

Worked examples on real data. The full reference is in the documentation, with more examples on the tutorials page.

Façade-X as a W3C specification

The W3C Data Façades Community Group is writing Façade-X up as an open specification, so that other engines can implement the same model and give the same answers. SPARQL Anything is the reference implementation.

Release 0.1 of the specification was published on 6 October 2026. Anyone can join the group, comment on the drafts or contribute test cases.

Documents

Group work

From version 1.3.0, SPARQL Anything follows release 0.1. The root container is typed fx:Root: queries that match fx:root need updating. Engine options use the Engine vocabulary (fxe:properties fxe:location …); the fx: option forms still work but are deprecated.

Publications

If you use SPARQL Anything in your work, please cite the ACM TOIT article. Cite the TGDK article for the formal account of Façade-X data access.

Reference publications

  1. Knowledge graph construction with a façade: a unified method to access heterogeneous data sources on the web

    Luigi Asprino, Enrico Daga, Aldo Gangemi, Paul Mulholland. ACM Transactions on Internet Technology 23(1), 1–31, 2023. DOI

    BibTeX
    @article{asprino2023knowledge,
      title={Knowledge graph construction with a fa{\c{c}}ade: a unified method to access heterogeneous data sources on the web},
      author={Asprino, Luigi and Daga, Enrico and Gangemi, Aldo and Mulholland, Paul},
      journal={ACM Transactions on Internet Technology},
      volume={23},
      number={1},
      pages={1--31},
      year={2023},
      publisher={ACM New York, NY},
      doi={10.1145/3555312}
    }
  2. Towards a Theory of Façade-X Data Access: Satisfiability of SPARQL Basic Graph Patterns

    Luigi Asprino, Enrico Daga. Transactions on Graph Data and Knowledge 4(2), 5:1–5:46, 2026. DOI, Code

    BibTeX
    @article{asprino2026tgdk,
      author={Asprino, Luigi and Daga, Enrico},
      title={{Towards a Theory of Fa{\c{c}}ade-X Data Access: Satisfiability of SPARQL Basic Graph Patterns}},
      journal={Transactions on Graph Data and Knowledge},
      volume={4},
      number={2},
      pages={5:1--5:46},
      year={2026},
      publisher={Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik},
      doi={10.4230/TGDK.4.2.5}
    }
  3. Facade-X: an opinionated approach to SPARQL Anything

    Enrico Daga, Luigi Asprino, Paul Mulholland, Aldo Gangemi. Studies on the Semantic Web 53, 58–73, IOS Press, 2021. arXiv

    BibTeX
    @article{daga2021facade,
      title={Facade-X: an opinionated approach to SPARQL Anything},
      author={Daga, Enrico and Asprino, Luigi and Mulholland, Paul and Gangemi, Aldo},
      journal={Studies on the Semantic Web},
      volume={53},
      pages={58--73},
      year={2021},
      publisher={IOS Press}
    }

Other publications

  1. PySPARQL Anything Showcase

    Marco Ratta, Enrico Daga, Luigi Asprino. ESWC 2024 Posters and Demos, 2024. PDF

    BibTeX
    @inproceedings{ratta2024demo,
      title={PySPARQL Anything Showcase},
      author={Ratta, Marco and Daga, Enrico and Asprino, Luigi},
      booktitle={ESWC 2024 Posters and Demos},
      year={2024}
    }
  2. Streamlining Knowledge Graph Construction with a façade: The SPARQL Anything project

    Luigi Asprino, Enrico Daga, Justin Dowdy, Paul Mulholland, Aldo Gangemi, Marco Ratta. ENDORSE: The European Data Conference on Reference Data and Semantics, 2023. arXiv (technical architecture report)

    BibTeX
    @inproceedings{asprino2023streamlining,
      title={Streamlining Knowledge Graph Construction with a fa{\c{c}}ade: The SPARQL Anything project},
      author={Asprino, Luigi and Daga, Enrico and Dowdy, Justin and Mulholland, Paul and Gangemi, Aldo and Ratta, Marco},
      booktitle={ENDORSE: The European Data Conference on Reference Data and Semantics},
      year={2023},
      publisher={Publications Office of the European Union}
    }
  3. Knowledge Graph Construction from MusicXML: an empirical investigation with SPARQL Anything

    Marco Ratta, Enrico Daga. Musical Heritage Knowledge Graphs Workshop (MHKG) at ISWC 2022, 2022. DOI

    BibTeX
    @inproceedings{ratta2022knowledge,
      title={Knowledge Graph Construction from MusicXML: an empirical investigation with SPARQL Anything},
      author={Ratta, Marco and Daga, Enrico},
      booktitle={Musical Heritage Knowledge Graphs Workshop (MHKG) at ISWC 2022},
      year={2022},
      doi={10.5281/zenodo.7261671}
    }