W3C home > Mailing lists > Public > public-sparql-dev@w3.org > October to December 2010

Re: Sparql advanced question on for all and at least assertion on property...

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Tue, 21 Dec 2010 08:47:50 +0000
Message-ID: <4D1069B6.2010707@epimorphics.com>
To: Matteo Busanelli <mbusanelli@imolinfo.it>
CC: public-sparql-dev@w3.org
In SPARQL 1.1, there is grouping and MAX:

SELECT ?person
WHERE {
   ?person :has_number ?number .
}
GROUP BY ?person
HAVING (MAX(?number) < 10)

	Andy

On 20/12/10 14:53, Matteo Busanelli wrote:
> I everyone sparql people,
> i need support on a query that is giving me trouble.
>
> I want to select all instances of a class witch have ALL the value of
> the property P1 matching a condition.
> My problem is to express the ALL assertion. I'm able of selecting all
> the triple in witch an instance verify the condition for the property P1
> but I can't assert that this istance doesen't have also a valorization
> of the property that doesn't verify my condition.
>
> EXAMPLE
> Having:
>
> Matteo has_number 12
> Matteo has_number 3
> Matteo has_number 8
>
> Lee has_number 9
> Lee has_number 2
> Lee has_number 4
>
> I want to find the persons that HAS ONLY number less than 10.
>
> This doesn't work because return also Matteo:
>
> SELECT DISTINCT ?person
> WHERE {
> ?person :has_number ?number .
> FILTER (?number < 10)
> }
>
> Result:
>
> Matteo
> Lee
>
> Wanted result:
> Lee
>
> Can you suggest me the way I can do that?
>
> Thank you for your time,
> Matteo
>
>
Received on Tuesday, 21 December 2010 08:48:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 21 December 2010 08:48:30 GMT