- From: Steve Harris <steve.harris@garlik.com>
- Date: Fri, 18 Nov 2011 11:21:00 +0000
- To: gouadjed@eoweo.com
- Cc: semantic-web@w3.org
Jena supports SPARQL 1.1, so you should be able to do a query something like:
SELECT (COUNT(?friends) AS ?num_friends)
WHERE {
<person> foaf:knows ?friends
}
You can put this in a subquery if you need to use the number in other parts of the query.
- Steve
On 2011-11-18, at 10:53, Ghalem Ouadjed (EOWEO) wrote:
> Thank you for your answers.
>
> i had to precise that i m wroking on a closed application and even if foaf doesn t contain the property i need the query works on Jena...
>
> to be less specific, i would like to know how to look for a schema based on a specific need regarding the property ? is there a way to determine that there is one or more schema which contain one or more property i envision to use. This could help to decide if i have to write a lightweight one or to use an existing one...
>
> I can realize that this kind of problematics doesn t correspond to a dogmatic vision but i know and experiment the needs of some middle size companies aiming to use semantic technologies in a pragmatic way for closed applications like internal KM solutions for instance and why not which could be enhanced and contextualised by linked datas...
>
> Thank you again for your time
>
> Cheers
> Ghalem
>
> Le 18/11/2011 10:33, Heiko Paulheim a écrit :
>> Due to the open world assumption, the value of that counter would (probably) we wrong.
>>
>> If I have
>> :Peter foaf:knows :Stephen .
>> :Peter foaf:knows :Marc .
>>
>> and, based on that knowledge, I added
>>
>> :Peter myschema:friendnb "2"^^xsd:integer .
>>
>> this would not be a valid conclusion - there may be a lot more friends of Peter which are not in my knowledge base (don't we all have friends without a facebook account?), and :Stephen and :Marc might even refer to the same person. In other words, with that approach, I would add knowledge to my knowledge base which is potentially wrong.
>>
>> So I would rather refrain from doing that.
>>
>> Best,
>> Heiko.
>>
>> Am 18.11.2011 10:28, schrieb Melvin Carvalho:
>>> On 18 November 2011 10:20, Heiko Paulheim<paulheim@ke.tu-darmstadt.de> wrote:
>>>> Dear Ghalem,
>>>>
>>>> since such a property would be in a conflict with the open world assumption
>>>> underlying the semantic web (you simply cannot tell "how many things of type
>>>> X are there" in an open world), I suppose there is no serious schema which
>>>> has such a property.
>>> What if you kept a separate tally to aggregate total friends as they are added?
>>>
>>>> Best,
>>>> Heiko.
>>>>
>>>>
>>>>
>>>> Am 17.11.2011 18:40, schrieb Ghalem Ouadjed (EOWEO):
>>>>
>>>> Hi everyone,
>>>> i would like to use a schema which is different and complementary of the
>>>> foaf one, and which could contain a property like "number of friends".
>>>>
>>>> Does someone know an available ontology i could use pls?
>>>>
>>>> one of my query would look like :
>>>>
>>>> PREFIX rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>>>> PREFIX rdfs="http://www.w3.org/2000/01/rdf-schema#"
>>>> PREFIX dc="http://purl.org/dc/elements/1.1/"
>>>> PREFIX foaf="http://xmlns.com/foaf/0.1/"
>>>> PREFIX ............="_"
>>>>
>>>> SELECT ?friendnb WHERE { ?Person ...;;;;:friendnb ?friendnb }
>>>> ------------
>>>> | friendnb |
>>>> ============
>>>> | "\n330\n" |
>>>> ------------
>>>> Thank you in advance for your advices and your time
>>>>
>>>> Cheers
>>>> Ghalem
>>>>
>>>> --
>>>> Dr. Heiko Paulheim
>>>> Knowledge Engineering Group
>>>> Technische Universität Darmstadt
>>>> Phone: +49 6151 16 6634
>>>> Fax: +49 6151 16 5482
>>>> http://www.ke.tu-darmstadt.de/staff/heiko-paulheim
>>
>>
>>
>
--
Steve Harris, CTO, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203 http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD
Received on Friday, 18 November 2011 11:21:38 UTC