public static boolean isTransientVertexComputeKey(final String key, final Set<VertexComputeKey> vertexComputeKeySet) { for (final VertexComputeKey vertexComputeKey : vertexComputeKeySet) { if (vertexComputeKey.getKey().equals(key)) return vertexComputeKey.isTransient(); } throw new IllegalArgumentException("Could not find key in vertex compute key set: " + key); }
@Override public Set<VertexComputeKey> getVertexComputeKeys() { return new HashSet<>(Collections.singletonList(VertexComputeKey.of(DEGREE, false))); }
public static VertexComputeKey of(final String key, final boolean isTransient) { return new VertexComputeKey(key, isTransient); } }
try { for (VertexComputeKey key : vertexProgram.getVertexComputeKeys()) { if (!management.containsPropertyKey(key.getKey())) log.warn("Property key [{}] is not part of the schema and will be created. It is advised to initialize all keys.", key.getKey()); management.getOrCreatePropertyKey(key.getKey());
public Set<String> getMemoryKeys() { return computeKeys.stream().filter(key -> inExecute || !key.isTransient()).map(VertexComputeKey::getKey).collect(Collectors.toSet()); }
public static Set<String> vertexComputeKeysAsSet(final Set<VertexComputeKey> vertexComputeKeySet) { final Set<String> set = new HashSet<>(vertexComputeKeySet.size()); for (final VertexComputeKey key : vertexComputeKeySet) { set.add(key.getKey()); } return set; }
protected void complete() { // remove all transient properties from the vertices for (final VertexComputeKey computeKey : this.computeKeys.values()) { if (computeKey.isTransient()) { for (final Map<String, List<VertexProperty<?>>> properties : this.computeProperties.values()) { properties.remove(computeKey.getKey()); } } } }
public TinkerGraphComputerView(final TinkerGraph graph, final GraphFilter graphFilter, final Set<VertexComputeKey> computeKeys) { this.graph = graph; this.computeKeys = new HashMap<>(); computeKeys.forEach(key -> this.computeKeys.put(key.getKey(), key)); this.computeProperties = new ConcurrentHashMap<>(); this.graphFilter = graphFilter; if (this.graphFilter.hasFilter()) { graph.vertices().forEachRemaining(vertex -> { boolean legalVertex = false; if (this.graphFilter.hasVertexFilter() && this.graphFilter.legalVertex(vertex)) { this.legalVertices.add(vertex.id()); legalVertex = true; } if ((legalVertex || !this.graphFilter.hasVertexFilter()) && this.graphFilter.hasEdgeFilter()) { final Set<Object> edges = new HashSet<>(); this.legalEdges.put(vertex.id(), edges); this.graphFilter.legalEdges(vertex).forEachRemaining(edge -> edges.add(edge.id())); } }); } }
public static VertexComputeKey of(final String key, final boolean isTransient) { return new VertexComputeKey(key, isTransient); } }
public static boolean isTransientVertexComputeKey(final String key, final Set<VertexComputeKey> vertexComputeKeySet) { for (final VertexComputeKey vertexComputeKey : vertexComputeKeySet) { if (vertexComputeKey.getKey().equals(key)) return vertexComputeKey.isTransient(); } throw new IllegalArgumentException("Could not find key in vertex compute key set: " + key); }
public static Set<String> vertexComputeKeysAsSet(final Set<VertexComputeKey> vertexComputeKeySet) { final Set<String> set = new HashSet<>(vertexComputeKeySet.size()); for (final VertexComputeKey key : vertexComputeKeySet) { set.add(key.getKey()); } return set; }
@Override public Set<VertexComputeKey> getVertexComputeKeys() { return Collections.singleton(VertexComputeKey.of("counter", false)); }
protected void complete() { // remove all transient properties from the vertices for (final VertexComputeKey computeKey : this.computeKeys.values()) { if (computeKey.isTransient()) { for (final Map<String, List<VertexProperty<?>>> properties : this.computeProperties.values()) { properties.remove(computeKey.getKey()); } } } }
public TinkerGraphComputerView(final TinkerGraph graph, final GraphFilter graphFilter, final Set<VertexComputeKey> computeKeys) { this.graph = graph; this.computeKeys = new HashMap<>(); computeKeys.forEach(key -> this.computeKeys.put(key.getKey(), key)); this.computeProperties = new ConcurrentHashMap<>(); this.graphFilter = graphFilter; if (this.graphFilter.hasFilter()) { graph.vertices().forEachRemaining(vertex -> { boolean legalVertex = false; if (this.graphFilter.hasVertexFilter() && this.graphFilter.legalVertex(vertex)) { this.legalVertices.add(vertex.id()); legalVertex = true; } if ((legalVertex || !this.graphFilter.hasVertexFilter()) && this.graphFilter.hasEdgeFilter()) { final Set<Object> edges = new HashSet<>(); this.legalEdges.put(vertex.id(), edges); this.graphFilter.legalEdges(vertex).forEachRemaining(edge -> edges.add(edge.id())); } }); } }
protected void complete() { // remove all transient properties from the vertices for (final VertexComputeKey computeKey : this.computeKeys.values()) { if (computeKey.isTransient()) { for (final Map<String, List<VertexProperty<?>>> properties : this.computeProperties.values()) { properties.remove(computeKey.getKey()); } } } }
public TinkerGraphComputerView(final TinkerGraph graph, final GraphFilter graphFilter, final Set<VertexComputeKey> computeKeys) { this.graph = graph; this.computeKeys = new HashMap<>(); computeKeys.forEach(key -> this.computeKeys.put(key.getKey(), key)); this.computeProperties = new ConcurrentHashMap<>(); this.graphFilter = graphFilter; if (this.graphFilter.hasFilter()) { graph.vertices().forEachRemaining(vertex -> { boolean legalVertex = false; if (this.graphFilter.hasVertexFilter() && this.graphFilter.legalVertex(vertex)) { this.legalVertices.add(vertex.id()); legalVertex = true; } if ((legalVertex || !this.graphFilter.hasVertexFilter()) && this.graphFilter.hasEdgeFilter()) { final Set<Object> edges = new HashSet<>(); this.legalEdges.put(vertex.id(), edges); this.graphFilter.legalEdges(vertex).forEachRemaining(edge -> edges.add(edge.id())); } }); } }
@Override public Set<VertexComputeKey> getVertexComputeKeys() { return Collections.singleton(VertexComputeKey.of("nameLengthCounter", false)); }