If for some reason you want to run queries directly on virtuoso, you'll need to connect to virtuoso via <tt>isql-vt</tt> and then type in the query. From 4.10, we use virtuoso's inbuilt prefix expansion, so you don't need to care about the prefixes.

+

+

=== Example === <!--T:6-->

+

+

<!--T:7-->

+

<syntaxhighlight lang="sql">

+

SQL> sparql select ?r ?name where { ?r nco:fullname ?name . };

+

</syntaxhighlight>

+

+

== List of tables == <!--T:8-->

+

+

<!--T:9-->

+

Virtuoso internally uses a relational database to store the triples. It contains the following tables -

+

+

<!--T:10-->

+

* DB.DBA.RDF_QUAD -- The main table which contains all the statements. It contains four rows "S", "P", "O" and "G" for the subject, predicate, object and graph.

+

* DB.DBA.RDF_IRI

+

* DB.DBA.RDF_DATATYPE - Contains all the literal data types which are stored.

Virtuoso has 2 main types - IRI_ID, which is the data type of the graph, subject and predicate. IRI_ID are of the form "#i25". In order to convert an integer to an IRI_ID, use the '''iri_id_from_num( int )''' function, and the '''iri_id_num( iri_id )''' to convert an IRI_ID to an integer. In order to convert an IRI_ID to its string representation use the following functions '''id_to_iri( iri_id, int )''', and '''iri_to_id( string, int )'''. The second integer option should be 0, unless you want the iri/id to be created if it doesn't exist.

+

+

== Default Indexes == <!--T:13-->

+

+

== Common Commands == <!--T:14-->

+

+

<!--T:15-->

+

Apart from directly running SQL and SPARQL queries, virtuoso also provides some additional commands, which are listed over here.

+

+

=== status === <!--T:16-->

+

The [http://docs.openlinksw.com/virtuoso/fn_status.html status()] function can be used to return the current running queries on virtuoso.

+

+

+

=== sparql_to_sql_text === <!--T:17-->

+

+

<!--T:18-->

+

The [http://docs.openlinksw.com/virtuoso/fn_sparql_to_sql_text.html sparql_to_sql_text()] function can be used to convert a SPARQL query directly to the SQL it would be executed as.

Running queries directly

If for some reason you want to run queries directly on virtuoso, you'll need to connect to virtuoso via isql-vt and then type in the query. From 4.10, we use virtuoso's inbuilt prefix expansion, so you don't need to care about the prefixes.

Example

SQL>sparqlselect?r?namewhere{?rnco:fullname?name.};

List of tables

Virtuoso internally uses a relational database to store the triples. It contains the following tables -

DB.DBA.RDF_QUAD -- The main table which contains all the statements. It contains four rows "S", "P", "O" and "G" for the subject, predicate, object and graph.

DB.DBA.RDF_IRI

DB.DBA.RDF_DATATYPE - Contains all the literal data types which are stored.

Virtuoso has 2 main types - IRI_ID, which is the data type of the graph, subject and predicate. IRI_ID are of the form "#i25". In order to convert an integer to an IRI_ID, use the iri_id_from_num( int ) function, and the iri_id_num( iri_id ) to convert an IRI_ID to an integer. In order to convert an IRI_ID to its string representation use the following functions id_to_iri( iri_id, int ), and iri_to_id( string, int ). The second integer option should be 0, unless you want the iri/id to be created if it doesn't exist.

Default Indexes

Common Commands

Apart from directly running SQL and SPARQL queries, virtuoso also provides some additional commands, which are listed over here.

status

The status() function can be used to return the current running queries on virtuoso.

sparql_to_sql_text

The sparql_to_sql_text() function can be used to convert a SPARQL query directly to the SQL it would be executed as.