view service/mqtt_to_rdf/lhs_evaluation_test.py @ 1710:f4009f41f15d

patchablegraph to its own repo
author drewp@bigasterisk.com
date Wed, 24 Nov 2021 10:16:03 -0800
parents 4fd9fdfcf16a
children
line wrap: on
line source

import unittest

from rdflib import RDF, ConjunctiveGraph, Literal, Namespace
from rdflib.parser import StringInputSource

EX = Namespace('http://example.com/')


def N3(txt: str):
    g = ConjunctiveGraph()
    prefix = """
@prefix : <http://example.com/> .
"""
    g.parse(StringInputSource((prefix + txt).encode('utf8')), format='n3')
    return g