Tim, I'm wondering to what extent your use case can be solved with
property paths. For example:
SELECT *
WHERE
{ ?child :ingredient* ?arg1 .
}
...where ?arg1 is the root of the three you're trying to traverse,
passed into a SPIN function as an argument. The result is all of the
children of ?arg1 following the :ingredient property(to remove ?arg1
from the solution, use '+' instead of '*').
If there are different property types involved, you can create a path
expression to follow to properties. In this case you can follow
either :ingredient or :subIngredient:
SELECT *
WHERE
{ ?child (:ingredient | :subIngredient)* ?arg1 .
}
And in this one you follow paths that have an :ingredient property
then a :subIngredient property, meaning you only get bindings of ?
child that are on the end of a :ingredient/:subIngredient path:
SELECT *
WHERE
{ ?child (:ingredient/:subIngredient)* ?arg1 .
}
>From what you say I can't help wonder if this would get you pretty far
without needing a recursive call to a function..
-- Scott
On Jan 24, 9:23 pm, Tim Smith <[email protected]> wrote:
> Hi,
>
> I have a situation where I'm extracting a recipe from an oracle database
> (relational).
>
> Each recipe consists of a list of ingredients. Each ingredient may consist
> of one or more ingredients and so on... (think of making a cake with
> frosting - the frosting is an ingredient for the cake recipe but the
> frosting really consists of many other ingredients). The ingredient
> "hierarchy" can be many levels deep.
>
> Using a web service, I can retrieve, via xml, a recipe with it's main
> ingredients. Repeatedly calling the web service allows me to retrieve all
> of child ingredients for each "main" ingredient in the recipe.
>
> Given that this is fully recursive, it seems like an ideal fit for using
> SPIN with TOPSPIN inferencing. I was thinking that I could add a SPIN rule
> that would enable each ingredient to ask for all of it's children
> ingredients. The inference engine would then iterate until all the
> children have been retrieved, regardless of the depth of the ingredient
> hierarchy.
>
> The only thing that is stopping me is I do not know how to call the web
> service and convert it to RDF inside a SPIN rule. I can create an SM
> script that takes an ingredient ID as input and outputs the xml as RDF but
> I do now know to call the SM script from within a SPIN rule.
>
> Is this even possible? Or should I just do this completely in an SM script?
>
> Thanks for your input!
>
> Tim
--
-- 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, SPARQL Web Pages 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