private Q addConstraint(String type, TitanPredicate rel, Object value) { Preconditions.checkArgument(type != null && StringUtils.isNotBlank(type) && rel != null); //Treat special cases if (type.equals(ImplicitKey.ADJACENT_ID.name())) { Preconditions.checkArgument(rel == Cmp.EQUAL, "Only equality constraints are supported for %s", type); long vertexId = ElementUtils.getVertexId(value); Preconditions.checkArgument(vertexId > 0, "Expected valid vertex id: %s", value); return adjacent(getVertex(vertexId)); } else if (type.equals(ImplicitKey.ID.name())) { RelationIdentifier rid = ElementUtils.getEdgeId(value); Preconditions.checkArgument(rid != null, "Expected valid relation id: %s", value); return addConstraint(ImplicitKey.TITANID.name(), rel, rid.getRelationId()); } else { Preconditions.checkArgument(rel.isValidCondition(value), "Invalid condition provided: " + value); } if (constraints == NO_CONSTRAINTS) constraints = new ArrayList<PredicateCondition<String, TitanRelation>>(5); constraints.add(new PredicateCondition<String, TitanRelation>(type, rel, value)); return getThis(); }
HasContainer.makeHasContainers(ImplicitKey.ADJACENT_ID.name(), P.eq(vertex))), traversal);
} else throw new AssertionError("Implicit key property is undefined: " + this.name());
assertEquals("~ttl", ImplicitKey.TTL.name());
private Q addConstraint(String type, TitanPredicate rel, Object value) { Preconditions.checkArgument(type != null && StringUtils.isNotBlank(type) && rel != null); //Treat special cases if (type.equals(ImplicitKey.ADJACENT_ID.name())) { Preconditions.checkArgument(rel == Cmp.EQUAL, "Only equality constraints are supported for %s", type); long vertexId = ElementUtils.getVertexId(value); Preconditions.checkArgument(vertexId > 0, "Expected valid vertex id: %s", value); return adjacent(getVertex(vertexId)); } else if (type.equals(ImplicitKey.ID.name())) { RelationIdentifier rid = ElementUtils.getEdgeId(value); Preconditions.checkArgument(rid != null, "Expected valid relation id: %s", value); return addConstraint(ImplicitKey.TITANID.name(), rel, rid.getRelationId()); } else { Preconditions.checkArgument(rel.isValidCondition(value), "Invalid condition provided: " + value); } if (constraints == NO_CONSTRAINTS) constraints = new ArrayList<PredicateCondition<String, TitanRelation>>(5); constraints.add(new PredicateCondition<String, TitanRelation>(type, rel, value)); return getThis(); }
HasContainer.makeHasContainers(ImplicitKey.ADJACENT_ID.name(), P.eq(vertex))), traversal);
} else throw new AssertionError("Implicit key property is undefined: " + this.name());