Search in sources :

Example 1 with Text

use of org.apache.tinkerpop.gremlin.process.traversal.Text in project janusgraph by JanusGraph.

the class JanusGraphPredicateUtils method convert.

public static List<Object> convert(final ConnectiveP<?> predicate, final ConnectiveJanusPredicate connectivePredicate) {
    final List<Object> toReturn = new ArrayList<>();
    for (final P<?> p : predicate.getPredicates()) {
        if (p instanceof ConnectiveP) {
            final ConnectiveJanusPredicate subPredicate = instanceConnectiveJanusPredicate(p);
            toReturn.add(convert((ConnectiveP<?>) p, subPredicate));
            connectivePredicate.add(subPredicate);
        } else if (p.getBiPredicate() instanceof Text) {
            Text text = (Text) p.getBiPredicate();
            connectivePredicate.add(new TinkerPopTextWrappingPredicate(text));
            toReturn.add(p.getValue());
        } else {
            connectivePredicate.add(JanusGraphPredicateUtils.convert(p.getBiPredicate()));
            toReturn.add(p.getValue());
        }
    }
    return toReturn;
}
Also used : ConnectiveP(org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP) ArrayList(java.util.ArrayList) Text(org.apache.tinkerpop.gremlin.process.traversal.Text) TinkerPopTextWrappingPredicate(org.janusgraph.core.attribute.TinkerPopTextWrappingPredicate) ConnectiveJanusPredicate(org.janusgraph.graphdb.predicate.ConnectiveJanusPredicate)

Aggregations

ArrayList (java.util.ArrayList)1 Text (org.apache.tinkerpop.gremlin.process.traversal.Text)1 ConnectiveP (org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP)1 TinkerPopTextWrappingPredicate (org.janusgraph.core.attribute.TinkerPopTextWrappingPredicate)1 ConnectiveJanusPredicate (org.janusgraph.graphdb.predicate.ConnectiveJanusPredicate)1