Search in sources :

Example 56 with HasContainer

use of org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer in project sqlg by pietermartin.

the class SqlgUtil method setParametersOnStatement.

public static void setParametersOnStatement(SqlgGraph sqlgGraph, LinkedList<SchemaTableTree> schemaTableTreeStack, PreparedStatement preparedStatement, int parameterIndex) throws SQLException {
    Multimap<String, Object> keyValueMap = LinkedListMultimap.create();
    for (SchemaTableTree schemaTableTree : schemaTableTreeStack) {
        for (HasContainer hasContainer : schemaTableTree.getHasContainers()) {
            if (!sqlgGraph.getSqlDialect().supportsBulkWithinOut() || !isBulkWithinAndOut(sqlgGraph, hasContainer)) {
                WhereClause whereClause = WhereClause.from(hasContainer.getPredicate());
                whereClause.putKeyValueMap(hasContainer, keyValueMap);
            }
        }
        for (AndOrHasContainer andOrHasContainer : schemaTableTree.getAndOrHasContainers()) {
            andOrHasContainer.setParameterOnStatement(keyValueMap);
        }
    }
    List<ImmutablePair<PropertyType, Object>> typeAndValues = SqlgUtil.transformToTypeAndValue(keyValueMap);
    // This is for selects
    setKeyValuesAsParameter(sqlgGraph, false, parameterIndex, preparedStatement, typeAndValues);
}
Also used : SchemaTableTree(org.umlg.sqlg.sql.parse.SchemaTableTree) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) HasContainer(org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer) AndOrHasContainer(org.umlg.sqlg.sql.parse.AndOrHasContainer) WhereClause(org.umlg.sqlg.sql.parse.WhereClause) AndOrHasContainer(org.umlg.sqlg.sql.parse.AndOrHasContainer)

Aggregations

HasContainer (org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer)56 AndOrHasContainer (org.umlg.sqlg.sql.parse.AndOrHasContainer)13 P (org.apache.tinkerpop.gremlin.process.traversal.P)9 Collectors (java.util.stream.Collectors)7 HasStep (org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep)6 AndP (org.apache.tinkerpop.gremlin.process.traversal.util.AndP)6 FullText (org.umlg.sqlg.predicate.FullText)6 PredicatesHolder (org.unipop.query.predicates.PredicatesHolder)6 java.util (java.util)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 BiPredicate (java.util.function.BiPredicate)5 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)5 JSONObject (org.json.JSONObject)5 GraphStep (org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep)4 BasicVertexCentricQueryBuilder (org.janusgraph.graphdb.query.vertex.BasicVertexCentricQueryBuilder)4 Traversal (org.apache.tinkerpop.gremlin.process.traversal.Traversal)3 HasContainerHolder (org.apache.tinkerpop.gremlin.process.traversal.step.HasContainerHolder)3 IdentityStep (org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.IdentityStep)3 ConnectiveP (org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP)3