Exemplo n.º 1
0
 // 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;
   }
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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;
 }