Add 1-hop and 2-hop example CONSTRUCT queries for step-01 graph.

This commit is contained in:
Daniel Hernandez 2026-02-28 08:52:12 +01:00
parent e81120d353
commit 02f0260625
2 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,18 @@
PREFIX person: <http://example.org/migrants/person/>
CONSTRUCT {
?s ?p ?o .
}
WHERE {
{
# Triples about Irene Abendroth (as subject)
?s ?p ?o .
FILTER(?s = person:AbeIre-00)
}
UNION
{
# Triples from other tables referencing Irene Abendroth
?s ?p ?o .
?s ?ref person:AbeIre-00 .
}
}

View file

@ -0,0 +1,33 @@
PREFIX person: <http://example.org/migrants/person/>
CONSTRUCT {
?s ?p ?o .
}
WHERE {
{
# Hop 0: Triples about Irene Abendroth (as subject)
?s ?p ?o .
FILTER(?s = person:AbeIre-00)
}
UNION
{
# Hop 1 (incoming): Triples about nodes referencing the anchor
?s ?p ?o .
?s ?ref person:AbeIre-00 .
}
UNION
{
# Hop 1 (outgoing): Triples about IRI nodes referenced by the anchor
?s ?p ?o .
person:AbeIre-00 ?ref ?s .
FILTER(isIRI(?s))
}
UNION
{
# Hop 2: Triples about IRI nodes referenced by hop-1 nodes
?s ?p ?o .
?hop1 ?r1 person:AbeIre-00 .
?hop1 ?r2 ?s .
FILTER(isIRI(?s) && ?s != person:AbeIre-00)
}
}