Hi,

I have requirement where I need to create a string that is based on
the recursive parent relationship in a hierarchy. After looking
around, I was hopeful that I would be able to create a recursive SPIN
function to achieve this but although the function appears to be
called recursively, I am not able to bind to the results of the
recursive calls to produce a concatenated string. I think part of the
problem might be that the last function call returns a empty result
set but I'm not 100% sure.

The SPIN function I am using is as follows:

SELECT ?name
WHERE {
    ?arg1 prod:hasParent ?parent .
    ?arg1 prod:name ?name .
    BIND (prod-instance:getLabel(?parent) AS ?temp) .
}

which returns "Pumps" (see what is essentially the call stack in the
SPIN statistics below).

Note that I know that this won't return a concatenated string but I
would just be happy to see the function return a binding for ?temp so
I can move forward. Not that in the statistics below, prod-instance:OE
does not have a statement for hasParent. (i.e. it is the root of the
hierarchy)

The results I am seeing using SPIN statistics are:

prod-instance:getLabel  SPIN Function prod-instance:getLabel(prod-
instance:OE) : Empty result set for SPIN function ...
prod-instance:getLabel  SPIN Function prod-instance:getLabel(prod-
instance:CSG) = "CSG"^^xsd:string
prod-instance:getLabel  SPIN Function prod-instance:getLabel(prod-
instance:TALINGA) = "Talinga"^^xsd:string
prod-instance:getLabel  SPIN Function prod-instance:getLabel(prod-
instance:4120-TGWT1) = "Water Treatment"^^xsd:string1
prod-instance:getLabel  SPIN Function prod-instance:getLabel(prod-
instance:4120-Utilities) = "Utilities"^^xsd:string
prod-instance:getLabel  SPIN Function prod-instance:getLabel(prod-
instance:4120-Hot-Warm-Water) = "Hot & Warm Water"^^xsd:string
prod-instance:getLabel  SPIN Function prod-instance:getLabel(prod-
instance:4120-HW-PUMPS) = "Pumps"^^xsd:string

Anyone that has some experience solving this sort of problem or any
thoughts would be greatly appreciated.

Thanks,
Mark.

-- 
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en

Reply via email to