本文整理了Java中com.baidu.hugegraph.backend.query.Query.ids
方法的一些代码示例,展示了Query.ids
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.ids
方法的具体详情如下:
包路径:com.baidu.hugegraph.backend.query.Query
类名称:Query
方法名:ids
暂无
代码示例来源:origin: hugegraph/hugegraph
public boolean empty() {
return this.ids().isEmpty() && this.conditions().isEmpty();
}
代码示例来源:origin: hugegraph/hugegraph
@Override
public int hashCode() {
return this.resultType.hashCode() ^
this.orders.hashCode() ^
Long.hashCode(this.offset) ^
Long.hashCode(this.limit) ^
Objects.hashCode(this.page) ^
this.ids().hashCode() ^
this.conditions().hashCode();
}
代码示例来源:origin: hugegraph/hugegraph
@Override
public boolean equals(Object object) {
if (!(object instanceof Query)) {
return false;
}
Query other = (Query) object;
return this.resultType.equals(other.resultType) &&
this.orders.equals(other.orders) &&
this.offset == other.offset &&
this.limit == other.limit &&
((this.page == null && other.page == null) ||
this.page.equals(other.page)) &&
this.ids().equals(other.ids()) &&
this.conditions().equals(other.conditions());
}
代码示例来源:origin: hugegraph/hugegraph
@Override
protected Iterator<HugeVertex> queryVerticesFromBackend(Query query) {
if (!query.ids().isEmpty() && query.conditions().isEmpty()) {
return this.queryVerticesByIds((IdQuery) query);
} else {
return super.queryVerticesFromBackend(query);
}
}
代码示例来源:origin: hugegraph/hugegraph
protected List<Select> queryId2Select(Query query, Select select) {
if (query.ids().isEmpty()) {
return ImmutableList.of(select);
List<List<Object>> ids = new ArrayList<>(query.ids().size());
for (Id id : query.ids()) {
List<Object> idParts = this.idColumnValue(id);
if (nameParts.size() != idParts.size()) {
代码示例来源:origin: hugegraph/hugegraph
protected List<StringBuilder> queryId2Select(Query query,
StringBuilder select) {
if (query.ids().isEmpty()) {
return ImmutableList.of(select);
List<List<Object>> ids = new ArrayList<>(query.ids().size());
for (Id id : query.ids()) {
List<Object> idParts = this.idColumnValue(id);
if (nameParts.size() != idParts.size()) {
代码示例来源:origin: hugegraph/hugegraph
protected Iterator<HugeEdge> queryEdgesFromBackend(Query query) {
assert query.resultType().isEdge();
Iterator<BackendEntry> entries = this.query(query);
return new FlatMapperIterator<>(entries, entry -> {
// Edges are in a vertex
HugeVertex vertex = this.serializer.readVertex(graph(), entry);
assert vertex != null;
if (query.ids().size() == 1) {
assert vertex.getEdges().size() == 1;
}
// Copy to avoid ConcurrentModificationException when removing edge
return ImmutableList.copyOf(vertex.getEdges()).iterator();
});
}
代码示例来源:origin: hugegraph/hugegraph
if (!query.ids().isEmpty()) {
throw new BackendException("Not supported query edge by id " +
"and by condition at the same time");
if (query instanceof IdQuery && !query.ids().isEmpty()) {
IdQuery result = (IdQuery) query.copy();
result.resetIds();
for (Id id : query.ids()) {
result.query(this.writeQueryId(type, id));
代码示例来源:origin: hugegraph/hugegraph
assert !query.ids().isEmpty();
RowIterator rowIterator = null;
if (query.ids().size() == 1) {
Id id = query.ids().iterator().next();
rowIterator = this.queryById(session, id);
} else {
rowIterator = this.queryByIds(session, query.ids());
代码示例来源:origin: hugegraph/hugegraph
if (q.getClass() == IdQuery.class && !q.ids().isEmpty()) {
ids.query(q.ids());
} else if (!q.empty()) {
代码示例来源:origin: hugegraph/hugegraph
assert !query.ids().isEmpty();
ExtendableIterator<BackendEntry> rs = new ExtendableIterator<>();
for (Id id : query.ids()) {
rs.extend(newEntryIterator(this.queryById(session, id), query));
代码示例来源:origin: hugegraph/hugegraph
if (!query.ids().isEmpty()) {
rs = this.queryById(query.ids(), rs);
代码示例来源:origin: com.baidu.hugegraph/hugegraph-core
public boolean empty() {
return this.ids().isEmpty() && this.conditions().isEmpty();
}
代码示例来源:origin: com.baidu.hugegraph/hugegraph-core
@Override
public int hashCode() {
return this.resultType.hashCode() ^
this.orders.hashCode() ^
Long.hashCode(this.offset) ^
Long.hashCode(this.limit) ^
Objects.hashCode(this.page) ^
this.ids().hashCode() ^
this.conditions().hashCode();
}
代码示例来源:origin: com.baidu.hugegraph/hugegraph-core
@Override
public boolean equals(Object object) {
if (!(object instanceof Query)) {
return false;
}
Query other = (Query) object;
return this.resultType.equals(other.resultType) &&
this.orders.equals(other.orders) &&
this.offset == other.offset &&
this.limit == other.limit &&
((this.page == null && other.page == null) ||
this.page.equals(other.page)) &&
this.ids().equals(other.ids()) &&
this.conditions().equals(other.conditions());
}
代码示例来源:origin: com.baidu.hugegraph/hugegraph-core
@Override
protected Iterator<HugeVertex> queryVerticesFromBackend(Query query) {
if (!query.ids().isEmpty() && query.conditions().isEmpty()) {
return this.queryVerticesByIds((IdQuery) query);
} else {
return super.queryVerticesFromBackend(query);
}
}
代码示例来源:origin: com.baidu.hugegraph/hugegraph-core
protected Iterator<HugeEdge> queryEdgesFromBackend(Query query) {
assert query.resultType().isEdge();
Iterator<BackendEntry> entries = this.query(query);
return new FlatMapperIterator<>(entries, entry -> {
// Edges are in a vertex
HugeVertex vertex = this.serializer.readVertex(graph(), entry);
assert vertex != null;
if (query.ids().size() == 1) {
assert vertex.getEdges().size() == 1;
}
// Copy to avoid ConcurrentModificationException when removing edge
return ImmutableList.copyOf(vertex.getEdges()).iterator();
});
}
代码示例来源:origin: com.baidu.hugegraph/hugegraph-core
if (!query.ids().isEmpty()) {
throw new BackendException("Not supported query edge by id " +
"and by condition at the same time");
if (query instanceof IdQuery && !query.ids().isEmpty()) {
IdQuery result = (IdQuery) query.copy();
result.resetIds();
for (Id id : query.ids()) {
result.query(this.writeQueryId(type, id));
代码示例来源:origin: com.baidu.hugegraph/hugegraph-rocksdb
@Override
public Iterator<BackendEntry> query(Session session, Query query) {
if (query.limit() == 0 && query.limit() != Query.NO_LIMIT) {
LOG.debug("Return empty result(limit=0) for query {}", query);
return ImmutableList.<BackendEntry>of().iterator();
}
// Query all
if (query.empty()) {
return newEntryIterator(this.queryAll(session, query), query);
}
// Query by id
if (query.conditions().isEmpty()) {
assert !query.ids().isEmpty();
ExtendableIterator<BackendEntry> rs = new ExtendableIterator<>();
for (Id id : query.ids()) {
rs.extend(newEntryIterator(this.queryById(session, id), query));
}
return rs;
}
// Query by condition (or condition + id)
ConditionQuery cq = (ConditionQuery) query;
return newEntryIterator(this.queryByCond(session, cq), query);
}
代码示例来源:origin: com.baidu.hugegraph/hugegraph-core
/**
* Mapping query-type to table-type
* @param query origin query
* @return corresponding table type
*/
public static HugeType tableType(Query query) {
HugeType type = query.resultType();
// Mapping EDGE to EDGE_OUT/EDGE_IN
if (type == HugeType.EDGE) {
// We assume query OUT edges
type = HugeType.EDGE_OUT;
if (!query.ids().isEmpty() && query instanceof IdQuery &&
query.originQuery() != null) {
/*
* Some backends may trans ConditionQuery to IdQuery like
* RocksDB, so we should get the origin query
*/
query = query.originQuery();
}
if (!query.conditions().isEmpty() &&
query instanceof ConditionQuery) {
ConditionQuery cq = (ConditionQuery) query;
// Does query IN edges
if (cq.condition(HugeKeys.DIRECTION) == Directions.IN) {
type = HugeType.EDGE_IN;
}
}
}
return type;
}
内容来源于网络,如有侵权,请联系作者删除!