W3C home > Mailing lists > Public > semantic-web@w3.org > May 2005

SPARQL queries: predicates, dumps, abouts etc

From: conor dowling <conor@the325project.org>
Date: Fri, 6 May 2005 16:59:00 -0700
Message-Id: <85bc2589359c01fee26d46ce9de72d9f@the325project.org>
To: semantic-web@w3.org

I hope this is the right group to mail about SPARQL, its use and 
meaning ... anyhow ...

Background: I want to migrate a factlog 
(http://www.the325project.org/factlog/325Factlog.xul) to remote, 
granular queries and away from monolithic RDF XML files. As I migrate 
from my old XUL template queries to SPARQL, some questions popped up. I 
think they are of general interest. I hope so anyway.

1) predicates as variables and dumping/discovery:

Let's say running the following
	WHERE {?person foaf:name ?name ; foaf:mbox ?mbox}

gets results like
[:p1 "joe" <mailto:joe@example.com>]
[:p2 "fred" <mailto:fred@example.com>]

	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?

i.e. something like
[:p1 foaf:name]
[:p1 foaf:mbox]
[:p2 foaf:name]
[:p2 foaf:mbox]

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

i.e. something like
[:p1 foaf:name "joe"]
[:p1 foaf:mbox <mailto:joe@example.com>]

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

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 }

is this equivalent to (presuming all resources have abouts and aren't 

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?

3) Types - just like any other predicate?

	WHERE { ?subject rdf:type ?type }

will give me all of the types of all of the resources - right?

[:p1 foaf:Person]
[:p1 t3p:Gamekeeper] ... it's just an example!
i.e. all the values of type for resources.

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
   { ?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?

[:people/p1 "joe" "Joe goes to Cairo"]
[:people/p1 "joe" "Joe does Jordan"]

Thx in advance for any misconceptions cleared up ...
Received on Friday, 6 May 2005 23:59:16 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 08:44:53 UTC