hydra.neo4j.pg module
A mapping between Hydra’s property-graph model (hydra.pg.model, TinkerPop-shaped) and the Neo4j model (hydra.neo4j.model). It is not an isomorphism and not invertible: ids and values are bridged by caller-supplied conversions (Neo4jMapping); a Neo4j relationship type expands into a property-graph edge label conditionally on the schema; and multi-label nodes, which Hydra’s single-label vertices cannot represent, are rejected.
- hydra.neo4j.pg.edge_label_for_relationship(gt: GraphType, start_label: NodeLabel, end_label: NodeLabel, rel_type: RelationshipType) EdgeLabel
Compute the property-graph edge label for a Neo4j relationship type, given the schema and endpoint labels.
- hydra.neo4j.pg.edge_to_relationship(mapping: Neo4jMapping[T0], edge: Edge[T0]) object
Convert a property-graph edge to a Neo4j relationship (edge label -> UPPER_SNAKE type).
- hydra.neo4j.pg.graph_to_neo4j(mapping: Neo4jMapping[T0], graph: Graph[T0]) object
Convert a whole property-graph Graph to a Neo4j graph (nodes and relationships).
- hydra.neo4j.pg.neo4j_to_graph(mapping: Neo4jMapping[T0], gt: GraphType, nodes: Sequence[Node_], rels: Sequence[Relationship]) object
Convert a Neo4j graph (nodes and relationships) to property-graph vertices and edges against a GraphType.
- hydra.neo4j.pg.node_to_vertex(mapping: Neo4jMapping[T0], node: Node_) object
Convert a Neo4j node to a property-graph vertex; fails on a multi-label node.
- hydra.neo4j.pg.relationship_to_edge(mapping: Neo4jMapping[T0], gt: GraphType, start_label: NodeLabel, end_label: NodeLabel, rel: Relationship) object
Convert a Neo4j relationship to a property-graph edge, expanding the type via the schema and endpoint labels.
- hydra.neo4j.pg.vertex_to_node(mapping: Neo4jMapping[T0], vertex: Vertex[T0]) object
Convert a property-graph vertex to a Neo4j node (single label -> singleton label set).