public IdQuery query(Set<Id> ids) { for (Id id : ids) { this.query(id); } return this; }
public IdQuery(HugeType resultType, Set<Id> ids) { this(resultType); this.query(ids); }
public IdQuery(HugeType resultType, Id id) { this(resultType); this.query(id); }
public IdQuery(Query originQuery, Set<Id> ids) { this(originQuery.resultType(), originQuery); this.query(ids); }
public IdQuery(Query originQuery, Id id) { this(originQuery.resultType(), originQuery); this.query(id); }
private Iterator<HugeVertex> queryVerticesByIds(IdQuery query) { IdQuery newQuery = new IdQuery(HugeType.VERTEX, query); List<HugeVertex> vertices = new ArrayList<>(query.ids().size()); for (Id vertexId : query.ids()) { Object vertex = this.verticesCache.get(vertexId); if (vertex != null) { vertices.add((HugeVertex) vertex); } else { newQuery.query(vertexId); } } if (vertices.isEmpty()) { // Just use the origin query if find none from the cache newQuery = query; } if (!newQuery.empty()) { Iterator<HugeVertex> rs = super.queryVerticesFromBackend(newQuery); while (rs.hasNext()) { HugeVertex vertex = rs.next(); vertices.add(vertex); this.verticesCache.update(vertex.id(), vertex); } } return vertices.iterator(); }
} else { query.query(id);
} else { query.query(id);
public ConditionQuery query(Condition condition) { // Query by id (HugeGraph-259) if (condition instanceof Relation) { Relation relation = (Relation) condition; if (relation.key().equals(HugeKeys.ID) && relation.relation() == RelationType.EQ) { E.checkArgument(relation.value() instanceof Id, "Invalid id value '%s'", relation.value()); super.query((Id) relation.value()); return this; } } this.conditions.add(condition); return this; }
ids.query(q.ids()); } else if (!q.empty()) {
result.resetIds(); for (Id id : query.ids()) { result.query(this.writeQueryId(type, id));
public IdQuery(HugeType resultType, Id id) { this(resultType); this.query(id); }
public IdQuery query(Set<Id> ids) { for (Id id : ids) { this.query(id); } return this; }
@Watched(prefix = "index") private Iterator<BackendEntry> queryByName(ConditionQuery query) { if (!this.needIndexForName()) { return super.query(query); } IndexLabel il = IndexLabel.label(query.resultType()); String name = (String) query.condition(HugeKeys.NAME); E.checkState(name != null, "The name in condition can't be null " + "when querying schema by name"); ConditionQuery indexQuery; indexQuery = new ConditionQuery(HugeType.SECONDARY_INDEX, query); indexQuery.eq(HugeKeys.FIELD_VALUES, name); indexQuery.eq(HugeKeys.INDEX_LABEL_ID, il.id()); Iterator<BackendEntry> entries = super.query(indexQuery); IdQuery idQuery = new IdQuery(query.resultType(), query); while (entries.hasNext()) { HugeIndex index = this.serializer.readIndex(graph(), indexQuery, entries.next()); idQuery.query(index.elementIds()); } if (idQuery.ids().isEmpty()) { return Collections.emptyIterator(); } assert idQuery.ids().size() == 1 : idQuery.ids(); return super.query(idQuery); } }
public IdQuery(HugeType resultType, Set<Id> ids) { this(resultType); this.query(ids); }
public IdQuery(Query originQuery, Id id) { this(originQuery.resultType(), originQuery); this.query(id); }
public IdQuery(Query originQuery, Set<Id> ids) { this(originQuery.resultType(), originQuery); this.query(ids); }
private Iterator<HugeVertex> queryVerticesByIds(IdQuery query) { IdQuery newQuery = new IdQuery(HugeType.VERTEX, query); List<HugeVertex> vertices = new ArrayList<>(query.ids().size()); for (Id vertexId : query.ids()) { Object vertex = this.verticesCache.get(vertexId); if (vertex != null) { vertices.add((HugeVertex) vertex); } else { newQuery.query(vertexId); } } if (vertices.isEmpty()) { // Just use the origin query if find none from the cache newQuery = query; } if (!newQuery.empty()) { Iterator<HugeVertex> rs = super.queryVerticesFromBackend(newQuery); while (rs.hasNext()) { HugeVertex vertex = rs.next(); vertices.add(vertex); this.verticesCache.update(vertex.id(), vertex); } } return vertices.iterator(); }
public ConditionQuery query(Condition condition) { // Query by id (HugeGraph-259) if (condition instanceof Relation) { Relation relation = (Relation) condition; if (relation.key().equals(HugeKeys.ID) && relation.relation() == RelationType.EQ) { E.checkArgument(relation.value() instanceof Id, "Invalid id value '%s'", relation.value()); super.query((Id) relation.value()); return this; } } this.conditions.add(condition); return this; }
result.resetIds(); for (Id id : query.ids()) { result.query(this.writeQueryId(type, id));