Contents |
Virtuoso ships with an executable called isql-vt. Just running that executable should connect you to virtuoso.
If you distribution does not provide the corresponding executable or if it doesn't work for you. Try this script -
#!/bin/bash filename=`ps aux | grep virtuoso-t | grep -v grep | sed -e 's/.*\/tmp\///;s/ini.*/ini/'` port=$(grep ServerPort /tmp/$filename | sed -e 's/.*=//') exec isql-vt -S $port
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. Make sure the query has the required prefixes and starts with the keyword sparql if it is a sparql query.
I've attached a list of common prefixes for convenience -
prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> prefix nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> prefix ncal: <http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#> prefix nco: <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix pimo: <http://www.semanticdesktop.org/ontologies/2007/11/01/pimo#> prefix nmo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#> prefix nmm: <http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#> prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix xsd: <http://www.w3.org/2001/XMLSchema#>
$ sparql prefix nco: <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#> select ?r ?name where { ?r nco:fullname ?name . };is a relational database and what not
All the tables in Virtuoso start with the DB.DBA. prefix.
Apart from directly running SQL and SPARQL queries, virtuoso also provides some additional commands, which are listed over here.
The sparql_to_sql_text() function can be used to convert a SPARQL query directly to the SQL it would be executed as.
VARCHAR sparql_to_sql_text ( IN squery VARCHAR );
Example -
It's very useful in debugging why many sparql queries are taking so long.