use of com.thinkaurelius.titan.graphdb.internal.InternalElement in project titan by thinkaurelius.
the class PredicateCondition method evaluate.
@Override
public boolean evaluate(E element) {
RelationType type;
if (key instanceof String) {
type = ((InternalElement) element).tx().getRelationType((String) key);
if (type == null)
return satisfiesCondition(null);
} else {
type = (RelationType) key;
}
Preconditions.checkNotNull(type);
if (type.isPropertyKey()) {
Iterator<Object> iter = ElementHelper.getValues(element, (PropertyKey) type).iterator();
if (iter.hasNext()) {
while (iter.hasNext()) {
if (satisfiesCondition(iter.next()))
return true;
}
return false;
}
return satisfiesCondition(null);
} else {
assert ((InternalRelationType) type).multiplicity().isUnique(Direction.OUT);
return satisfiesCondition((TitanVertex) element.value(type.name()));
}
}
use of com.thinkaurelius.titan.graphdb.internal.InternalElement in project atlas by apache.
the class PredicateCondition method evaluate.
@Override
public boolean evaluate(E element) {
RelationType type;
if (key instanceof String) {
type = ((InternalElement) element).tx().getRelationType((String) key);
if (type == null)
return satisfiesCondition(null);
} else {
type = (RelationType) key;
}
Preconditions.checkNotNull(type);
if (type.isPropertyKey()) {
Iterator<Object> iter = ElementHelper.getValues(element, (PropertyKey) type).iterator();
if (iter.hasNext()) {
while (iter.hasNext()) {
if (satisfiesCondition(iter.next()))
return true;
}
return false;
}
return satisfiesCondition(null);
} else {
assert ((InternalRelationType) type).getMultiplicity().isUnique(Direction.OUT);
return satisfiesCondition(((TitanRelation) element).getProperty((EdgeLabel) type));
}
}
Aggregations