public List<Relation> userpropRelations() { List<Relation> relations = new ArrayList<>(); for (Relation r : this.relations()) { if (!r.isSysprop()) { relations.add(r); } } return relations; }
public Set<Id> userpropKeys() { Set<Id> keys = new LinkedHashSet<>(); for (Relation r : this.relations()) { if (!r.isSysprop()) { Condition.UserpropRelation ur = (Condition.UserpropRelation) r; keys.add(ur.key()); } } return keys; }
protected RowIterator queryByCond(Session session, ConditionQuery query) { if (query.containsScanCondition()) { E.checkArgument(query.relations().size() == 1, "Invalid scan with multi conditions: %s", query); Relation scan = query.relations().iterator().next(); Shard shard = (Shard) scan.value(); return this.queryByRange(session, shard); } throw new NotSupportException("query: %s", query); }
protected BackendColumnIterator queryByCond(Session session, ConditionQuery query) { if (query.containsScanCondition()) { E.checkArgument(query.relations().size() == 1, "Invalid scan with multi conditions: %s", query); Relation scan = query.relations().iterator().next(); Shard shard = (Shard) scan.value(); return this.queryByRange(session, shard); } throw new NotSupportException("query: %s", query); }
public boolean hasSecondaryCondition() { // NOTE: we need to judge all the conditions, including the nested for (Condition.Relation r : this.relations()) { if (r.relation().isSecondaryType()) { return true; } } return false; }
public boolean hasSearchCondition() { // NOTE: we need to judge all the conditions, including the nested for (Condition.Relation r : this.relations()) { if (r.relation().isSearchType()) { return true; } } return false; }
public boolean hasRangeCondition() { // NOTE: we need to judge all the conditions, including the nested for (Condition.Relation r : this.relations()) { if (r.relation().isRangeType()) { return true; } } return false; }
public boolean containsCondition(Condition.RelationType type) { for (Relation r : this.relations()) { if (r.relation().equals(type)) { return true; } } return false; }
public boolean containsCondition(HugeKeys key, Condition.RelationType type) { for (Relation r : this.relations()) { if (r.key().equals(key) && r.relation().equals(type)) { return true; } } return false; }
@Override protected Query writeQueryCondition(Query query) { if (query.resultType().isGraph()) { ConditionQuery result = (ConditionQuery) query; // No user-prop when serialize assert result.allSysprop(); for (Condition.Relation r : result.relations()) { if (r.relation() == Condition.RelationType.CONTAINS) { r.serialValue(JsonUtil.toJson(r.value())); } } } return query; }
@Override protected Query writeQueryEdgeCondition(Query query) { ConditionQuery result = (ConditionQuery) query; for (Condition.Relation r : result.relations()) { Object value = r.value(); if (value instanceof Id) { if (r.key() == HugeKeys.OWNER_VERTEX || r.key() == HugeKeys.OTHER_VERTEX) { // Serialize vertex id r.serialValue(IdUtil.writeString((Id) value)); } else { // Serialize label id r.serialValue(((Id) value).asObject()); } } else if (value instanceof Directions) { r.serialValue(((Directions) value).code()); } } return null; }
for (Condition.Relation r : ((ConditionQuery) query).relations()) { if (r.key().equals(HugeKeys.INDEX_LABEL_ID)) { indexLabelId = (Id) r.value();
public List<Relation> userpropRelations() { List<Relation> relations = new ArrayList<>(); for (Relation r : this.relations()) { if (!r.isSysprop()) { relations.add(r); } } return relations; }
public Set<Id> userpropKeys() { Set<Id> keys = new LinkedHashSet<>(); for (Relation r : this.relations()) { if (!r.isSysprop()) { Condition.UserpropRelation ur = (Condition.UserpropRelation) r; keys.add(ur.key()); } } return keys; }
@Override protected Query writeQueryCondition(Query query) { ConditionQuery result = (ConditionQuery) query; // No user-prop when serialize assert result.allSysprop(); for (Condition.Relation r : result.relations()) { // Serialize key if (query.resultType().isSchema()) { r.serialKey(((HugeKeys) r.key()).string()); } else { r.serialKey(formatSyspropName((HugeKeys) r.key())); } if (r.value() instanceof Id) { // Serialize id value r.serialValue(writeId((Id) r.value())); } else { // Serialize other type value r.serialValue(JsonUtil.toJson(r.value())); } if (r.relation() == Condition.RelationType.CONTAINS_KEY) { // Serialize has-key String key = (String) r.serialValue(); r.serialValue(formatPropertyName(key)); } } return result; }
protected BackendColumnIterator queryByCond(Session session, ConditionQuery query) { if (query.containsScanCondition()) { E.checkArgument(query.relations().size() == 1, "Invalid scan with multi conditions: %s", query); Relation scan = query.relations().iterator().next(); Shard shard = (Shard) scan.value(); return this.queryByRange(session, shard); } throw new NotSupportException("query: %s", query); }
public boolean hasSearchCondition() { // NOTE: we need to judge all the conditions, including the nested for (Condition.Relation r : this.relations()) { if (r.relation().isSearchType()) { return true; } } return false; }
public boolean hasRangeCondition() { // NOTE: we need to judge all the conditions, including the nested for (Condition.Relation r : this.relations()) { if (r.relation().isRangeType()) { return true; } } return false; }
public boolean containsCondition(Condition.RelationType type) { for (Relation r : this.relations()) { if (r.relation().equals(type)) { return true; } } return false; }
public boolean containsCondition(HugeKeys key, Condition.RelationType type) { for (Relation r : this.relations()) { if (r.key().equals(key) && r.relation().equals(type)) { return true; } } return false; }