d2r-query
: Running SPARQL queries against a databaseThe d2r-query
tool allows executing SPARQL queries against
a D2RQ-mapped relational database from the command line.
This can be done with or without a
D2RQ mapping file. If a mapping file is specified, then the tool will query
the virtual RDF graph defined by the mapping. If no mapping file is specified,
then the tool will use the default mapping of
generate-mapping
for the translation.
To query a D2RQ-mapped database using a web-based interface, use D2R Server.
d2r-query [-f format] [-b baseURI] [-t timeout] [--verbose] [--debug] mapping-file.ttl query
The filename of a D2RQ mapping file that contains a database mapping.
If no mapping file is provided, then the database connection must be
specified on the command line using the same connection
parameters as for the generate-mapping
tool,
and a default mapping will be used.
query
@filename
.-f format
text
(the default), xml
, json
, csv
,
tsv
, srb
, and ttl
.-b baseURI
-t timeout
--verbose
--debug
d2r-query mapping-iswc.ttl "SELECT * { ?s ?p ?o } LIMIT 10"
d2r-query -f csv mapping-iswc.ttl "SELECT * { ?paper dc:title ?title }" > papers.csv
d2r-query -u root jdbc:mysql:///iswc "SELECT * { ?s ?p ?o } LIMIT 10"
dump-rdf -l db_dump.sql -o output.nt "SELECT * { ?s ?p ?o } LIMIT 10"
dump-rdf mapping.ttl @my-query.sparql