Skip to content

Useful sparql queries

Nolan Nichols edited this page Jan 22, 2014 · 4 revisions

Virtuoso servers

  1. http://computor.mit.edu:8890/sparql

Example Queries

  1. Return named graphs in a virtuoso server
SELECT DISTINCT ?namedgraph ?label
WHERE {
  GRAPH ?namedgraph { ?s ?p ?o }
  OPTIONAL { ?namedgraph rdfs:label ?label }
}
ORDER BY ?namedgraph
  1. Browse distinct properties
SELECT DISTINCT ?property
WHERE { [] ?property [] }
ORDER BY ?property

Note: brackets denote a syntax for blank nodes

  1. Browse distinct classes
SELECT DISTINCT ?class
WHERE { [] a ?class }
ORDER BY ?class