From 02f02606256fd7dc22015b671482c1759a1c5409 Mon Sep 17 00:00:00 2001 From: Daniel Hernandez Date: Sat, 28 Feb 2026 08:52:12 +0100 Subject: [PATCH] Add 1-hop and 2-hop example CONSTRUCT queries for step-01 graph. --- queries/step_01_1hop_example.rq | 18 ++++++++++++++++++ queries/step_01_2hop_example.rq | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 queries/step_01_1hop_example.rq create mode 100644 queries/step_01_2hop_example.rq diff --git a/queries/step_01_1hop_example.rq b/queries/step_01_1hop_example.rq new file mode 100644 index 0000000..ae937d9 --- /dev/null +++ b/queries/step_01_1hop_example.rq @@ -0,0 +1,18 @@ +PREFIX 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 . + } +} diff --git a/queries/step_01_2hop_example.rq b/queries/step_01_2hop_example.rq new file mode 100644 index 0000000..8b22004 --- /dev/null +++ b/queries/step_01_2hop_example.rq @@ -0,0 +1,33 @@ +PREFIX 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) + } +}