Off topic - SPARQL Query

0 views
Skip to first unread message

Jörn

unread,
Jul 3, 2009, 1:25:08 PM7/3/09
to OntoWiki User Discussion
Hello,

i am playing a little bit width Erfurt ;-) and trying to query a model
width vCard instances. It works fine, but I'm searching a query, which
selects the following triples, but I'm only have the uri: ex:id1.

ex:id1 vcard:fn 'name' .
ex:id1 vcard:tel '121212' .
ex:id1 vcard:email 'th...@example.org' .
ex:id1 vcard:adr ex:id2 .

ex:id2 vcard:street-address 'street' .
ex:id2 vcard:postal-code '10002' .

The query: SELECT ?p ?o WHERE { ex:id1 ?p ?o } gives me all triples
width subject ex:id1. My question is, is it possible to expand this
query, to get all triples width subject ex:id2, too?

sorry for this stupid and off-topic question, but perhaps somebody can
help me?!

jörn


Sebastian Dietzold

unread,
Jul 3, 2009, 4:14:14 PM7/3/09
to OntoWiki User Discussion
quote Jörn (3.7.2009):

> The query: SELECT ?p ?o WHERE { ex:id1 ?p ?o } gives me all triples
> width subject ex:id1. My question is, is it possible to expand this
> query, to get all triples width subject ex:id2, too?

of course it is:

SELECT ?p ?oWHERE { { ex:id1 ?p ?o. } UNION { ex:id2 ?p ?o. } }

See http://www.w3.org/TR/rdf-sparql-query/#alternatives for a reference on
UNION and SPARQL in general ...

regards

SD


--
Sebastian Dietzold - Department of Computer Science; University of Leipzig
Tel/Fax: +49 341 97 323-66/-29 http://bis.uni-leipzig.de/SebastianDietzold

Reply all
Reply to author
Forward
0 new messages