W3C home > Mailing lists > Public > public-sparql-dev@w3.org > April to June 2014

Re: Descendants

From: Alex Muir <alex.g.muir@gmail.com>
Date: Wed, 9 Apr 2014 13:53:53 -0400
Message-ID: <CAFtPEJaWz+dJyWu-DrE4vAr=dSyR8gTO1B2_T_bQv4o8hPAOpw@mail.gmail.com>
To: Markus Kroetzsch <markus.kroetzsch@tu-dresden.de>
Cc: public-sparql-dev@w3.org
Hi,

So just wanted to post what ended up working for me.. the + gathers
the decendants

SELECT *
WHERE {
 ?s rdfs:label "ELT:Level.doors" .
 ?s property:ChildElement+ ?p
}

Regards

On Tue, Apr 8, 2014 at 4:36 AM, Alex Muir <alex.g.muir@gmail.com> wrote:
> Thanks guys,,
>
> I don't see descendant examples in the spec but perhaps I'm not
> searching for the correct terms.
>
> I'll have to keep reading more to understand this..
>
>
>
>
> On Mon, Apr 7, 2014 at 8:05 AM, Markus Kroetzsch
> <markus.kroetzsch@tu-dresden.de> wrote:
>> Hi Alex,
>>
>> You can use SPARQL 1.1 *property paths* for getting all descendants of a
>> node. Examples should be findable online, for example in the W3C documents
>> on SPARQL 1.1.
>>
>> Regards,
>>
>> Markus
>>
>>
>> On 07/04/14 12:37, Alex Muir wrote:
>>>
>>> Hi,
>>>
>>> I've recently set up jena and imported an rdf file which is exported
>>> from Semantic Media Wiki. I've been reading through SPARQL tutorials
>>> and searching online but I haven't come across much in the way of
>>> example queries that are used to return for example in this case a
>>> subject and subjects of it's children or even more complex a subject
>>> and all it's descendant subjects which thus far I feel from what I've
>>> read is not possible. Is that the case?
>>>
>>> Can you point me to any resources that would help me understand how to
>>> build such queries?
>>>
>>> Here is a snippet of the rdf input.
>>>
>>> Multiple  property:ChildElement can exist within each subject.
>>>
>>> <swivt:Subject
>>> rdf:about="http://elt.kode1100.com/wiki/index.php/Special:URIResolver/ELT-3ALevel.doors">
>>>          <rdf:type rdf:resource="&wiki;Category-3AElements"/>
>>>          <rdfs:label>ELT:Level.doors</rdfs:label>
>>>          <swivt:page
>>> rdf:resource="http://elt.kode1100.com/wiki/index.php/ELT:Level.doors"/>
>>>          <rdfs:isDefinedBy
>>>
>>> rdf:resource="http://elt.kode1100.com/wiki/index.php/Special:ExportRDF/ELT:Level.doors"/>
>>>          <swivt:wikiNamespace
>>>
>>> rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">4</swivt:wikiNamespace>
>>>          <property:ChildElement rdf:resource="&wiki;ELT-3AQuestion.doors"/
>>>
>>>
>>> Regards
>>>
>>
>> --
>> Markus Kroetzsch
>> Faculty of Computer Science
>> Technische Universitšt Dresden
>> +49 351 463 38486
>> http://korrekt.org/
>
>
>
> --
> -
>
> Alex Muir
> http://ca.linkedin.com/pub/alex-muir/36/ab7/125



-- 
-

Alex Muir
http://ca.linkedin.com/pub/alex-muir/36/ab7/125
Received on Wednesday, 9 April 2014 17:54:20 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:15:52 UTC