Really thank you Lee! This is the solution I was looking for. ;-)
Sorry for wasting your time. Byee, Matteo ======================== Matteo Busanelli Imola Informatica Srl. Via Selice 66/a 40026 Imola (Bo) Italy Tel: +39 0542 32640 Fax: +39 0542 28023 Skype: Busa78 e-mail: [email protected] web: http://www.imolinfo.it Linkedin: http://www.linkedin.com/in/matteobusanelli Diigo: http://www.diigo.com/list/busa78 Il 21/12/2010 11:08, Lee Feigenbaum ha scritto:
I think you can also do this in SPARQL 1.0 with the OPTIONAL clause, since OPTIONAL is "greedy" (will bind if it can). SELECT ?person WHERE { ?person a ex:Person . OPTIONAL { ?person :has_number ?number. FILTER(?number > 10) } FILTER(!bound(?number)) # keep those that couldn't match the opt. } This is untested and it's 5am, so I may be missing something obvious :-) Lee On 12/21/2010 3:47 AM, Andy Seaborne wrote: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
