Mailing list ARC-DEV: Archives

Re: [arc-dev] one-to-n relations

From: "Keith Alexander" 
Subject: Re: [arc-dev] one-to-n relations
Date: Thu, 02 Oct 2008 11:27:54 +0100


Hi,

The easiest way is to simply swap  SELECT ?name ?email for a DESCRIBE  
?person in your query
This will bring you back all the properties, including all the email  
addresses, of each person. This will be returned in ARC's simple index  
associative array structure.

If you want to be selective about the properties you get back, you can do  
a CONSTRUCT instead:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
  PREFIX foo: <http://bar.com/foo/>

CONSTRUCT {
  ?person foaf:name ?name .
  ?person foo:email ?email .

}
  WHERE {
  ?person a foaf:Person ; foaf:name ?name .
  ?person foo:email ?email .
}

HTH

Keith

On Wed, 01 Oct 2008 23:16:38 +0100, Marian Dörk <lists@anarchitect.org>  
wrote:

> Hello everybody,
>
> is there a way to have ARC combine multiple results when the entity has  
> multiple relations. For example, i am querying for people and their  
> email addresses:
>
>
> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> PREFIX foo: <http://bar.com/foo/>
>
> SELECT ?name ?email
> WHERE {
> ?person a foaf:Person ; foaf:name ?name .
> ?person foo:email ?email .
> }
>
>
> Using ARC, people having more than one email would show up multiple  
> times in the row array. However, i would like to have individual people  
> just showing up once in the rows array and then  still have the multiple  
> emails associated with the people items. Is this possible with one query?
>
> I am new to Sparql, so i'm sure there is an established method for this.  
> Thanks for any hints.
>
> Cheers,
> Marian
>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/