Mercurial > code > home > repos > homeauto
comparison 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 |
comparison
equal
deleted
inserted
replaced
1661:00a5624d1d14 | 1662:7a61113fd17d |
---|---|
217 class TestInferenceWithCustomFunctions(WithGraphEqual): | 217 class TestInferenceWithCustomFunctions(WithGraphEqual): |
218 | 218 |
219 def testAsFarenheit(self): | 219 def testAsFarenheit(self): |
220 inf = makeInferenceWithRules("{ :a :b ?x . ?x room:asFarenheit ?f } => { :new :stmt ?f } .") | 220 inf = makeInferenceWithRules("{ :a :b ?x . ?x room:asFarenheit ?f } => { :new :stmt ?f } .") |
221 self.assertGraphEqual(inf.infer(N3(":a :b 12 .")), N3(":new :stmt 53.6 .")) | 221 self.assertGraphEqual(inf.infer(N3(":a :b 12 .")), N3(":new :stmt 53.6 .")) |
222 | |
223 def testChildResource(self): | |
224 inf = makeInferenceWithRules("{ :a :b ?x . (:c ?x) room:childResource ?y .} => { :new :stmt ?y } .") | |
225 self.assertGraphEqual(inf.infer(N3(':a :b "foo" .')), N3(":new :stmt <http://projects.bigasterisk.com/room/c/foo> .")) | |
226 | |
227 def testChildResourceSegmentQuoting(self): | |
228 inf = makeInferenceWithRules("{ :a :b ?x . (:c ?x) room:childResource ?y .} => { :new :stmt ?y } .") | |
229 self.assertGraphEqual(inf.infer(N3(':a :b "b / w -> #." .')), | |
230 N3(":new :stmt <http://projects.bigasterisk.com/room/c/b%20%2F%20w%20-%3E%20%23.> .")) | |
222 | 231 |
223 | 232 |
224 class TestUseCases(WithGraphEqual): | 233 class TestUseCases(WithGraphEqual): |
225 | 234 |
226 def testSimpleTopic(self): | 235 def testSimpleTopic(self): |