Skip to content

RDF Parser

Bases: Parser

Source code in src/typedlogic/integrations/frameworks/rdflib/rdf_parser.py
12
13
14
15
16
17
18
19
20
class RDFParser(Parser):
    def parse(self, source: Union[Path, str, TextIO], **kwargs) -> Theory:
        g = Graph()
        g.parse(source, format="ttl")
        parser = PythonParser()
        theory = parser.transform(rdfs)
        for sentence in rdf.generate_sentences(g):
            theory.add(sentence)
        return theory