summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpukkamustard <pukkamustard@posteo.net>2020-09-07 15:04:22 +0200
committerpukkamustard <pukkamustard@posteo.net>2020-09-07 15:04:22 +0200
commit9d8b083dd8897c55c08f9faa3b2dad0e71109fae (patch)
tree9a923c3af79cc04c59266edfc793e7c99b38c642
parentc0d03fabc6e5cccabe07101112952d97f556bf08 (diff)
(schemantic fragment-graph): add query helpers
-rw-r--r--schemantic/fragment-graph.scm11
-rw-r--r--tests/schemantic/fragment-graph.scm2
2 files changed, 10 insertions, 3 deletions
diff --git a/schemantic/fragment-graph.scm b/schemantic/fragment-graph.scm
index ce378e6..d040a04 100644
--- a/schemantic/fragment-graph.scm
+++ b/schemantic/fragment-graph.scm
@@ -24,7 +24,6 @@
make-fragment-reference
term->fragment-reference))
-
;; Fragment Graph
(define-class <fragment-graph> (<graph>)
@@ -173,3 +172,13 @@
(index-match (fragment-statements fg) (list fragment-reference
(term->fragment-reference base-subject p)
(term->fragment-reference base-subject o)))))))))
+
+(define-method (graph-query (fg <fragment-graph>) (s <iri>))
+ (make <graph-query>
+ #:graph fg #:s (term->fragment-reference (fragment-graph-base-subject fg) s)))
+
+(define-method (graph-query (fg <fragment-graph>) (fr <fragment-reference>))
+ (make <graph-query> #:graph fg #:s fr))
+
+(define-method (graph-query (fg <fragment-graph>) (s <string>))
+ (make <graph-query> #:graph fg #:s (make-fragment-reference s)))
diff --git a/tests/schemantic/fragment-graph.scm b/tests/schemantic/fragment-graph.scm
index d0d8316..beffe34 100644
--- a/tests/schemantic/fragment-graph.scm
+++ b/tests/schemantic/fragment-graph.scm
@@ -61,6 +61,4 @@
2 (length
(graph-match my-fg (make-triple (lvar) (lvar) (ex "foo")))))
-(graph-match my-fg (make-triple (lvar) (lvar) (ex "foo")))
-
(test-end "fragment-graph")