W3C home > Mailing lists > Public > public-swbp-wg@w3.org > March 2006

Re: sparql for vocab management: theory vs practice

From: Dan Brickley <danbri@danbri.org>
Date: Sun, 26 Mar 2006 11:31:20 -0500
To: Steve Harris <S.W.Harris@ecs.soton.ac.uk>
Cc: Dan Brickley <danbri@danbri.org>, public-sparql-dev@w3.org, public-swbp-wg@w3.org
Message-ID: <20060326163120.GB24210@postdiluvian.org>

* Steve Harris <S.W.Harris@ecs.soton.ac.uk> [2006-03-26 17:15+0100]
> On Sun, Mar 26, 2006 at 10:38:47 -0500, Dan Brickley wrote:
> > 
> > >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 :)
> 
> I think it can be done with something like:

Thanks :)

> PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> SELECT DISTINCT ?p
> WHERE {
>     ?s ?p ?o
>     OPTIONAL { GRAPH foaf: { ?p rdf:type ?prop }
>                FILTER(?prop = rdfs:Property) }
>     FILTER(REGEX(?p, "^http://xmlns.com/foaf/0.1/") && !BOUND(?prop))
> }
> 
> However when I tried to test it SPARQLer told be it would allow dataset
> building (when I tried to use FROM) and the rasqal demo gave a parse
> error on the FOAF schema.

Sparqler (the online demo) won't allow FROM? Rasqal's at least didn't
used to, either. Re parse error, maybe ARQ sends a content 
negotiation preference for application/rdf+xml while Redland is stuck
looking for RDF inside the XHTML FOAF spec?

I tried it on commandline with ARQ, and get:

	org/apache/oro/text/regex/MalformedPatternException

Do we need to escape those '/' chars somehow? or the ':', the '.'?
After some quick experiments, it seems not. Hmm. Hmm. 

So you can run a regex directly against ?p, without casting it to a
string? That's handy/grungy...

On the query itself, once this part works, I guess I can scope the 
?s ?p ?o part to a set of named graphs, rather than the default graph?
(I need this in a real app, where we're checking healthcare records are
all using properly defined properties).

I would have expected there'd be some way to express all of this in 
terms of named graphs and !bound(), rather than relying on string 
matching against property URIs. But I've not spent much time with 
this corner of SPARQL yet. Is it inexpressible?

cheers,

Dan

> - Steve
Received on Sunday, 26 March 2006 16:31:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:17:21 GMT