hydra.shacl.coder module
SHACL coder: converts Hydra types and terms to SHACL shapes and RDF descriptions.
- hydra.shacl.coder.common(constraints: Sequence[CommonConstraint]) CommonProperties
Construct CommonProperties from a list of constraints, using defaults for other fields.
- hydra.shacl.coder.default_common_properties() CommonProperties
Default CommonProperties with empty constraints and default severity.
- hydra.shacl.coder.encode_field(rname: Name, subject: Resource, field: Field, cx: int, g: Graph) object
Encode a record field as RDF triples with a given subject.
- hydra.shacl.coder.encode_field_type(rname: Name, order: object, ft: FieldType, cx: T0) object
Encode a FieldType as a SHACL property shape Definition.
- hydra.shacl.coder.encode_list(subj: Resource, terms: Sequence[Term], cx0: int, g: Graph) object
Encode a list of terms as RDF list structure.
- hydra.shacl.coder.encode_literal_type(lt: LiteralType) CommonProperties
Encode a LiteralType as SHACL CommonProperties with an XSD datatype constraint.
- hydra.shacl.coder.encode_term(subject: Resource, term: Term, cx: int, g: Graph) object
Encode a Hydra term as a list of RDF Descriptions.
- hydra.shacl.coder.encode_type(tname: Name, typ: Type, cx: T0) object
Encode a Hydra type as SHACL CommonProperties.
- hydra.shacl.coder.fold_accum_result(f: Callable[[T0, T1], object], cx: T0, xs: Sequence[T1]) object
Fold over a list, accumulating results and threading context through each step.
- hydra.shacl.coder.node(constraints: Sequence[CommonConstraint]) Shape
Construct a SHACL node shape from a list of common constraints.
- hydra.shacl.coder.property(iri: Iri) PropertyShape
Construct a default property shape with the given IRI as its path.
- hydra.shacl.coder.shacl_coder(mod: Module, cx: T0, g: Graph) object
Encode a module’s type elements as a SHACL ShapesGraph.
- hydra.shacl.coder.unexpected_e(expected: str, found: str) object
Construct an error for unexpected input, given expected and found descriptions.
- hydra.shacl.coder.with_type(name: Name, desc: Description) Description
Add an rdf:type triple to an RDF Description.