The following example demonstrates usage of the grab-follow-predicate pragma:
DEFINE input:grab-var "friend"
DEFINE input:grab-var "Others"
DEFINE input:grab-follow-predicate <http://xmlns.com/foaf/0.1/#knows>
DEFINE input:grab-depth 2
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>
SELECT DISTINCT *
WHERE
{
{
{
{
SELECT ?start ?friend
WHERE
{
?start foaf:knows ?friend .
}
}
OPTION ( transitive, t_distinct, t_max (5), t_in (?start), t_out (?friend) )
FILTER ( ?start = <http://www.w3.org/People/Berners-Lee/card#i> )
}
?friend foaf:knows ?Others .
}
}
LIMIT 10