comparison service/mqtt_to_rdf/inference_test.py @ 1593:b0df43d5494c

big rewrite- more classes, smaller methods, more typesafe, all current tests passing
author drewp@bigasterisk.com
date Sat, 04 Sep 2021 23:23:55 -0700
parents 327202020892
children e58bcfa66093
comparison
equal deleted inserted replaced
1592:d7b66234064b 1593:b0df43d5494c
199 inf = makeInferenceWithRules("{ :a :b ?x . ?x math:greaterThan 5 } => { :new :stmt ?x } .") 199 inf = makeInferenceWithRules("{ :a :b ?x . ?x math:greaterThan 5 } => { :new :stmt ?x } .")
200 self.assertGraphEqual(inf.infer(N3(":a :b 3 .")), N3("")) 200 self.assertGraphEqual(inf.infer(N3(":a :b 3 .")), N3(""))
201 self.assertGraphEqual(inf.infer(N3(":a :b 5 .")), N3("")) 201 self.assertGraphEqual(inf.infer(N3(":a :b 5 .")), N3(""))
202 self.assertGraphEqual(inf.infer(N3(":a :b 6 .")), N3(":new :stmt 6 .")) 202 self.assertGraphEqual(inf.infer(N3(":a :b 6 .")), N3(":new :stmt 6 ."))
203 203
204 def testNonFiringMathRule(self):
205 inf = makeInferenceWithRules("{ :a :b ?x . (?x 1) math:sum ?y } => { :new :stmt ?y } .")
206 self.assertGraphEqual(inf.infer(N3("")), N3(""))
207
204 def testStatementGeneratingRule(self): 208 def testStatementGeneratingRule(self):
205 inf = makeInferenceWithRules("{ :a :b ?x . (?x 1) math:sum ?y } => { :new :stmt ?y } .") 209 inf = makeInferenceWithRules("{ :a :b ?x . (?x 1) math:sum ?y } => { :new :stmt ?y } .")
206 self.assertGraphEqual(inf.infer(N3(":a :b 3 .")), N3(":new :stmt 4 .")) 210 self.assertGraphEqual(inf.infer(N3(":a :b 3 .")), N3(":new :stmt 4 ."))
207 211
208 def test3Operands(self): 212 def test3Operands(self):