Mercurial > code > home > repos > homeauto
comparison service/mqtt_to_rdf/inference_test.py @ 1677:aa35ae7a1acc
add new bug test (no fix yet)
author | drewp@bigasterisk.com |
---|---|
date | Wed, 22 Sep 2021 01:22:05 -0700 |
parents | 80f4e741ca4f |
children | 2883da14847c |
comparison
equal
deleted
inserted
replaced
1676:e6d28e6d47b2 | 1677:aa35ae7a1acc |
---|---|
399 [] a :MqttStatementSource ; | 399 [] a :MqttStatementSource ; |
400 :mqttTopic ( "air_quality_outdoor" "sensor" "bme280_temperature" "state" ) . | 400 :mqttTopic ( "air_quality_outdoor" "sensor" "bme280_temperature" "state" ) . |
401 | 401 |
402 ''') | 402 ''') |
403 | 403 |
404 def testRemap(self): | |
405 inf = makeInferenceWithRules(''' | |
406 { | |
407 ?sensor a :AirQualitySensor; :label ?name . | |
408 (:mqttSource ?name) :childResource ?base . | |
409 } => { | |
410 ?sensor :statementSourceBase ?base . | |
411 } . | |
412 ''') | |
413 out = inf.infer(N3(''' | |
414 :airQualityIndoor a :AirQualitySensor; :label "air_quality_indoor" . | |
415 :airQualityOutdoor a :AirQualitySensor; :label "air_quality_outdoor" . | |
416 ''')) | |
417 self.assertGraphEqual(out, N3(''' | |
418 :airQualityIndoor :statementSourceBase <http://projects.bigasterisk.com/room/mqttSource/air_quality_indoor> . | |
419 :airQualityOutdoor :statementSourceBase <http://projects.bigasterisk.com/room/mqttSource/air_quality_outdoor> . | |
420 ''')) | |
421 | |
404 | 422 |
405 class TestListPerformance(WithGraphEqual): | 423 class TestListPerformance(WithGraphEqual): |
406 | 424 |
407 def testList1(self): | 425 def testList1(self): |
408 inf = makeInferenceWithRules("{ :a :b (:e0) . } => { :new :stmt :here } .") | 426 inf = makeInferenceWithRules("{ :a :b (:e0) . } => { :new :stmt :here } .") |