本文整理了Java中com.baidu.hugegraph.backend.query.Query.conditions
方法的一些代码示例,展示了Query.conditions
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.conditions
方法的具体详情如下:
包路径:com.baidu.hugegraph.backend.query.Query
类名称:Query
方法名:conditions
暂无
代码示例来源: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
protected List<StringBuilder> queryCondition2Select(Query query,
StringBuilder select) {
// Query by conditions
Set<Condition> conditions = query.conditions();
List<StringBuilder> clauses = new ArrayList<>(conditions.size());
for (Condition condition : conditions) {
clauses.add(this.condition2Sql(condition));
}
WhereBuilder where = new WhereBuilder();
where.and(clauses);
select.append(where.build());
return ImmutableList.of(select);
}
代码示例来源: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 static boolean isQueryByLabel(Query query) {
Set<Condition> conditions = query.conditions();
if (query instanceof ConditionQuery && !conditions.isEmpty()) {
ConditionQuery cq = (ConditionQuery) query;
Id label = (Id) cq.condition(HugeKeys.LABEL);
if (label != null && cq.allSysprop() &&
conditions.size() == 1 &&
cq.containsCondition(HugeKeys.LABEL,
Condition.RelationType.EQ)) {
return true;
}
}
return false;
}
代码示例来源:origin: hugegraph/hugegraph
protected Collection<Select> queryCondition2Select(Query query,
Select select) {
// Query by conditions
Set<Condition> conditions = query.conditions();
for (Condition condition : conditions) {
Clause clause = condition2Cql(condition);
select.where(clause);
if (Clauses.needAllowFiltering(clause)) {
select.allowFiltering();
}
}
return ImmutableList.of(select);
}
代码示例来源:origin: hugegraph/hugegraph
protected void wrapPage(StringBuilder select, Query query) {
String page = query.page();
// It's the first time if page is empty
if (!page.isEmpty()) {
PageState pageState = PageState.fromString(page);
Map<HugeKeys, Object> columns = pageState.columns();
List<HugeKeys> idColumnNames = this.idColumnName();
List<Object> values = new ArrayList<>(idColumnNames.size());
for (HugeKeys key : idColumnNames) {
values.add(columns.get(key));
}
// Need add `where` to `select` when query is IdQuery
boolean startWithWhere = query.conditions().isEmpty();
WhereBuilder where = new WhereBuilder(startWithWhere);
where.gte(formatKeys(idColumnNames), values);
select.append(where.build());
}
assert query.limit() != Query.NO_LIMIT;
// Fetch `limit + 1` records for judging whether reached the last page
select.append(" limit ");
select.append(query.limit() + 1);
select.append(";");
}
代码示例来源:origin: hugegraph/hugegraph
if (query.conditions().isEmpty()) {
代码示例来源:origin: hugegraph/hugegraph
/**
* 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;
while (!(query instanceof ConditionQuery ||
query.originQuery() == null)) {
/*
* Some backends(like RocksDB) may trans ConditionQuery to
* IdQuery or IdPrefixQuery, 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;
}
代码示例来源:origin: hugegraph/hugegraph
public Query query(CassandraSessionPool.Session session, Query query) {
Set<Condition> conditions = query.conditions();
if (!(query instanceof ConditionQuery) || conditions.isEmpty()) {
return query;
}
ConditionQuery q = ((ConditionQuery) query).copy();
String name = (String) q.condition(HugeKeys.NAME);
if (name != null && q.allSysprop() && conditions.size() == 1 &&
q.containsCondition(HugeKeys.NAME, Condition.RelationType.EQ)) {
Set<Integer> ids = queryByNameIndex(session, this.table, name);
if (ids.isEmpty()) {
// Not found data with the specified label
return null;
}
q.resetConditions();
for (Integer id : ids) {
q.query(IdGenerator.of(id));
}
}
return q;
}
代码示例来源:origin: hugegraph/hugegraph
if (type.isEdge() && !query.conditions().isEmpty()) {
if (!query.ids().isEmpty()) {
throw new BackendException("Not supported query edge by id " +
if (query instanceof ConditionQuery && !query.conditions().isEmpty()) {
query = this.writeQueryCondition(query);
代码示例来源:origin: hugegraph/hugegraph
/**
* Query data from label index table if just want to query by label
*/
private static Query queryByLabelIndex(
CassandraSessionPool.Session session,
String table, Query query) {
Set<Condition> conditions = query.conditions();
if (!(query instanceof ConditionQuery) || conditions.isEmpty()) {
return query;
}
ConditionQuery q = (ConditionQuery) query;
Id label = (Id) q.condition(HugeKeys.LABEL);
if (label != null && q.allSysprop() && conditions.size() == 1 &&
q.containsCondition(HugeKeys.LABEL, Condition.RelationType.EQ)) {
Set<String> ids = queryByLabelIndex(session, table, label);
if (ids.isEmpty()) {
// Not found data with the specified label
return null;
}
q.resetConditions();
for (String id : ids) {
/*
* NOTE: Do not need to deserialize, because can directly
* use the element id to do query from the vertex/edge table
*/
q.query(IdGenerator.of(id));
}
}
return query;
}
代码示例来源:origin: hugegraph/hugegraph
if (query.conditions().isEmpty()) {
assert !query.ids().isEmpty();
RowIterator rowIterator = null;
代码示例来源:origin: hugegraph/hugegraph
if (query.conditions().isEmpty()) {
代码示例来源:origin: hugegraph/hugegraph
if (!query.conditions().isEmpty()) {
rs = this.queryByFilter(query.conditions(), rs);
代码示例来源:origin: hugegraph/hugegraph
if (query.conditions().isEmpty()) {
assert !query.ids().isEmpty();
ExtendableIterator<BackendEntry> rs = new ExtendableIterator<>();
代码示例来源:origin: hugegraph/hugegraph
@Override
public Iterator<BackendEntry> query(BackendSession session, Query query) {
Set<Condition> conditions = query.conditions();
E.checkState(query instanceof ConditionQuery &&
conditions.size() == 2,
代码示例来源:origin: hugegraph/hugegraph
@Override
public Iterator<BackendEntry> query(BackendSession session, Query query) {
Set<Condition> conditions = query.conditions();
E.checkState(query instanceof ConditionQuery &&
(conditions.size() == 3 || conditions.size() == 2),
代码示例来源: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();
}
内容来源于网络,如有侵权,请联系作者删除!