'\" t
.\" Title: tinysparql-query
.\" Author: The TinySPARQL developers
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 04/15/2026
.\" Manual: TinySPARQL manual
.\" Source: \ \& 3.11.1
.\" Language: English
.\"
.TH "TINYSPARQL\-QUERY" "1" "04/15/2026" "\ \& 3\&.11\&.1" "TinySPARQL manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
tinysparql-query \- Query to SPARQL endpoints\&.
.SH "SYNOPSIS"
.sp
.nf
tinysparql query [(\-d |\-\-database) | (\-b | \-\-dbus\-service) | (\-r | \-\-remote\-service) ]
(\-f | \-\-file) ] [(\-u | \-\-update)] [\-a :]\&.\&.\&. [SPARQL]
.fi
.SH "DESCRIPTION"
.sp
This command allows running queries or updates on a SPARQL endpoint\&.
.sp
When the caller runs a query, the query is in the SPARQL language\&. This can be done two ways\&. Either by providing a \fIfile\fR with the query or by providing a string with the \fIsparql\fR query\&.
.sp
The \fIfile\fR argument can be either a local path or a URI\&. It also does not have to be an absolute path\&.
.SH "OPTIONS"
.PP
\fB\-b, \-\-dbus\-service=<\fR\fB\fIservice_name\fR\fR\fB>\fR
.RS 4
Connects to a SPARQL endpoint at a D\-Bus name\&.
.RE
.PP
\fB\-d, \-\-database\-path=<\fR\fB\fIdatabase_path\fR\fR\fB>\fR
.RS 4
Connects to a database by location in the filesystem\&.
.RE
.PP
\fB\-r, \-\-remote\-service=<\fR\fB\fIurl\fR\fR\fB>\fR
.RS 4
Connects to a HTTP SPARQL endpoint\&.
.RE
.PP
\fB\-f, \-\-file=<\fR\fB\fIfile\fR\fR\fB>\fR
.RS 4
Use a
\fIfile\fR
with SPARQL content to query or update\&.
.RE
.PP
\fB\-u, \-\-update\fR
.RS 4
This has to be used with
\fB\-\-query\fR\&. This tells "tinysparql query" to use the SPARQL update extensions so it knows it isn\(cqt a regular data lookup request\&. So if your query is intended to change data in the database, this option is needed\&.
.RE
.PP
\fB\-a, \-\-arg=<\fR\fB\fIparameter\fR\fR\fB>:<\fR\fB\fIvalue\fR\fR\fB>\fR
.RS 4
Provides an argument for a parameter declared in the SPARQL query string\&. This may be used with
\fB\-\-file\fR,
\fB\-\-query\fR
or
\fB\-\-update\fR\&. 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:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBi\fR: The value will describe an integer
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBd\fR: The value will describe a floating point number
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBb\fR: The value will describe a boolean
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBs\fR: The value will describe a plain string
.RE
.RE
.SH "EXAMPLES"
.PP
Querying a D\-Bus endpoint
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
$ tinysparql query \-\-dbus\-service org\&.example\&.Endpoint "SELECT (\*(AqHello World\*(Aq AS ?str) {}"
.fi
.if n \{\
.RE
.\}
.RE
.PP
Updating a database directly from a query in a file
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
$ tinysparql query \-\-database /tmp/db/ \-\-update \-\-file \&./update\&.rq
.fi
.if n \{\
.RE
.\}
.RE
.PP
Using \fB\-\-arg\fR to provide a arguments to query parameters
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
$ tinysparql query \-b org\&.example\&.Endpoint \e
\-a name:s:"John" \-a age:i:42 \-a available:b:true \e
"SELECT (~name AS ?name) (~age AS ?age) (~available AS ?avail) { }"
.fi
.if n \{\
.RE
.\}
.RE
.SH "SEE ALSO"
.sp
\fBtinysparql\-endpoint\fR(1)\&.
.sp
https://gnome\&.pages\&.gitlab\&.gnome\&.org/tinysparql/tutorial\&.html\&.