Mercurial > code > home > repos > homeauto
view service/mqtt_to_rdf/infer_perf_test.py @ 1664:1a7c1261302c
logic fix- some bindings were being returned 2+; some 0 times
author | drewp@bigasterisk.com |
---|---|
date | Mon, 20 Sep 2021 23:19:08 -0700 |
parents | 00a5624d1d14 |
children | 0d7635335616 |
line wrap: on
line source
import logging import unittest from rdflib.graph import ConjunctiveGraph from inference import Inference from inference_test import N3 logging.basicConfig(level=logging.INFO) # ~/.venvs/mqtt_to_rdf/bin/nosetests --with-watcher --logging-level=INFO --with-timer -s --nologcapture infer_perf_test class TestPerf(unittest.TestCase): def test(self): config = ConjunctiveGraph() config.parse('conf/rules.n3', format='n3') inference = Inference() inference.setRules(config) expandedConfig = inference.infer(config) expandedConfig += inference.nonRuleStatements() for loop in range(50): # g = N3(''' # <urn:uuid:2f5bbe1e-177f-11ec-9f97-8a12f6515350> a :MqttMessage ; # :body "online" ; # :onlineTerm :Online ; # :topic ( "frontdoorlock" "status") . # ''') # derived = inference.infer(g) # g = N3(''' # <urn:uuid:2f5bbe1e-177f-11ec-9f97-8a12f6515350> a :MqttMessage ; # :body "zz" ; # :bodyFloat 12.2; # :onlineTerm :Online ; # :topic ( "air_quality_outdoor" "sensor" "bme280_temperature" "state") . # ''') # derived = inference.infer(g) g = N3(''' <urn:uuid:a4778502-1784-11ec-a323-464f081581c1> a :MqttMessage ; :body "65021" ; :bodyFloat 6.5021e+04 ; :topic ( "air_quality_indoor" "sensor" "ccs811_total_volatile_organic_compound" "state" ) . ''') derived = inference.infer(g) # self.fail()