Re: SPARQL queries: predicates, dumps, abouts etc

On Sat, 07 May 2005 01:59:00 +0200, conor dowling  
<conor@the325project.org> wrote:


> 1) predicates as variables and dumping/discovery:

> Consider:
>  SELECT ?subject ?predicate WHERE { ?subject ?predicate ?object }
>
> Do I get a dump of all of the predicates supported by each and every  
> resource in a graph?

As I understand it (having looked at the spec but not really tried it). By  
the way there are several services available online that you can use to  
try these things. Of course there may be bugs in the service  
implementation, so it is worth clarifying questions about what is meant to  
happen...

> If so, does the following retrieve all the values of all the predicates,  
> in other words dump the graph?
>  SELECT *
>  WHERE { ?subject ?predicate ?object }

I think so.

> A variation of this, where you set the subject to :p1 would dump all of  
> the values of its predicates ... true?

I think so.

> 2) rdf:about value and value of "?subject"
>
> # can I get the "rdf:about" from every resource
> PREFIX rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> SELECT ?about
> WHERE { ?subject rdf:about ?about }

I wondered how to do this. I have a related question: Is there a way of  
saying (for example in OWL) that every some:Class should have an rdf:about  
or equivalent?

> is this equivalent to (presuming all resources have abouts and aren't  
> blank)?
>
> SELECT ?subject
>
> The subject variable is bound to an about uri value OR if blank, a  
> unique id, scoped to the result. Is that right?

I don't foillow you here.

> 3) Types - just like any other predicate?
>
>  SELECT *
>  WHERE { ?subject rdf:type ?type }
>
> will give me all of the types of all of the resources - right?

should do.

> 4) objects become subjects: arcs in as well as arcs out are supported
>
> Let's say "Event" resources reference "Person" resources using a  
> predicate "t3p:involved". So will ...
>
> SELECT ?person ?name ?eventName
> WHERE
>    { ?person foaf:name ?name .
>      ?event t3p:involved ?person . <----- subject "person" becomes object
>      ?event foaf:name ?eventName }
>
> give me people names with the names of all of their events?

Should do again.

(I am looking forward to answers from people who actually know this for  
certain... :-)

cheers

Chaals

-- 
Charles McCathieNevile                      Fundacion Sidar
charles@sidar.org   +61 409 134 136    http://www.sidar.org

Received on Sunday, 8 May 2005 14:51:09 UTC