Thursday 21 April 2011

A simple SPARQL query

And oh so simple it is too.

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <http://dbpedia.org/resource/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>


PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT * WHERE { ?s dbpedia-owl:genus :Corydoras }

All but the last prefix are included in SNORQL queries, and it was the matter of prefixes that was actually confusing me all last night through to this morning.

A big frustration for me has been that many of the examples of SPARQL queries I've found online don't work for one reason or another.

I finally broke down and asked in Freenode's Semantic Web Interest Group IRC channel (#swig) what I was doing wrong, and was quickly enlightened.

Thank you lawd! (And William Waites AKA ww on Freenode!)

No comments:

Post a Comment