SPARQL puzzle

I'm stuck with a query, and #swig didn't know so I'm trying here!

I'm using this dataset,

...which is from an experimental rdfa.html export of the schema.

My query goal, is to find all the properties (and the rdfs:domain
type(s) they're associated with, ultimately) which have an expected
value of "Text", but which do not also have any other expected types.

Note that this 'expected type' notion is expressed using a repeatable
property, schema:range, which is a more relaxed cousin of rdfs:range
(i.e. it's a hint for expected properties, but doesn't have the strong
semantics of rdfs:range).

So for example, there is a  class <>
         that defines a property "responsibilities" whose schema:range
expected value is text. The result set ought to contain this, only if
we don't have another schema:range pointing to a type like (the
fictional) ResponsibilityInfo. Use case is that I want to find
properties that are candidates for having their controlled values
externally enumerated, but which don't yet have a relevant
type defined. See if you're

I've been trying this using Jena on the commandline, with variations
on things like

 SELECT ?c ?l  where { ?x <>
<> . ?x
<> ?l . ?x
<> ?c . OPTIONAL { ?x
<> ?r2  } . FILTER ( ! (?r2 !=
<> &&  bound(?r2)) )  }

SELECT ?c ?l where { ?x <>
<> . ?x
<> ?l . ?x
<> ?c . OPTIONAL { ?x
<> ?r2  } . FILTER (  !bound(?r2) )  }

sparql --data _schema.nt 'SELECT ?x ?c ?l ?r1 ?r2  where { ?x
<> ?r1 . ?x
<> ?l . ?x
<> ?c . OPTIONAL { ?x
<> ?r2  } .  FILTER (?r1 =
<> && ?r2 != <>  ) } '

(these aren't right, but give some indication of what I was trying)

I find !bound pretty hard to think about. Is this something that needs
SPARQL 1.1 maybe?



Received on Monday, 7 May 2012 12:38:15 UTC