hydra.validate.neo4j module

Validation functions for Neo4j property graphs.

hydra.validate.neo4j.append_finding_node(p: ValidationProfile, acc: ValidationResult[T0], finding: object) ValidationResult[T0]

Append a rule-tagged InvalidNodeError finding to a ValidationResult, classifying as error or warning per the profile and respecting maxErrors/maxWarnings bounds.

hydra.validate.neo4j.append_finding_relationship(p: ValidationProfile, acc: ValidationResult[T0], finding: object) ValidationResult[T0]

Append a rule-tagged InvalidRelationshipError finding to a ValidationResult.

hydra.validate.neo4j.default_neo4j_profile() ValidationProfile

The default (open-world) validation profile for Neo4j validation. Every rule except the closed-world noSuchLabel/noSuchType rules is classified as an error; no warnings; maxErrors=1, maxWarnings=20.

hydra.validate.neo4j.enabled_neo4j(p: ValidationProfile, rule_name: Name) bool

True iff the given rule name appears in the profile’s errorRules or warningRules.

hydra.validate.neo4j.labels_for_id(nodes: Sequence[Node_], eid: ElementId) object

Given a list of nodes, return a function from element id to that node’s labels (or nothing if no node has that id).

hydra.validate.neo4j.matches_value_type(vt: ValueType, v: Value) bool

True iff the given Value has the kind required by the given ValueType.

hydra.validate.neo4j.strict_neo4j_profile() ValidationProfile

The strict (closed-world) validation profile for Neo4j validation. Like the default, but a node or relationship that matches no element type is also an error.

hydra.validate.neo4j.validate_graph(p: ValidationProfile, gt: GraphType, nodes: Sequence[Node_], rels: Sequence[Relationship]) ValidationResult[InvalidGraphError]

Validate a Neo4j graph (nodes and relationships) against a GraphType under the given ValidationProfile, returning a ValidationResult InvalidGraphError. Each element is validated element-wise and its findings lifted into graph-level findings tagged with the element id. Cross-element uniqueness/key checks are not yet performed.

hydra.validate.neo4j.validate_node(p: ValidationProfile, gt: GraphType, el: Node_) ValidationResult[InvalidNodeError]

Validate a node against a GraphType under the given ValidationProfile, returning a ValidationResult InvalidNodeError. The node is checked against every node element type whose identifying label it carries; a node matching none is valid unless the closed-world noSuchLabel rule is enabled.

hydra.validate.neo4j.validate_relationship(p: ValidationProfile, labels_for_id: object, gt: GraphType, rel: Relationship) ValidationResult[InvalidRelationshipError]

Validate a relationship against a GraphType under the given ValidationProfile, returning a ValidationResult InvalidRelationshipError. Endpoint labels select the applicable (possibly overloaded) relationship element type; property constraints of the matched type are enforced.