Mercurial > code > home > repos > homeauto
comparison service/mqtt_to_rdf/mqtt_message.py @ 1706:2085ed9cfcc4
reworking UI to reflect the new inferencing code
author | drewp@bigasterisk.com |
---|---|
date | Sat, 23 Oct 2021 13:22:40 -0700 |
parents | b3132cd02686 |
children |
comparison
equal
deleted
inserted
replaced
1705:250f4c27d56f | 1706:2085ed9cfcc4 |
---|---|
6 | 6 |
7 ROOM = Namespace('http://projects.bigasterisk.com/room/') | 7 ROOM = Namespace('http://projects.bigasterisk.com/room/') |
8 JSON = Namespace('http://bigasterisk.com/anyJson/') | 8 JSON = Namespace('http://bigasterisk.com/anyJson/') |
9 | 9 |
10 | 10 |
11 def graphFromMessage(topic: bytes, body: bytes): | 11 def graphFromMessage(topicUri: URIRef, topic: bytes, body: bytes): |
12 graph = Graph() | 12 graph = Graph() |
13 message = URIRef(f'{uuid.uuid1().urn}') | 13 message = URIRef(f'{uuid.uuid1().urn}') |
14 | |
15 graph.add((topicUri, ROOM['message'], message)) | |
14 | 16 |
15 graph.add((message, RDF.type, ROOM['MqttMessage'])) | 17 graph.add((message, RDF.type, ROOM['MqttMessage'])) |
16 | 18 |
17 topicSegments = BNode() | 19 topicSegments = BNode() |
18 graph.add((message, ROOM['topic'], topicSegments)) | 20 graph.add((message, ROOM['topic'], topicSegments)) |