Partly in response to some concerns about validation and RDF, I’ve built a little tool (‘Rosco’ – RDF mumble Schema Checker mumble) to check an RDF document against a schema. It’s pretty simple – all it does is find all the classes in the schema, all the properties of each class (including superclasses), and then see if the RDF document specified says something sensible with respect to those classes and properties. Here’s the result for my foaf file (with some deliberate ‘mistakes’).
It also finds any other properties in that document for each class. For FOAF files specifically it also suggests a few improvements, e.g. use an inverseFunctionalProperty if there isn’t one there; use foaf:maker, rdfs:seeAlso where appropriate. It should work for any RDF schema though.
There’s also a little tool for looking at a schema linked from the same page. That just tells you what the domains of classes are in an RDF schema file (not ranges yet). It’s just a useful view on an RDF schema file, which can let you know if you’ve forgotten to put a domain in etc – maybe it can help with consistency checking. The foaf schema for example doesn’t have specific domains for title, nick etc (although of course rdf:Resource is implied).
Rosco is polite (I hope) and non-judgemental (Dan wanted to name it after Viz’s liberal parents). Dan’s Missing isn’t broken: data validation and freedom on the Semantic Web rdfweb weblog entry is highly relevant here.
Rosco is also a generic tool – I tried it with the RDF calendar schema and it works – although the schema itself doesn’t have any domains more specific than rdf:Resource.
So something along the lines of schemarama can do a more interesting sort of validation – you can specify that when you find a pacticular thing (identified by a query, so that could be class or something more complex such as by the presence of a series of properties), then you want it to match a certain pattern (also by a query). So this would include any namespaces you chose, and wouldn’t be restricted to ones from a particular schema. However, I think advances in this direction probably need queries that handle optional clauses which my version of squish doesn’t do yet. While waiting for shellac’s Super Query Engine 57 in Java, Rosco’s version of RDF document schema checking is useful for debugging purposes (why isn’t this file working in my viewer?) and for lightweight checking of RDF documents generally (especially as the schema is improved and updated).
As for query, I liked darobin’s metaphor: <darobin> “I see the interest in the approach of having a query that’s a graph with missing bits, so you dip in in the graph you’re querying and the interesting bits stick to it”.
Rosco of course was the bumbling sheriff from the Dukes of Hazzard…
The whole thing is running off ‘Tinkling’, my tiny java RDF api, which is now in CVS (finally) but needs a whole lot of polishing…