public Iterable<Vertex> getVertices(final String iKey, Object iValue) { if (iKey.equals("@class")) return getVerticesOfClass(iValue.toString()); final String indexName; final String key; int pos = iKey.indexOf('.'); if (pos > -1) { indexName = iKey; key = iKey.substring(iKey.indexOf('.') + 1); } else { indexName = OrientVertex.CLASS_NAME + "." + iKey; key = iKey; } final OIndex<?> idx = getContext(true).rawGraph.getMetadata() .getIndexManager().getIndex(indexName); if (idx != null) { iValue = convertKey(idx, iValue); Object indexValue = idx.get(iValue); if (indexValue != null && !(indexValue instanceof Iterable<?>)) indexValue = Arrays.asList(indexValue); return new OrientElementIterable<Vertex>(this, (Iterable<?>) indexValue); } // NO INDEX: EXECUTE A QUERY return query().has(key, iValue).vertices(); }
public Iterable<Edge> getEdges(final String iKey, Object iValue) { if (iKey.equals("@class")) return getEdgesOfClass(iValue.toString()); final String indexName; final String key; int pos = iKey.indexOf('.'); if (pos > -1) { indexName = iKey; key = iKey.substring(iKey.indexOf('.') + 1); } else { indexName = OrientEdge.CLASS_NAME + "." + iKey; key = iKey; } final OIndex<?> idx = getContext(true).rawGraph.getMetadata() .getIndexManager().getIndex(indexName); if (idx != null) { iValue = convertKey(idx, iValue); Object indexValue = (Iterable<?>) idx.get(iValue); if (indexValue != null && !(indexValue instanceof Iterable<?>)) indexValue = Arrays.asList(indexValue); return new OrientElementIterable<Edge>(this, (Iterable<?>) indexValue); } // NO INDEX: EXECUTE A QUERY return query().has(key, iValue).edges(); }
iValue = convertKey(idx, iValue);
iValue = convertKey(idx, iValue);
iValue = convertKey(idx, iValue); Object indexValue = idx.get(iValue); if (indexValue != null && !(indexValue instanceof Iterable<?>))