'\" t .\" Title: tracker3-sparql .\" Author: The Tracker developers .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 05/02/2024 .\" Manual: Tracker manual .\" Source: \ \& 3.7.3 .\" Language: English .\" .TH "TRACKER3\-SPARQL" "1" "05/02/2024" "\ \& 3\&.7\&.3" "Tracker 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" tracker3-sparql \- Use SparQL to query the Tracker databases\&. .SH "SYNOPSIS" .sp .nf tracker3 sparql [(\-d |\-\-database) | (\-b | \-\-dbus\-service) | (\-r | \-\-remote\-service) ] [(\-q | \-\-query) | (\-f | \-\-file) ] [(\-u | \-\-update)] [\-a :]\&.\&.\&. tracker3 sparql [(\-d |\-\-database) | (\-b | \-\-dbus\-service) | (\-r | \-\-remote\-service) ] [(\-t | \-\-tree)] [(\-t | \-\-tree) ] [(\-p | \-\-list\-properties)] [(\-s | \-\-search) ] tracker3 sparql [(\-d |\-\-database) | (\-b | \-\-dbus\-service) | (\-r | \-\-remote\-service) ] [(\-c | \-\-list\-classes)] tracker3 sparql [(\-d |\-\-database) | (\-b | \-\-dbus\-service) | (\-r | \-\-remote\-service) ] [(\-p | \-\-list\-properties)] tracker3 sparql [(\-d |\-\-database) | (\-b | \-\-dbus\-service) | (\-r | \-\-remote\-service) ] [(\-i | \-\-list\-indexes)] tracker3 sparql [(\-d |\-\-database) | (\-b | \-\-dbus\-service) | (\-r | \-\-remote\-service) ] [(\-n | \-\-list\-notifies)] tracker3 sparql [(\-d |\-\-database) | (\-b | \-\-dbus\-service) | (\-r | \-\-remote\-service) ] [(\-g | \-\-list\-graphs)] tracker3 sparql [(\-d |\-\-database) | (\-b | \-\-dbus\-service) | (\-r | \-\-remote\-service) ] [\-\-get\-longhand ] [\-\-get\-shorthand ] .fi .SH "DESCRIPTION" .sp This command allows probing of the current database schema (also known as ontology) and running low level queries or updates on the data set\&. In terms of the database ontology, it\(cqs easy to find out what properties are indexed for speed, or notified on changes, what classes are available and the properties belonging to those classes\&. There are also visual tools to display an ascii tree layout of the classes and their relationships to each other\&. .sp When the caller runs a query, the query is in RDF and SPARQL\&. 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\-q, \-\-query=<\fR\fB\fIsparql\fR\fR\fB>\fR .RS 4 Use a \fIsparql\fR string to query the database with\&. .RE .PP \fB\-u, \-\-update\fR .RS 4 This has to be used with \fB\-\-query\fR\&. This tells "tracker3 sparql" 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 .PP \fB\-c, \-\-list\-classes\fR .RS 4 Returns a list of classes which describe the ontology used for storing data\&. These classes are also used in queries\&. For example, \fIhttp://www\&.w3\&.org/2000/01/rdf\-schema#Resource\fR is one of many classes which should be returned here\&. .RE .PP \fB\-x, \-\-list\-class\-prefixes\fR .RS 4 Returns a list of prefixes in shortened and long form\&. All RDF classes and properties have such a prefix that may be expressed in either form\&. .RE .PP \fB\-p, \-\-list\-properties=[\fR\fB\fIclass\fR\fR\fB]\fR .RS 4 Returns a list of properties which pertain to a \fIclass\fR\&. You can use both formats here for the \fIclass\fR, either the full name \fIhttp://tracker\&.api\&.gnome\&.org/ontology/v3/nfo#Video\fR or the shortened prefix name \fInfo:Video\fR\&. See also \fB\-\-tree\fR and \fB\-\-query\fR\&. .RE .PP \fB\-n, \-\-list\-notifies=[\fR\fB\fIclass\fR\fR\fB]\fR .RS 4 Returns a list of classes which are notified over D\-Bus about any changes that occur in the database\&. The \fIclass\fR does not have to be supplied here\&. This is optional and filters the results according to any argument supplied\&. With no \fIclass\fR, all classes are listed\&. .RE .PP \fB\-i, \-\-list\-indexes=[\fR\fB\fIproperty\fR\fR\fB]\fR .RS 4 Returns a list of properties which are indexed in the database\&. Indexes improves query speed but also add an indexing penalty\&. The \fIproperty\fR does not have to be supplied here\&. This is optional and filters the results according to any argument supplied\&. With no \fIproperty\fR, all properties are listed\&. .RE .PP \fB\-g, \-\-list\-graphs\fR .RS 4 List all the named graphs in the database\&. These are used by the filesystem miner to separate metadata so that apps can only see the information relevant to them\&. .RE .PP \fB\-t, \-\-tree=[\fR\fB\fIclass\fR\fR\fB]\fR .RS 4 Prints a tree showing all parent classes of \fIclass\fR in the ontology\&. The \fIclass\fR can be provided in shorthand or longhand (see \fB\-\-get\-shorthand\fR and \fB\-\-get\-longhand\fR for details)\&. .RE .sp If no \fIclass\fR is given, the entire tree is shown\&. .sp The \fB\-\-search\fR command line option can be used to highlight parts of the tree you\(cqre looking for\&. The search is case insensitive\&. .sp The \fB\-\-properties\fR command line option can be used to show properties for each class displayed .PP \fB\-s, \-\-search=<\fR\fB\fIneedle\fR\fR\fB>\fR .RS 4 Returns a list of classes and properties which partially match \fIneedle\fR in the ontology\&. Search is case insensitive\&. See also \fB\-\-tree\fR\&. .RE .PP \fB\-\-get\-shorthand=<\fR\fB\fIclass\fR\fR\fB>\fR .RS 4 Returns the shorthand for a class given by a URL\&. .RE .PP \fB\-\-get\-longhand=<\fR\fB\fIclass\fR\fR\fB>\fR .RS 4 Returns the longhand for a class given in the form of CLASS:PROPERTY\&. .RE .SH "EXAMPLES" .PP Querying a D\-Bus endpoint .RS 4 .sp .if n \{\ .RS 4 .\} .nf $ tracker3 sparql \-\-dbus\-service org\&.example\&.Endpoint \-q "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 $ tracker3 sparql \-\-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 $ tracker3 sparql \-b org\&.example\&.Endpoint \e \-q "SELECT (~name AS ?name) (~age AS ?age) (~available AS ?avail) { }" \e \-a name:s:"John" \-a age:i:42 \-a available:b:true .fi .if n \{\ .RE .\} .RE .PP Introspecting details of a D\-Bus endpoint .RS 4 .sp .if n \{\ .RS 4 .\} .nf $ tracker3 sparql \-b org\&.example\&.Endpoint \-tree \-\-list\-properties .fi .if n \{\ .RE .\} .RE .SH "SEE ALSO" .sp \fBtracker3\-endpoint\fR(1)\&. .sp https://gnome\&.pages\&.gitlab\&.gnome\&.org/tracker/tutorial\&.html\&.