- From: Rob Walpole <robkwalpole@gmail.com>
 - Date: Thu, 1 Nov 2012 17:50:42 +0000
 - To: public-sparql-dev@w3.org
 - Message-ID: <CACGPhhN51pxYajCYutsHtyYZKTn1hCz7ERwZpQ5-FZ93537Q2g@mail.gmail.com>
 
Hi,
I am new to SPARQL and hoping it can help me solve some problems :-)
The particular problem I am looking at is a catalog which has a tree
structure. When selecting a node within the tree I need to know whether
any, all or some of it's descendants have a certain status. SPARQL 1.1.
property paths look hopeful to help with this and I thought combining this
with a filter would be a good solution. The filter works fine when I am
just looking at the children of a node but when I switch to the descendants
the filter seems to break. Here is my SPARQL which works (prefixes excluded
for simplicity)...
SELECT ?child ?status WHERE {
    ?item dri:catalogReference "WO/16/409/27_1"^^xsd:string .
    ?child dri:catalogParentUUID ?item .
    ?closure dri:closureCatalogUUID ?child .
    ?closure dri:closureStatusDocument ?status .
    FILTER(?status = 0)
}
This returns only the children with  a status of '0' but when I change line
3 to...
?child dri:catalogParentUUID+ ?item
....(notice the plus) I get all the descendants with all status shown, which
is unexpected. Am I missing something here?
Thanks
Rob
-- 
Rob Walpole
Email robkwalpole@gmail.com
Tel. +44 (0)7969 869881
Skype: RobertWalpolehttp://www.linkedin.com/in/robwalpole
Received on Saturday, 3 November 2012 22:45:14 UTC