public SimpleVertexQueryProcessor(VertexCentricQuery query, StandardTitanTx tx) { Preconditions.checkArgument(query.isSimple()); this.query=query; this.tx=tx; BackendQueryHolder<SliceQuery> bqh = query.getSubQuery(0); this.sliceQuery=bqh.getBackendQuery(); this.profiler=bqh.getProfiler(); this.vertex=query.getVertex(); this.edgeSerializer=tx.getEdgeSerializer(); }
private Query relations(RelationCategory returnType) { // if (name==null) { // if (hasSingleType()) name = getSingleType().name(); // else if (!requiresName) name = QUERY_NAME_PREFIX + queries.size(); // else throw new IllegalStateException("Need to specify an explicit name for this query"); // } BaseVertexCentricQuery vq = super.constructQuery(returnType); List<SliceQuery> slices = new ArrayList<>(vq.numSubQueries()); for (int i = 0; i < vq.numSubQueries(); i++) { BackendQueryHolder<SliceQuery> bq = vq.getSubQuery(i); SliceQuery sq = bq.getBackendQuery(); slices.add(sq.updateLimit(bq.isFitted() ? vq.getLimit() : hardQueryLimit)); } Query q = new Query(slices, returnType); synchronized (queries) { Preconditions.checkArgument(!queries.contains(q), "Query has already been added: %s", q); queries.add(q); for (SliceQuery sq : slices) { inverseQueries.put(sq, q); } } return q; }
tx.executeMultiQuery(adjVertices, sq.getBackendQuery(), sq.getProfiler());
@Override public Iterator<TitanElement> getNew(final GraphCentricQuery query) { if (query.numSubQueries()==1 && query.getSubQuery(0).getBackendQuery().isEmpty()) return Collections.emptyIterator(); Preconditions.checkArgument(query.getCondition().hasChildren(),"If the query is non-empty it needs to have a condition");
protected<Q> Q execute(RelationCategory returnType, ResultConstructor<Q> resultConstructor) { BaseVertexCentricQuery bq = super.constructQuery(returnType); if (bq.isEmpty()) return resultConstructor.emptyResult(); if (returnType==RelationCategory.PROPERTY && hasSingleType() && !hasQueryOnlyLoaded() && tx.getConfiguration().hasPropertyPrefetching()) { //Preload properties vertex.query().properties().iterator().hasNext(); } if (isPartitionedVertex(vertex) && !hasQueryOnlyGivenVertex()) { //If it's a preloaded vertex we shouldn't preload data explicitly List<InternalVertex> vertices = allRequiredRepresentatives(vertex); profiler.setAnnotation(QueryProfiler.PARTITIONED_VERTEX_ANNOTATION,true); profiler.setAnnotation(QueryProfiler.NUMVERTICES_ANNOTATION,vertices.size()); if (vertices.size()>1) { for (BackendQueryHolder<SliceQuery> sq : bq.getQueries()) { tx.executeMultiQuery(vertices, sq.getBackendQuery(),sq.getProfiler()); } } } else profiler.setAnnotation(QueryProfiler.NUMVERTICES_ANNOTATION,1); return resultConstructor.getResult(vertex,bq); }
sliceLimit *= 2; query.getBackendQuery().setLimit(computeLimit(conditions.size(),sliceLimit)); queries = ImmutableList.of(query); conditions.add(returnType);
public SimpleVertexQueryProcessor(VertexCentricQuery query, StandardTitanTx tx) { Preconditions.checkArgument(query.isSimple()); this.query=query; this.tx=tx; this.sliceQuery=query.getSubQuery(0).getBackendQuery(); this.vertex=query.getVertex(); this.edgeSerializer=tx.getEdgeSerializer(); }
private static List<StandardSubQuery> convert(GraphCentricQuery query) { List<StandardSubQuery> result = new ArrayList<StandardSubQuery>(query.numSubQueries()); for (int i=0;i<query.numSubQueries();i++) { BackendQueryHolder<JointIndexQuery> sq = query.getSubQuery(i); JointIndexQuery iq = sq.getBackendQuery(); List<String> indexes = new ArrayList<String>(iq.size()); for (int j=0;j<iq.size();j++) indexes.add(iq.getQuery(j).getIndex().getName()); result.add(new StandardSubQuery(sq,indexes)); } return result; }
public SimpleVertexQueryProcessor(VertexCentricQuery query, StandardTitanTx tx) { Preconditions.checkArgument(query.isSimple()); this.query=query; this.tx=tx; BackendQueryHolder<SliceQuery> bqh = query.getSubQuery(0); this.sliceQuery=bqh.getBackendQuery(); this.profiler=bqh.getProfiler(); this.vertex=query.getVertex(); this.edgeSerializer=tx.getEdgeSerializer(); }
tx.executeMultiQuery(adjVertices, sq.getBackendQuery());
private Query relations(RelationCategory returnType) { // if (name==null) { // if (hasSingleType()) name = getSingleType().name(); // else if (!requiresName) name = QUERY_NAME_PREFIX + queries.size(); // else throw new IllegalStateException("Need to specify an explicit name for this query"); // } BaseVertexCentricQuery vq = super.constructQuery(returnType); List<SliceQuery> slices = new ArrayList<>(vq.numSubQueries()); for (int i = 0; i < vq.numSubQueries(); i++) { BackendQueryHolder<SliceQuery> bq = vq.getSubQuery(i); SliceQuery sq = bq.getBackendQuery(); slices.add(sq.updateLimit(bq.isFitted() ? vq.getLimit() : hardQueryLimit)); } Query q = new Query(slices, returnType); synchronized (queries) { Preconditions.checkArgument(!queries.contains(q), "Query has already been added: %s", q); queries.add(q); for (SliceQuery sq : slices) { inverseQueries.put(sq, q); } } return q; }
tx.executeMultiQuery(adjVertices, sq.getBackendQuery(), sq.getProfiler());
protected<Q> Q execute(RelationCategory returnType, ResultConstructor<Q> resultConstructor) { BaseVertexCentricQuery bq = super.constructQuery(returnType); if (bq.isEmpty()) return resultConstructor.emptyResult(); if (isPartitionedVertex(vertex)) { List<InternalVertex> vertices = allRepresentatives(vertex); if (vertices.size()>1) { for (BackendQueryHolder<SliceQuery> sq : bq.getQueries()) { tx.executeMultiQuery(vertices, sq.getBackendQuery()); } } } return resultConstructor.getResult(vertex,bq); }
@Override public Iterator<TitanElement> getNew(final GraphCentricQuery query) { if (query.numSubQueries()==1 && query.getSubQuery(0).getBackendQuery().isEmpty()) return Collections.emptyIterator(); Preconditions.checkArgument(query.getCondition().hasChildren(),"If the query is non-empty it needs to have a condition");
@Override public Iterator<TitanElement> getNew(final GraphCentricQuery query) { if (query.numSubQueries()==1 && query.getSubQuery(0).getBackendQuery().isEmpty()) return Iterators.emptyIterator(); Preconditions.checkArgument(query.getCondition().hasChildren(),"If the query is non-empty it needs to have a condition");
protected<Q> Q execute(RelationCategory returnType, ResultConstructor<Q> resultConstructor) { BaseVertexCentricQuery bq = super.constructQuery(returnType); if (bq.isEmpty()) return resultConstructor.emptyResult(); if (returnType==RelationCategory.PROPERTY && hasSingleType() && !hasQueryOnlyLoaded() && tx.getConfiguration().hasPropertyPrefetching()) { //Preload properties vertex.query().properties().iterator().hasNext(); } if (isPartitionedVertex(vertex) && !hasQueryOnlyGivenVertex()) { //If it's a preloaded vertex we shouldn't preload data explicitly List<InternalVertex> vertices = allRequiredRepresentatives(vertex); profiler.setAnnotation(QueryProfiler.PARTITIONED_VERTEX_ANNOTATION,true); profiler.setAnnotation(QueryProfiler.NUMVERTICES_ANNOTATION,vertices.size()); if (vertices.size()>1) { for (BackendQueryHolder<SliceQuery> sq : bq.getQueries()) { tx.executeMultiQuery(vertices, sq.getBackendQuery(),sq.getProfiler()); } } } else profiler.setAnnotation(QueryProfiler.NUMVERTICES_ANNOTATION,1); return resultConstructor.getResult(vertex,bq); }
sliceLimit *= 2; query.getBackendQuery().setLimit(computeLimit(conditions.size(),sliceLimit)); queries = ImmutableList.of(query); conditions.add(returnType);
sliceLimit *= 2; query.getBackendQuery().setLimit(computeLimit(conditions.size(),sliceLimit)); queries = ImmutableList.of(query); conditions.add(returnType);