// TODO unit test that static boolean removeEdge(Graph graph, Relationship relationship) { Edge edge = graph.getEdge(relationship.getId()); if (null != edge) { graph.removeEdge(edge); return true; } else { return false; } }
static Edge addEdge(Graph graph, Edge edge) { Edge newEdge = graph.getEdge(edge.getId()); if (null == newEdge) { Vertex outVertex = addNode(graph, edge.getVertex(Direction.OUT)); Vertex inVertex = addNode(graph, edge.getVertex(Direction.IN)); String label = edge.getLabel(); newEdge = graph.addEdge(edge.getId(), outVertex, inVertex, label); copyProperties(edge, edge); } return newEdge; }
static Edge addEdge(Graph graph, Relationship relationship) { Edge edge = graph.getEdge(relationship.getId()); if (null == edge) { Vertex outVertex = addNode(graph, relationship.getStartNode()); Vertex inVertex = addNode(graph, relationship.getEndNode()); String label = relationship.getType().name(); // TODO #152 add CurieUtil to resolve IRI to Curie edge = graph.addEdge(relationship.getId(), outVertex, inVertex, label); copyProperties(relationship, edge); } return edge; }