'\" t
.\" Title: tinysparql-sql
.\" Author: The TinySPARQL developers
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 02/08/2025
.\" Manual: TinySPARQL manual
.\" Source: \ \& 3.8.2
.\" Language: English
.\"
.TH "TINYSPARQL\-SQL" "1" "02/08/2025" "\ \& 3\&.8\&.2" "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-sql \- Use SQL to query the TinySPARQL databases\&.
.SH "SYNOPSIS"
.sp
.nf
tinysparql sql \-q | \-f
.fi
.SH "DESCRIPTION"
.sp
This command allows probing of the current database\&. When using commands like \fBtinysparql sparql\fR, the SPARQL used is translated into SQL before being run on the database\&. This allows direct use of the database using SQL avoiding the SPARQL engine entirely\&.
.sp
The caller can run a query two ways, either by providing a \fIfile\fR with the query or by providing a string with the \fIsql\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\-f, \-\-file=<\fR\fB\fIfile\fR\fR\fB>\fR
.RS 4
Use a
\fIfile\fR
with SPARQL content to query\&. Don\(cqt forget to end all queries with a semicolon (;) and also to use quotes around table names\&. The quotes are important because most tables are named after ontology classes like "nfo:Document" and queries will fail without the quotes\&.
.RE
.PP
\fB\-q, \-\-query=<\fR\fB\fIsql\fR\fR\fB>\fR
.RS 4
Use a
\fIsql\fR
string to query the database with\&.
.RE
.SH "EXAMPLES"
.PP
Show first 10 "nfo:Document" entries where the TOC is not NULL
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
$ tinysparql sql \-q \*(AqSELECT * FROM "nfo:Document" WHERE "nfo:tableOfContents" NOT NULL LIMIT 10;\*(Aq
.fi
.if n \{\
.RE
.\}
.RE
.SH "SEE ALSO"
.sp
\fBtinysparql\-sparql\fR(1), \fBtinysparql\-info\fR(1)\&.
.sp
\fBhttp://en\&.wikipedia\&.org/wiki/SQL\fR