Laura Morales kirjoitti 01.11.2017 klo 08:59:
For querying I use the Jena query engine. I have created a module called 
HDTQuery located http://download.systemsbiology.nl/sapp/ which is a simple 
program and under development that should be able to use the full power of 
SPARQL and be more advanced than grep… ;)

Does this tool allow to query HDT files from command-line, with SPARQL, and 
without the need to setup a Fuseki endpoint?

There is also a command line tool called hdtsparql in the hdt-java distribution that allows exactly this. It used to support only SELECT queries, but I've enhanced it to support CONSTRUCT, DESCRIBE and ASK queries too. There are some limitations, for example only CSV output is supported for SELECT and N-Triples for CONSTRUCT and DESCRIBE. But it works fine, at least for my use cases, and is often more convenient than firing up Fuseki-HDT. It requires both the hdt file and the corresponding index file.

Code here:
https://github.com/rdfhdt/hdt-java/blob/master/hdt-jena/src/main/java/org/rdfhdt/hdtjena/cmd/HDTSparql.java

The tool is in the hdt-jena package (not hdt-java-cli where the other command line tools reside), since it uses parts of Jena (e.g. ARQ). There is a wrapper script called hdtsparql.sh for executing it with the proper Java environment.

Typical usage (example from hdt-java README):

# Execute SPARQL Query against the file.
$ ./hdtsparql.sh ../hdt-java/data/test.hdt "SELECT ?s ?p ?o WHERE { ?s ?p ?o . }"

-Osma


--
Osma Suominen
D.Sc. (Tech), Information Systems Specialist
National Library of Finland
P.O. Box 26 (Kaikukatu 4)
00014 HELSINGIN YLIOPISTO
Tel. +358 50 3199529
osma.suomi...@helsinki.fi
http://www.nationallibrary.fi

_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata

Reply via email to