public <T extends Element> Set<String> getIndexedKeys(Class<T> elementClass) { return ((KeyIndexableGraph) this.baseGraph).getIndexedKeys(elementClass); } }
protected Set<String> getIndexedKeys(final Class<? extends Element> elementClass) { return ((KeyIndexableGraph) graph).getIndexedKeys(elementClass); }
private void createIndices() { if (supportVertexIds && !baseGraph.getIndexedKeys(Vertex.class).contains(ID)) { baseGraph.createKeyIndex(ID, Vertex.class); } if (supportEdgeIds && !baseGraph.getIndexedKeys(Edge.class).contains(ID)) { baseGraph.createKeyIndex(ID, Edge.class); } }
@Nonnull @Override public <E extends Element> Set<String> getIndexedKeys(Class<E> elementClass) { checkNotNull(elementClass, "elementClass"); Set<String> keys = new HashSet<>(baseGraph.getIndexedKeys(elementClass)); keys.remove(ID); return keys; }
public <T extends Element> Set<String> getIndexedKeys(final Class<T> elementClass) { if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); boolean v = isVertexClass(elementClass); boolean supported = ((v && supportVertexIds) || (!v && supportEdgeIds)); if (supported) { Set<String> keys = new HashSet<String>(); keys.addAll(baseGraph.getIndexedKeys(elementClass)); keys.remove(ID); return keys; } else { return baseGraph.getIndexedKeys(elementClass); } }
@Override public <T extends Element> Set<String> getIndexedKeys(final Class<T> elementClass) { final Set<String> keys = new HashSet<String>(); keys.addAll(getEventableGraph().getBaseGraph().getIndexedKeys(elementClass)); keys.remove(VEProps.NATURAL_VERTEX_ID_PROP_KEY); keys.remove(VEProps.NATURAL_EDGE_ID_PROP_KEY); return keys; }
protected void doIndices(Graph baseGraph) { if (baseGraph instanceof KeyIndexableGraph) { KeyIndexableGraph kig = (KeyIndexableGraph) baseGraph; for (Class<? extends Element> clazz : Arrays.asList(Vertex.class, Edge.class)) { Set<String> indexedKeys = kig.getIndexedKeys(clazz); if (!indexedKeys.contains(AgroEntity.PROP_URI)) { //FIXME: can't make it a unique index yet, Farm and FarmID vertices share URI createKeyIndex(kig, AgroEntity.PROP_URI, clazz); // createUniqueKeyIndex(kig, Entity.PROP_URI, clazz); } if (!indexedKeys.contains(AgroEntity.PROP_ITEM_ID_TYPE)) { createKeyIndex(kig, AgroEntity.PROP_ITEM_ID_TYPE, clazz); } if (!indexedKeys.contains(AgroEntity.PROP_PARENT_URI)) { createKeyIndex(kig, AgroEntity.PROP_PARENT_URI, clazz); } //TODO: farm uri and/or partition key } } }
/** * Adds custom ID functionality to the given graph, supporting either custom vertex IDs, custom edge IDs, or both. * * @param baseGraph the base graph which does not necessarily support custom IDs * @param supportVertexIds whether to support custom vertex IDs * @param supportEdgeIds whether to support custom edge IDs */ public IdGraph(KeyIndexableGraph baseGraph, boolean supportVertexIds, boolean supportEdgeIds) { this.baseGraph = checkNotNull(baseGraph, "baseGraph"); this.supportVertexIds = supportVertexIds; this.supportEdgeIds = supportEdgeIds; checkArgument(supportVertexIds || supportEdgeIds, "If neither custom vertex IDs nor custom edge IDs are supported, IdGraph can't help you!"); // Create indices if (supportVertexIds && !baseGraph.getIndexedKeys(Vertex.class).contains(ID)) { baseGraph.createKeyIndex(ID, Vertex.class); } if (supportEdgeIds && !baseGraph.getIndexedKeys(Edge.class).contains(ID)) { baseGraph.createKeyIndex(ID, Edge.class); } features = baseGraph.getFeatures().copyFeatures(); features.isWrapper = true; features.ignoresSuppliedIds = false; }
if (((KeyIndexableGraph) delegate).getIndexedKeys(Vertex.class).contains(key)) {
if (!keyIndexedGraph.getIndexedKeys(Vertex.class).contains(VEProps.NATURAL_VERTEX_ID_PROP_KEY)) { keyIndexedGraph.createKeyIndex(VEProps.NATURAL_VERTEX_ID_PROP_KEY, Vertex.class); if (!keyIndexedGraph.getIndexedKeys(Edge.class).contains(VEProps.NATURAL_EDGE_ID_PROP_KEY)) { keyIndexedGraph.createKeyIndex(VEProps.NATURAL_EDGE_ID_PROP_KEY, Edge.class);