wiki:Virtuoso
Last modified 7 years ago Last modified on 12/20/10 01:23:02 PM

Virtuoso

Get SPARQL Update working

The SPARQL user needs a special sparql_update permission.

How to insert static RDF Files

curl -T static.rdf http://localhost:8890/DAV/home/<username>/rdf_sink/static.rdf -u <username>:<password>

Why aren't all the results returned in my sparql query?

The default for SPARQL/ResultSetMaxRows is 10.000. This can be changed in the configuration.

Are there more limitations?

In file_to_string() the file size is limited to 16 MB.

Common SPARQL Queries

Namespaces

PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc:   <http://purl.org/dc/elements/1.1/>
PREFIX owl:  <http://www.w3.org/2002/07/owl#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

Graphs

Show all Graphs:

SELECT  DISTINCT ?g
WHERE {
   GRAPH  ?g {
    ?s ?p ?o .
  }
}
ORDER BY DESC(?g)

Delete Graph:

CLEAR GRAPH <http://example.com/myGraph#>

counting

Most common 10 items (taken from different urls):

PREFIX xy: <http://example.com/xy/>
PREFIX dc:   <http://purl.org/dc/elements/1.1/>

SELECT COUNT(?url), ?s
WHERE {
    ?sub xy:item ?s .
    ?sub dc:source ?url .
}
ORDER BY DESC(COUNT(?url))
LIMIT 10

Ranking

You need the Virtuoso Faceted Browser VAD package.

To calculate the rank execute the following SQL command (use webconsole or isql):

s_rank()

Example Query:

SELECT ?iri( <LONG::IRI_RANK> (?iri) ) AS ?Rank
WHERE 
  {
    ?iri ?x ?y
  }
ORDER BY DESC ( <LONG::IRI_RANK> (?iri) )
LIMIT 10

More Information: