hydra.pg.rdf.mappings module

Mappings from property graph schemas to SHACL shapes graphs, and from property graph data to RDF graphs.

hydra.pg.rdf.mappings.edge_types_to_property_shapes(encode_vertex_label: T0, encode_edge_label: Callable[[EdgeLabel], Iri], vertex_label: VertexLabel, edge_types: Sequence[EdgeType[T1]]) Sequence[CommonConstraint]

Convert edge types into property shape constraints for a given vertex label.

hydra.pg.rdf.mappings.encode_edge(env: PgRdfEnvironment[T0], edge: Edge[T0]) Description

Encode a property graph edge as an RDF description.

hydra.pg.rdf.mappings.encode_lazy_graph(env: PgRdfEnvironment[T0], lg: LazyGraph[T0]) Graph

Encode a lazy property graph as an RDF graph.

hydra.pg.rdf.mappings.encode_vertex(env: PgRdfEnvironment[T0], vertex: Vertex[T0]) Description

Encode a property graph vertex as an RDF description.

hydra.pg.rdf.mappings.graph_schema_to_shapes_graph(encode_type: Callable[[T0], Iri], encode_vertex_label: Callable[[VertexLabel], Iri], encode_edge_label: Callable[[EdgeLabel], Iri], encode_key: Callable[[PropertyKey], Iri], schema: GraphSchema[T0]) ShapesGraph

Convert a property graph schema to a SHACL shapes graph.

hydra.pg.rdf.mappings.property_type_to_property_shape(encode_type: Callable[[T0], Iri], encode_key: Callable[[PropertyKey], Iri], pt: PropertyType[T0]) PropertyShape

Convert a property type to a SHACL property shape.

hydra.pg.rdf.mappings.vertex_type_to_node_shape(encode_type: Callable[[T0], Iri], encode_label: Callable[[VertexLabel], Iri], encode_key: Callable[[PropertyKey], Iri], vt: VertexType[T0]) Definition[Shape]

Convert a vertex type to a SHACL node shape definition.