This is a collection of experiments with SPARQL. Herein you can find examples of:
- Data validation of an input source against vocabulary data.
- Data expansion, using RDFS/OWL rules implemented with SPARQL CONSTRUCT (instead of reasoner algorithms).
- Data curation, combining vocabulary data with common patterns and idioms.
Most of these queries are designed to run against a dataset containing:
- the default graph, providing background knowledge (mostly vocabulary data);
- one named graph, representing the focal data to work with.
A bunch of scripts in the tools
directory can be used to run these queries
locally, against either local or remote data sources.
-
The
construct.py
Python script requires a recent version of RDFLib, plus the currently external package for RDFLib SPARQL 1.1 support. Usage:$ tools/construct.py QUERY_FILE DEFAULT_SOURCE NAMED_SOURCE
-
The
construct.groovy
script requires Groovy (it will download dependencies on e.g. Sesame automatically using the Grab feature). Usage:$ groovy tools/construct.groovy QUERY_FILE DEFAULT_SOURCE NAMED_SOURCE
-
Of course, you can also use e.g. Jena ARQ to run queries directly. Usage:
$ arq --query QUERY_FILE --graph DEFAULT_SOURCE --namedGraph NAMED_SOURCE
-
In principle, roqet, part of Redland's Rasqal library is also an excellent SPARQL tool. But I cannot currently guarantee that it works properly with these queries.