RDF compatibility¶
rdf ¶
RDF/TriG/RDF 1.2 compatibility and RDF Message Log support.
This module deliberately keeps RDF compatibility outside the N3 rule parser. The N3 parser remains formula/rule-oriented; RDF compatibility uses rdflib for ordinary RDF syntaxes and a small surface-syntax adapter for RDF 1.2 constructs that rdflib does not yet accept uniformly.
RdfSyntaxError ¶
Bases: SyntaxError
Raised when the RDF compatibility parser rejects input.
assert_rdf12_surface_syntax ¶
Reject common RDF 1.2 negative-suite surface forms before parsing.
rdflib is intentionally liberal in places and not yet complete for RDF 1.2 triple terms / directional language syntax. These checks mirror the surface guards Eyeling uses for the W3C RDF 1.2 syntax tests.
Source code in pyling/rdf.py
triple_from_rdflib ¶
Convert an RDFLib triple-like tuple into a Pyling triple.
Source code in pyling/rdf.py
parse_rdf_graph ¶
Convert an RDFLib Graph or Dataset into an Eyeling Document.
Source code in pyling/rdf.py
document_from_rdflib ¶
triple_to_rdflib ¶
Convert an ordinary Pyling triple into an RDFLib triple tuple.
Source code in pyling/rdf.py
triples_to_rdflib_graph ¶
triples_to_rdflib_graph(triples: Iterable[Triple], prefixes: PrefixEnv | None = None, *, graph: Graph | None = None) -> Graph
Convert ordinary pyling triples into an RDFLib Graph.
Formula terms, lists, open lists, and variables are intentionally rejected: they are Notation3 structures and do not have a lossless representation in a normal RDFLib Graph.
Source code in pyling/rdf.py
document_to_rdflib ¶
document_to_rdflib(document: Document, *, graph: Graph | None = None, include_input_facts: bool = True) -> Graph
Convert a Pyling Document's ordinary fact triples into an RDFLib Graph.
Rules, formulas, lists, open lists, and variables are still rejected by
triples_to_rdflib_graph because they do not have a lossless ordinary
RDFLib Graph representation.
Source code in pyling/rdf.py
parse_rdf_text ¶
parse_rdf_text(text: str, *, format: str | None = None, base_iri: str | None = None, rdf12: bool = True, label: str | None = None) -> Document
Parse RDF/Turtle/TriG/N-Triples/N-Quads text into an Eyeling Document.
Source code in pyling/rdf.py
parse_rdf_message_log ¶
parse_rdf_message_log(text: str, *, base_iri: str | None = None, label: str | None = None) -> Document
Parse a whole RDF Message Log into Eyeling's replay vocabulary.
Source code in pyling/rdf.py
iter_rdf_message_documents ¶
Yield one replay document per RDF Message Log message.