comparison service/mqtt_to_rdf/inference_test.py @ 1672:23beadd3e83a

split a test
author drewp@bigasterisk.com
date Tue, 21 Sep 2021 23:21:59 -0700
parents 4fd9fdfcf16a
children 80f4e741ca4f
comparison
equal deleted inserted replaced
1671:2b905c07e82b 1672:23beadd3e83a
115 self.assertGraphEqual(implied, N3(""" 115 self.assertGraphEqual(implied, N3("""
116 :new :stmt :c . 116 :new :stmt :c .
117 :new :stmt2 :new . 117 :new :stmt2 :new .
118 """)) 118 """))
119 119
120 def testVarLinksTwoStatements(self):
121 inf = makeInferenceWithRules("{ :a :b ?x . :d :e ?x } => { :new :stmt ?x } .")
122 implied = inf.infer(N3(":a :b :c ."))
123 self.assertGraphEqual(implied, N3(""))
124 implied = inf.infer(N3(":a :b :c . :d :e :f ."))
125 self.assertGraphEqual(implied, N3(""))
126 implied = inf.infer(N3(":a :b :c . :d :e :c ."))
127 self.assertGraphEqual(implied, N3(":new :stmt :c ."))
128
129 def testRuleMatchesStaticStatement(self): 120 def testRuleMatchesStaticStatement(self):
130 inf = makeInferenceWithRules("{ :a :b ?x . :a :b :c . } => { :new :stmt ?x } .") 121 inf = makeInferenceWithRules("{ :a :b ?x . :a :b :c . } => { :new :stmt ?x } .")
131 implied = inf.infer(N3(":a :b :c .")) 122 implied = inf.infer(N3(":a :b :c ."))
123 self.assertGraphEqual(implied, N3(":new :stmt :c ."))
124
125
126 class TestVarLinksTwoStatements(WithGraphEqual):
127
128 def setUp(self):
129 self.inf = makeInferenceWithRules("{ :a :b ?x . :d :e ?x } => { :new :stmt ?x } .")
130
131 def testOnlyOneStatementPresent(self):
132 implied = self.inf.infer(N3(":a :b :c ."))
133 self.assertGraphEqual(implied, N3(""))
134
135 def testObjectsConflict(self):
136 implied = self.inf.infer(N3(":a :b :c . :d :e :f ."))
137 self.assertGraphEqual(implied, N3(""))
138
139 def testObjectsAgree(self):
140 implied = self.inf.infer(N3(":a :b :c . :d :e :c ."))
132 self.assertGraphEqual(implied, N3(":new :stmt :c .")) 141 self.assertGraphEqual(implied, N3(":new :stmt :c ."))
133 142
134 143
135 class TestBnodeMatching(WithGraphEqual): 144 class TestBnodeMatching(WithGraphEqual):
136 145