Package hydra.neo4j
Interface Pg
-
public interface PgA 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.
-
-
Method Summary
Static Methods Modifier and Type Method Description static EdgeLabeledgeLabelForRelationship(GraphType gt, NodeLabel startLabel, NodeLabel endLabel, RelationshipType relType)Compute the property-graph edge label for a Neo4j relationship type, given the schema and endpoint labels.static <T0> Either<java.lang.String,Relationship>edgeToRelationship(Neo4jMapping<T0> mapping, Edge<T0> edge)Convert a property-graph edge to a Neo4j relationship (edge label -> UPPER_SNAKE type).static <T0> Either<java.lang.String,Pair<java.util.List<Node>,java.util.List<Relationship>>>graphToNeo4j(Neo4jMapping<T0> mapping, Graph<T0> graph)Convert a whole property-graph Graph to a Neo4j graph (nodes and relationships).static <T0> Either<java.lang.String,Pair<java.util.List<Vertex<T0>>,java.util.List<Edge<T0>>>>neo4jToGraph(Neo4jMapping<T0> mapping, GraphType gt, java.util.List<Node> nodes, java.util.List<Relationship> rels)Convert a Neo4j graph (nodes and relationships) to property-graph vertices and edges against a GraphType.static <T0> Either<java.lang.String,Vertex<T0>>nodeToVertex(Neo4jMapping<T0> mapping, Node node)Convert a Neo4j node to a property-graph vertex; fails on a multi-label node.static <T0> Either<java.lang.String,Edge<T0>>relationshipToEdge(Neo4jMapping<T0> mapping, GraphType gt, NodeLabel startLabel, NodeLabel endLabel, Relationship rel)Convert a Neo4j relationship to a property-graph edge, expanding the type via the schema and endpoint labels.static <T0> Either<java.lang.String,Node>vertexToNode(Neo4jMapping<T0> mapping, Vertex<T0> vertex)Convert a property-graph vertex to a Neo4j node (single label -> singleton label set).
-
-
-
Method Detail
-
edgeLabelForRelationship
static EdgeLabel edgeLabelForRelationship(GraphType gt, NodeLabel startLabel, NodeLabel endLabel, RelationshipType relType)
Compute the property-graph edge label for a Neo4j relationship type, given the schema and endpoint labels.
-
edgeToRelationship
static <T0> Either<java.lang.String,Relationship> edgeToRelationship(Neo4jMapping<T0> mapping, Edge<T0> edge)
Convert a property-graph edge to a Neo4j relationship (edge label -> UPPER_SNAKE type).
-
graphToNeo4j
static <T0> Either<java.lang.String,Pair<java.util.List<Node>,java.util.List<Relationship>>> graphToNeo4j(Neo4jMapping<T0> mapping, Graph<T0> graph)
Convert a whole property-graph Graph to a Neo4j graph (nodes and relationships).
-
neo4jToGraph
static <T0> Either<java.lang.String,Pair<java.util.List<Vertex<T0>>,java.util.List<Edge<T0>>>> neo4jToGraph(Neo4jMapping<T0> mapping, GraphType gt, java.util.List<Node> nodes, java.util.List<Relationship> rels)
Convert a Neo4j graph (nodes and relationships) to property-graph vertices and edges against a GraphType.
-
nodeToVertex
static <T0> Either<java.lang.String,Vertex<T0>> nodeToVertex(Neo4jMapping<T0> mapping, Node node)
Convert a Neo4j node to a property-graph vertex; fails on a multi-label node.
-
relationshipToEdge
static <T0> Either<java.lang.String,Edge<T0>> relationshipToEdge(Neo4jMapping<T0> mapping, GraphType gt, NodeLabel startLabel, NodeLabel endLabel, Relationship rel)
Convert a Neo4j relationship to a property-graph edge, expanding the type via the schema and endpoint labels.
-
vertexToNode
static <T0> Either<java.lang.String,Node> vertexToNode(Neo4jMapping<T0> mapping, Vertex<T0> vertex)
Convert a property-graph vertex to a Neo4j node (single label -> singleton label set).
-
-