rdfoo.rdf

RDF Core Object

Functions

rdfoo.rdf.RDFId(default=None)

Helper function to create an rdf_id field with a default value.

rdfoo.rdf.uri(uri: str)

Helper function to create an URI that references a resource.

Classes

class rdfoo.rdf.RDF

Bases: BaseModel

Base class for RDF objects.

This class provides the to_graph method that allows to generate an RDF graph for any of its subclasses. It also provides the from_graph method to construct an object described in a graph.

rdf_id: str | None
rdf_type: RDFType
rdf_bindings: list[tuple[str, str]]

[[binding1, namespace1], [binding2, namespace2]]

has_type(type: RDFType) bool
to_dict(rdf_id: str | None = None) dict
to_graph(node: Node | None = None, graph: Graph | None = None) Graph
abstractmethod classmethod from_graph(id: str | Node, graph: Graph) T
classmethod get_rdf_type(*, extra: RDFType = []) RDFType
classmethod get_rdf_bindings(extra: RDFType = []) RDFType
class rdfoo.rdf.RDFURIRef

Bases: BaseModel, Generic

Reference to a resource.

This class is used to distinguish between a URI and a string literal.

uri: str