Spellchecking vocabularies with SPARQL
Dan Brickley experiments with using SPARQL queries to check on the vocabularies used in an RDF file.
Here’s a query that checks my FOAF file for properties that are in the FOAF namespace, but not declared in the FOAF RDFS file.
PREFIX foaf:PREFIX rdf: PREFIX owl: PREFIX rdfs: SELECT DISTINCT ?property FROM FROM NAMED foaf: WHERE { ?s ?property ?o GRAPH foaf: { OPTIONAL { ?property a ?t FILTER (?t = owl:ObjectProperty || ?t = owl:DatatypeProperty || ?t = rdf:Property || ?t = owl:FunctionalProperty || ?t = owl:InverseFunctionalProperty) } } FILTER (!BOUND(?t)) FILTER (REGEX(STR(?property), "^http://xmlns\\.com/foaf/0\\.1/")) }
This query actually finds some stuff — here are the results as of today:
-------------------------
| property |
=========================
| foaf:withOrganization |
| foaf:hpmepage |
| foaf:linkedWith |
-------------------------
One’s a typo, and I’ve no idea how I got the idea that the other two were in FOAF.
SPARQL: SPellchecker And RDF Query Language!