A command-line tool to serialize RDF from a SPARQL endpoint to JSON-LD documents. You give it a SPARQL
SELECT query to select resources you want, a SPARQL
DESCRIBE query to construct a description of each resource, and a JSON-LD frame to shape the RDF graph into a predictable JSON tree.
Compile using Leiningen:
Alternatively, compile using lein-binplus to produce an executable file:
Run from the command-line:
java -jar sparql_to_jsonld.jar --help
Or, when compiled with lein-binplus:
The tool reads CSV from standard input and produces JSON-LD serialized as Newline Delimited JSON. The CSV is interpreted as bindings for the template provided via the
You will need to provide the tool with several parameters.
--context(optional): IRI to be used as the value of
@contextin the output.
--describe: A Mustache template for CONSTRUCT or DESCRIBE SPARQL query to describe a resource to download.
--endpoint: URL of the SPARQL endpoint to query.
--frame: A JSON-LD frame to apply to the resource's description. See this example.
--help(optional): Show how to use the tool.
--remove-jsonld-context(optional): Remove the JSON-LD context from the provided JSON-LD frame from the output. By default, the JSON-LD context is preserved.
--retries(optional, default = 5): Maximum number of attempts at retrying failed queries.
--sleep(optional, default = 0): Time in seconds to wait in between requests to the SPARQL endpoint.
--verbose(optional): Switch on logging to the standard error.
- If the describe query outputs an empty RDF, it is silently skipped.
Copyright © 2016-2018 Jindřich Mynarz
Distributed under the Eclipse Public License version 1.0.