@Override public String label() { this.graph.tx().readWrite(); return String.join(LABEL_DELIMINATOR, this.labels()); }
@Override public String label() { this.graph.tx().readWrite(); return String.join(LABEL_DELIMINATOR, this.labels()); }
@Override public ValidationResult check(Vertex vertex) { if (!(vertex instanceof Neo4jVertex)) { return new ElementValidationResult(false, "Is not a Neo4jVertex."); } if (vertex.property("types").isPresent()) { Set<String> types = new HashSet<>(Arrays.asList(getEntityTypes(vertex) .orElseGet(() -> Try.success(new String[0])) .getOrElse(() -> new String[0]))); Sets.SetView<String> difference = Sets.difference(types, ((Neo4jVertex) vertex).labels()); if (!difference.isEmpty()) { return new ElementValidationResult( false, String.format("Vertex with tim_id %s misses labels %s\n", getProp(vertex, "tim_id", String.class).orElse("<UNKNOWN>"), difference ) ); } } return new ElementValidationResult(true, String.format("Vertex with tim_id %s is valid.", getProp(vertex, "tim_id", String.class).orElse("<UNKNOWN>")) ); }
public static Vertex duplicateVertex(GraphTraversalSource traversal, Vertex vertex, IndexHandler indexHandler) { Vertex duplicate = traversal.addV().next(); for (Iterator<VertexProperty<Object>> properties = vertex.properties(); properties.hasNext(); ) { VertexProperty<Object> property = properties.next(); duplicate.property(property.key(), property.value()); } for (String label : ((Neo4jVertex) vertex).labels()) { ((Neo4jVertex) duplicate).addLabel(label); } moveIncomingEdges(vertex, duplicate, indexHandler); moveOutgoingEdges(vertex, duplicate, indexHandler); vertex.property(IS_LATEST, false); duplicate.property(IS_LATEST, true); vertex.addEdge(VERSION_OF, duplicate); return duplicate; }