sparql for vocab management: theory vs practice

>From a blog post I wrote yesterday, http://danbri.org/words/ 
(where I'm having some connectivity and dns hosting woes, it seems)

There's a question buried in here: how do we ask SPARQL for the URIs
of properties that appear in FOAF files yet aren't defined in the spec?

Suggestions welcomed :)

http://danbri.org/words/2006/03/26/150 

Ive lately been thinking about whether the named graph support in SPARQL
can help us evolve vocabularies and associated code (eg. generators and
translators) in parallel, so that we know when the RDF generators are
emitting markup that uses properties which arent yet documented in the
ontology; or when the ontology contains terms that arent being used in
any actual data.

Here is a quick example in terms of FOAF, in a form that should run
directly with Jenas ARQ commandline tool. The query shown here takes a
handful of specified FOAF files and compares their property usage with
information about those properties in the RDF/OWL description of the
FOAF spec. Query copied below, followed by the results. This is a pretty
simple query; there are lots of related ideas we might explore. What Id
like to figure out (help welcomed!) is quite how to check for properties
in instance data that dont have corresponding definitions in the
ontology. I expect it has something to do with unbound, 

Anyway, some basic FOAF-related querying for now:


PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#>

# Experiment with using SPARQL to compare actual property usage
# with the property declarations in FOAF. This query asks which
# properties are in use, and gets their label from the FOAF spec.
# Q: how to do the contrary, and specify which deployed properties
# are not in the spec?

PREFIX danbri: <http://danbri.org/foaf.rdf>
PREFIX libby:
<http://swordfish.rdfweb.org/people/libby/rdfweb/webwho.xrdf>
PREFIX kanzaki: <http://www.kanzaki.com/info/webwho.rdf>
PREFIX edd: <http://heddley.com/edd/foaf.rdf>
PREFIX inkel: <http://purl.org/net/inkel/inkel.foaf.rdf>
PREFIX mattb: <http://www.picdiary.com/foaf.rdf>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?prop ?label ?graph ?status

FROM NAMED foaf:
FROM NAMED danbri:
FROM NAMED libby:
FROM NAMED kanzaki:
FROM NAMED edd:
FROM NAMED inkel:
FROM NAMED mattb:

WHERE {
GRAPH foaf: {
{ ?prop rdf:type ?t }
FILTER (?t = owl:ObjectProperty || ?t = owl:DatatypeProperty ||
?t = rdf:Property || ?t = owl:FunctionalProperty ||
?t = owl:InverseFunctionalProperty ) .
?prop rdfs:label ?label . ?prop rdfs:comment ?c .
?prop vs:term_status ?status .
}
OPTIONAL { GRAPH ?graph { ?x ?prop ?y . } }
FILTER ( ?graph != foaf: )
}
ORDER BY ?prop

This gives the following results using ARQ (sparql --query on the
commandline):

