Tuesday, August 17, 2010

An Online SPARQL Query Form

I must apologize to my reader(s) about hogging all the Sparql fun. Here I've been querying and revising queries and not even given you a bit of help on running your own Sparql queries. Forgive me.

Virtuoso SPARQL Query Form

 The link for the website is http://dbpedia.org/sparql



I like it for querying dbpedia because of it's immediacy. I put in the Sparql query and get out my answer, nothing to install on my machine, sweet and simple SPARQL power over the web.

Default Graph URI

The default graph textbox allows you to tell SPARQL what information source to query when you do not explicitly name a source in your query. The Virtuoso browser prefills the field with http://dbpedia.org meaning query all of dbpedia.

THE QUERY TEXT

The query text box is where you enter your SPARQL query. I generally open a second window pointing to the Virtuoso query, then I can copy the SPARQL queries from this blog or any other SPARQL learning resource, put it in this box, and run it. That way I can not only see the queries in action, but can tweak them and explore a little further on my own.

select distinct ?Concept where { [] a ?Concept }

This says: Show me the distinct Concepts in http://dbpedia.org.

The symbols [] indicates I don't care what the subject is.

The predicate a is shorthand for rdf:type. I translate it as "is a" .

The object is called a ?Concept.


DISPLAY RESULTS AS

The Virtuoso browser provides many different output formats. I use HTML most of the time. If you write a query that outputs only a few columns and a few records, then running the same query in each of the different formats is a very clear way to appreciate the differences between each output format.


RIGOROUS CHECK OF THE QUERY

The rigorous check checkbox probably provides more feedback about less desirable SPARQL, but unchecking it won't help you run a query with fatal errors. I personally find the SPARQL compiler's error feedback less helpful than the feedback from Oracle's sql compiler, but Oracle has been around a lot longer than SPARQL.


EXECUTION TIMEOUT IN MILLISECONDS

I haven't used it.


RUN QUERY

When you click the Run Query button you can see the output of your query in the format your specified, in this example, HTML. Such a raw dump of all the distinct concepts in dbpedia shows an enormous number of concepts that appear unintelligible. Farther down the list you see concepts that make sense even at a casual glance.

See the results.

No comments:

Post a Comment