Mercurial > code > home > repos > homeauto
comparison service/mqtt_to_rdf/infer_perf_test.py @ 1648:3059f31b2dfa
more performance work
author | drewp@bigasterisk.com |
---|---|
date | Fri, 17 Sep 2021 11:10:18 -0700 |
parents | |
children | 00a5624d1d14 |
comparison
equal
deleted
inserted
replaced
1647:34eb87f68ab8 | 1648:3059f31b2dfa |
---|---|
1 import logging | |
2 import unittest | |
3 | |
4 from rdflib.graph import ConjunctiveGraph | |
5 | |
6 from inference import Inference | |
7 from inference_test import N3 | |
8 | |
9 logging.basicConfig(level=logging.INFO) | |
10 | |
11 # ~/.venvs/mqtt_to_rdf/bin/nosetests --with-watcher --logging-level=INFO --with-timer -s --nologcapture infer_perf_test | |
12 | |
13 | |
14 class TestPerf(unittest.TestCase): | |
15 | |
16 def test(self): | |
17 config = ConjunctiveGraph() | |
18 config.parse('conf/rules.n3', format='n3') | |
19 | |
20 inference = Inference() | |
21 inference.setRules(config) | |
22 expandedConfig = inference.infer(config) | |
23 expandedConfig += inference.nonRuleStatements() | |
24 | |
25 for loop in range(10): | |
26 # g = N3(''' | |
27 # <urn:uuid:2f5bbe1e-177f-11ec-9f97-8a12f6515350> a :MqttMessage ; | |
28 # :body "online" ; | |
29 # :onlineTerm :Online ; | |
30 # :topic ( "frontdoorlock" "status") . | |
31 # ''') | |
32 # derived = inference.infer(g) | |
33 | |
34 # g = N3(''' | |
35 # <urn:uuid:2f5bbe1e-177f-11ec-9f97-8a12f6515350> a :MqttMessage ; | |
36 # :body "zz" ; | |
37 # :bodyFloat 12.2; | |
38 # :onlineTerm :Online ; | |
39 # :topic ( "air_quality_outdoor" "sensor" "bme280_temperature" "state") . | |
40 # ''') | |
41 # derived = inference.infer(g) | |
42 g = N3(''' | |
43 <urn:uuid:a4778502-1784-11ec-a323-464f081581c1> a :MqttMessage ; | |
44 :body "65021" ; | |
45 :bodyFloat 6.5021e+04 ; | |
46 :topic ( "air_quality_indoor" "sensor" "ccs811_total_volatile_organic_compound" "state" ) . | |
47 ''') | |
48 derived = inference.infer(g) | |
49 | |
50 # self.fail() |