當前位置: 首頁>>代碼示例>>Java>>正文


Java Query類代碼示例

本文整理匯總了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;
}
 
開發者ID:graben1437,項目名稱:titan1withtp3.1,代碼行數:21,代碼來源:QueryProfiler.java

示例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);
}
 
開發者ID:graben1437,項目名稱:titan1withtp3.1,代碼行數:4,代碼來源:IndexQuery.java

示例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;
}
 
開發者ID:graben1437,項目名稱:titan1withtp3.1,代碼行數:7,代碼來源:TitanPropertiesStep.java

示例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;
}
 
開發者ID:graben1437,項目名稱:titan1withtp3.1,代碼行數:7,代碼來源:TitanVertexStep.java

示例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;
}
 
開發者ID:graben1437,項目名稱:titan0.5.4-hbase1.1.1-custom,代碼行數:50,代碼來源:FaunusVertexQuery.java


注:本文中的com.thinkaurelius.titan.graphdb.query.Query類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。