本文整理汇总了Java中com.thinkaurelius.titan.graphdb.query.Query类的典型用法代码示例。如果您正苦于以下问题:Java Query类的具体用法?Java Query怎么用?Java Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Query类属于com.thinkaurelius.titan.graphdb.query包,在下文中一共展示了Query类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: profile
import com.thinkaurelius.titan.graphdb.query.Query; //导入依赖的package包/类
public static<Q extends Query,R extends Collection> R profile(String groupName, QueryProfiler profiler, Q query, boolean multiQuery, Function<Q,R> queryExecutor) {
QueryProfiler sub = profiler.addNested(groupName);
sub.setAnnotation(QUERY_ANNOTATION, query);
if (query.hasLimit()) sub.setAnnotation(LIMIT_ANNOTATION,query.getLimit());
sub.startTimer();
R result = queryExecutor.apply(query);
sub.stopTimer();
long resultSize = 0;
if (multiQuery && profiler!=QueryProfiler.NO_OP) {
//The result set is a collection of collections, but don't do this computation if profiling is disabled
for (Object r : result) {
if (r instanceof Collection) resultSize+=((Collection)r).size();
else resultSize++;
}
} else {
resultSize = result.size();
}
sub.setResultSize(resultSize);
return result;
}
示例2: IndexQuery
import com.thinkaurelius.titan.graphdb.query.Query; //导入依赖的package包/类
public IndexQuery(String store, Condition condition, ImmutableList<OrderEntry> orders) {
this(store, condition, orders, Query.NO_LIMIT);
}
示例3: TitanPropertiesStep
import com.thinkaurelius.titan.graphdb.query.Query; //导入依赖的package包/类
public TitanPropertiesStep(PropertiesStep<E> originalStep) {
super(originalStep.getTraversal(), originalStep.getReturnType(), originalStep.getPropertyKeys());
originalStep.getLabels().forEach(this::addLabel);
this.hasContainers = new ArrayList<>();
this.limit = Query.NO_LIMIT;
}
示例4: TitanVertexStep
import com.thinkaurelius.titan.graphdb.query.Query; //导入依赖的package包/类
public TitanVertexStep(VertexStep<E> originalStep) {
super(originalStep.getTraversal(), originalStep.getReturnClass(), originalStep.getDirection(), originalStep.getEdgeLabels());
originalStep.getLabels().forEach(this::addLabel);
this.hasContainers = new ArrayList<>();
this.limit = Query.NO_LIMIT;
}
示例5: getRelations
import com.thinkaurelius.titan.graphdb.query.Query; //导入依赖的package包/类
protected Iterable<FaunusRelation> getRelations(FaunusElement element, RelationCategory returnType) {
FaunusSchemaManager typeManager = element.getTypeManager();
final And<TitanRelation> condition = getCondition(element,returnType);
if (condition==null) return Collections.EMPTY_LIST;
Iterable<FaunusRelation> result=null;
for (Direction direction : Direction.proper) {
if (dir!=direction && dir!=Direction.BOTH) continue;
SetMultimap<FaunusRelationType, FaunusRelation> adjacency = element.getAdjacency(direction);
if (types.length==0) {
if (result==null) result=adjacency.values();
else result = Iterables.concat(result,adjacency.values());
} else {
for (String type : types) {
FaunusRelationType rt = typeManager.getRelationType(type);
if (rt==null) continue;
Iterable<FaunusRelation> rels;
if (rt.isPropertyKey() && ((FaunusPropertyKey)rt).isImplicit()) {
FaunusPropertyKey key = (FaunusPropertyKey)rt;
Object value = key.computeImplicit(element);
if (value!=null)
rels = Lists.newArrayList((FaunusRelation)new SimpleFaunusProperty(key,value));
else rels = Collections.EMPTY_LIST;
} else {
rels = adjacency.get(rt);
}
if (result==null) result=rels;
else result = Iterables.concat(result,rels);
}
}
}
result = new FilterIterable(condition, element, result, dir);
//Order
if (!orders.isEmpty()) {
ArrayList<FaunusRelation> allRels = Lists.newArrayList(result);
Collections.sort(allRels,orders);
result = new RemoveOriginalIterable(allRels, element, dir);
}
//Limit
if (limit!= Query.NO_LIMIT) {
result = Iterables.limit(result,limit);
}
return result;
}