Peter,
At TopQuadrant, we have used recursive queries with SPIN functions and with magic properties.
Here is an example of a recursive SPARQL query done with magic graphs. It returns all SPOs that are on a given resource and any of the object resources it references.
It is called as simply as this:
SELECT *
WHERE {
(ns:Subject) sn:getSubGraph (?s ?p ?o)
}
sn:getSubGraph (spin:MagicProperty)
Flatten subgraph is a magic properrty that returns rdf statements (?s ?p ?o) for a node and all its object nodes recursively. The recursion excludes nodes at the range end of rdf:type properties.
Arguments
sp:arg1 (rdfs:Resource):
Function body
SELECT ?s ?p ?o
WHERE {
{
{
?arg1 ?p1 ?o1 .
FILTER bound(?arg1) .
FILTER (?p1 != rdf:type) .
} .
( ?o1 ) sn:getSubGraph ( ?s ?p ?o ) .
}
UNION
{
?arg1 ?p ?o .
BIND (?arg1 AS ?s) .
} .
}
A call
Ralph
rhodgson@topquadrant.com
> On Oct 14, 2015, at 6:49 PM, Peter F. Patel-Schneider <pfpschneider@gmail.com> wrote:
>
> There was a paper presented at ISWC on recursive SPARQL.
>
> Juan L. Reutter, Adrian Soto and Domagoj Vrgoc
> Recursion in SPARQL
> iswc2015.semanticweb.org/sites/iswc2015.semanticweb.org/files/93660017.pdf
>
> Some of the information in this paper might be relevant to SHACL.
>
>
> peter
>