(sorry about any bad linewrapping; the basic idea should be clear 
anyway, which is that we get a list of properties, their labels, and 
the graph they're found in...)

---------------------------------------------------------------------------------------------
| prop                   | label                                    |
graph    | status     |
=============================================================================================
| foaf:aimChatID         | "AIM chat ID"                            |
danbri:  | "testing"  |
| foaf:aimChatID         | "AIM chat ID"                            |
edd:     | "testing"  |
| foaf:based_near        | "based near"                             |
inkel:   | "unstable" |
| foaf:based_near        | "based near"                             |
mattb:   | "unstable" |
| foaf:based_near        | "based near"                             |
kanzaki: | "unstable" |
| foaf:currentProject    | "current project"                        |
inkel:   | "testing"  |
| foaf:currentProject    | "current project"                        |
libby:   | "testing"  |
| foaf:currentProject    | "current project"                        |
kanzaki: | "testing"  |
| foaf:depiction         | "depiction"                              |
inkel:   | "testing"  |
| foaf:depiction         | "depiction"                              |
libby:   | "testing"  |
| foaf:depiction         | "depiction"                              |
danbri:  | "testing"  |
| foaf:depiction         | "depiction"                              |
mattb:   | "testing"  |
| foaf:depiction         | "depiction"                              |
kanzaki: | "testing"  |
| foaf:depiction         | "depiction"                              |
edd:     | "testing"  |
| foaf:depicts           | "depicts"                                |
edd:     | "testing"  |
| foaf:family_name       | "family_name"                            |
inkel:   | "testing"  |
| foaf:firstName         | "firstName"                              |
inkel:   | "testing"  |
| foaf:gender            | "gender"                                 |
kanzaki: | "testing"  |
| foaf:givenname         | "Given name"                             |
inkel:   | "testing"  |
| foaf:holdsAccount      | "holds account"                          |
kanzaki: | "unstable" |
| foaf:homepage          | "homepage"                               |
inkel:   | "stable"   |
| foaf:homepage          | "homepage"                               |
danbri:  | "stable"   |
| foaf:homepage          | "homepage"                               |
mattb:   | "stable"   |
| foaf:homepage          | "homepage"                               |
kanzaki: | "stable"   |
| foaf:homepage          | "homepage"                               |
edd:     | "stable"   |
| foaf:icqChatID         | "ICQ chat ID"                            |
inkel:   | "testing"  |
| foaf:img               | "image"                                  |
danbri:  | "testing"  |
| foaf:img               | "image"                                  |
mattb:   | "testing"  |
| foaf:img               | "image"                                  |
kanzaki: | "testing"  |
| foaf:img               | "image"                                  |
edd:     | "testing"  |
| foaf:interest          | "interest"                               |
inkel:   | "testing"  |
| foaf:interest          | "interest"                               |
libby:   | "testing"  |
| foaf:interest          | "interest"                               |
kanzaki: | "testing"  |
| foaf:isPrimaryTopicOf  | "is primary topic of"                    |
danbri:  | "testing"  |
| foaf:jabberID          | "jabber ID"                              |
inkel:   | "testing"  |
| foaf:jabberID          | "jabber ID"                              |
danbri:  | "testing"  |
| foaf:knows             | "knows"                                  |
inkel:   | "testing"  |
| foaf:knows             | "knows"                                  |
libby:   | "testing"  |
| foaf:knows             | "knows"                                  |
danbri:  | "testing"  |
| foaf:knows             | "knows"                                  |
mattb:   | "testing"  |
| foaf:knows             | "knows"                                  |
kanzaki: | "testing"  |
| foaf:knows             | "knows"                                  |
edd:     | "testing"  |
| foaf:made              | "made"                                   |
danbri:  | "testing"  |
| foaf:made              | "made"                                   |
kanzaki: | "testing"  |
| foaf:maker             | "maker"                                  |
inkel:   | "testing"  |
| foaf:maker             | "maker"                                  |
libby:   | "testing"  |
| foaf:maker             | "maker"                                  |
kanzaki: | "testing"  |
| foaf:maker             | "maker"                                  |
edd:     | "testing"  |
| foaf:mbox              | "personal mailbox"                       |
inkel:   | "stable"   |
| foaf:mbox              | "personal mailbox"                       |
libby:   | "stable"   |
| foaf:mbox              | "personal mailbox"                       |
danbri:  | "stable"   |
| foaf:mbox              | "personal mailbox"                       |
kanzaki: | "stable"   |
| foaf:mbox              | "personal mailbox"                       |
edd:     | "stable"   |
| foaf:mbox_sha1sum      | "sha1sum of a personal mailbox URI name" |
inkel:   | "testing"  |
| foaf:mbox_sha1sum      | "sha1sum of a personal mailbox URI name" |
libby:   | "testing"  |
| foaf:mbox_sha1sum      | "sha1sum of a personal mailbox URI name" |
danbri:  | "testing"  |
| foaf:mbox_sha1sum      | "sha1sum of a personal mailbox URI name" |
mattb:   | "testing"  |
| foaf:mbox_sha1sum      | "sha1sum of a personal mailbox URI name" |
kanzaki: | "testing"  |
| foaf:mbox_sha1sum      | "sha1sum of a personal mailbox URI name" |
edd:     | "testing"  |
| foaf:msnChatID         | "MSN chat ID"                            |
inkel:   | "testing"  |
| foaf:msnChatID         | "MSN chat ID"                            |
danbri:  | "testing"  |
| foaf:myersBriggs       | "myersBriggs"                            |
danbri:  | "testing"  |
| foaf:myersBriggs       | "myersBriggs"                            |
mattb:   | "testing"  |
| foaf:myersBriggs       | "myersBriggs"                            |
kanzaki: | "testing"  |
| foaf:myersBriggs       | "myersBriggs"                            |
edd:     | "testing"  |
| foaf:name              | "name"                                   |
inkel:   | "testing"  |
| foaf:name              | "name"                                   |
libby:   | "testing"  |
| foaf:name              | "name"                                   |
danbri:  | "testing"  |
| foaf:name              | "name"                                   |
mattb:   | "testing"  |
| foaf:name              | "name"                                   |
kanzaki: | "testing"  |
| foaf:name              | "name"                                   |
edd:     | "testing"  |
| foaf:nick              | "nickname"                               |
inkel:   | "testing"  |
| foaf:nick              | "nickname"                               |
libby:   | "testing"  |
| foaf:nick              | "nickname"                               |
danbri:  | "testing"  |
| foaf:nick              | "nickname"                               |
mattb:   | "testing"  |
| foaf:nick              | "nickname"                               |
kanzaki: | "testing"  |
| foaf:nick              | "nickname"                               |
edd:     | "testing"  |
| foaf:pastProject       | "past project"                           |
inkel:   | "testing"  |
| foaf:pastProject       | "past project"                           |
kanzaki: | "testing"  |
| foaf:plan              | "plan"                                   |
danbri:  | "testing"  |
| foaf:plan              | "plan"                                   |
kanzaki: | "testing"  |
| foaf:primaryTopic      | "primary topic"                          |
inkel:   | "testing"  |
| foaf:primaryTopic      | "primary topic"                          |
kanzaki: | "testing"  |
| foaf:primaryTopic      | "primary topic"                          |
edd:     | "testing"  |
| foaf:publications      | "publications"                           |
kanzaki: | "unstable" |
| foaf:schoolHomepage    | "schoolHomepage"                         |
danbri:  | "testing"  |
| foaf:schoolHomepage    | "schoolHomepage"                         |
kanzaki: | "testing"  |
| foaf:schoolHomepage    | "schoolHomepage"                         |
edd:     | "testing"  |
| foaf:surname           | "Surname"                                |
inkel:   | "testing"  |
| foaf:thumbnail         | "thumbnail"                              |
danbri:  | "testing"  |
| foaf:title             | "title"                                  |
kanzaki: | "testing"  |
| foaf:weblog            | "weblog"                                 |
inkel:   | "testing"  |
| foaf:weblog            | "weblog"                                 |
libby:   | "testing"  |
| foaf:weblog            | "weblog"                                 |
mattb:   | "testing"  |
| foaf:weblog            | "weblog"                                 |
kanzaki: | "testing"  |
| foaf:weblog            | "weblog"                                 |
edd:     | "testing"  |
| foaf:workplaceHomepage | "workplace homepage"                     |
inkel:   | "testing"  |
| foaf:workplaceHomepage | "workplace homepage"                     |
libby:   | "testing"  |
| foaf:workplaceHomepage | "workplace homepage"                     |
danbri:  | "testing"  |
| foaf:workplaceHomepage | "workplace homepage"                     |
mattb:   | "testing"  |
| foaf:workplaceHomepage | "workplace homepage"                     |
edd:     | "testing"  |
| foaf:yahooChatID       | "Yahoo chat ID"                          |
inkel:   | "testing"  |
---------------------------------------------------------------------------------------------


ps. thanks to ericp and danc for earlier help w/ the sparql...

Received on Sunday, 26 March 2006 15:38:58 UTC