tinysparql-query − Query to SPARQL endpoints.
tinysparql query
[(−d |−−database) <file> | (−b
| −−dbus−service) <busname> |
(−r | −−remote−service) <url>]
(−f | −−file) <file>] [(−u |
−−update)] [−a
<parameter>:<value>]... [SPARQL]
This command allows running queries or updates on a SPARQL endpoint.
When the caller runs a query, the query is in the SPARQL language. This can be done two ways. Either by providing a file with the query or by providing a string with the sparql query.
The file argument can be either a local path or a URI. It also does not have to be an absolute path.
−b, −−dbus−service=<service_name>
Connects to a SPARQL endpoint at a D−Bus name.
−d, −−database−path=<database_path>
Connects to a database by location in the filesystem.
−r, −−remote−service=<url>
Connects to a HTTP SPARQL endpoint.
−f, −−file=<file>
Use a file with SPARQL content to query or update.
−u, −−update
This has to be used with −−query. This tells "tinysparql query" to use the SPARQL update extensions so it knows it isn’t a regular data lookup request. So if your query is intended to change data in the database, this option is needed.
−a, −−arg=<parameter>:<value>
Provides an argument for a parameter declared in the SPARQL query string. This may be used with −−file, −−query or −−update. Multiple arguments may be provided for multiple parameters. Argument values are provided as a colon separated string containing 3 values: name, type and value. The name is the same as used in the query string, the value is the desired value, and the type is a single−character string defining the type:
• i: The value will describe an integer
• d: The value will describe a floating point number
• b: The value will describe a boolean
• s: The value will describe a plain string
Querying a D−Bus endpoint
$ tinysparql query −−dbus−service org.example.Endpoint "SELECT ('Hello World' AS ?str) {}"
Updating a database directly from a query in a file
$ tinysparql query −−database /tmp/db/ −−update −−file ./update.rq
Using −−arg to provide a arguments to query parameters
$ tinysparql
query −b org.example.Endpoint \
−a name:s:"John" −a age:i:42 −a
available:b:true \
"SELECT (˜name AS ?name) (˜age AS ?age)
(˜available AS ?avail) { }"
tinysparql−endpoint(1).
https://gnome.pages.gitlab.gnome.org/tinysparql/tutorial.html.