diff service/mqtt_to_rdf/inference_test.py @ 1662:7a61113fd17d

new childResource function for making new URIs
author drewp@bigasterisk.com
date Sun, 19 Sep 2021 20:31:39 -0700
parents 31f7dab6a60b
children 1a7c1261302c
line wrap: on
line diff
--- a/service/mqtt_to_rdf/inference_test.py	Sun Sep 19 16:51:51 2021 -0700
+++ b/service/mqtt_to_rdf/inference_test.py	Sun Sep 19 20:31:39 2021 -0700
@@ -220,6 +220,15 @@
         inf = makeInferenceWithRules("{ :a :b ?x . ?x room:asFarenheit ?f } => { :new :stmt ?f } .")
         self.assertGraphEqual(inf.infer(N3(":a :b 12 .")), N3(":new :stmt 53.6 ."))
 
+    def testChildResource(self):
+        inf = makeInferenceWithRules("{ :a :b ?x . (:c ?x) room:childResource ?y .} => { :new :stmt ?y  } .")
+        self.assertGraphEqual(inf.infer(N3(':a :b "foo" .')), N3(":new :stmt <http://projects.bigasterisk.com/room/c/foo> ."))
+
+    def testChildResourceSegmentQuoting(self):
+        inf = makeInferenceWithRules("{ :a :b ?x . (:c ?x) room:childResource ?y .} => { :new :stmt ?y  } .")
+        self.assertGraphEqual(inf.infer(N3(':a :b "b / w -> #." .')),
+                              N3(":new :stmt <http://projects.bigasterisk.com/room/c/b%20%2F%20w%20-%3E%20%23.> ."))
+
 
 class TestUseCases(WithGraphEqual):