当前位置: 首页>>代码示例>>Java>>正文


Java HasContainer.getBiPredicate方法代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer.getBiPredicate方法的典型用法代码示例。如果您正苦于以下问题:Java HasContainer.getBiPredicate方法的具体用法?Java HasContainer.getBiPredicate怎么用?Java HasContainer.getBiPredicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer的用法示例。


在下文中一共展示了HasContainer.getBiPredicate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: lookupEdges

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入方法依赖的package包/类
private Iterator<Edge> lookupEdges(final Traverser.Admin<Vertex> traverser, final List<HasContainer> hasContainers) {
    final HBaseGraph graph = (HBaseGraph) this.getTraversal().getGraph().get();
    if (getEdgeLabels().length == 1) {
        final String label = getEdgeLabels()[0];
        // find an edge by label and key/value
        for (final HasContainer hasContainer : hasContainers) {
            if (Compare.eq == hasContainer.getBiPredicate() && !hasContainer.getKey().equals(T.label.getAccessor())) {
                if (graph.hasIndex(OperationType.READ, ElementType.EDGE, label, hasContainer.getKey())) {
                    return IteratorUtils.stream(((HBaseVertex) traverser.get()).edges(getDirection(), label, hasContainer.getKey(), hasContainer.getValue()))
                            .filter(vertex -> HasContainer.testAll(vertex, hasContainers)).iterator();
                }
            }
        }
    }

    // linear scan
    return CloseableIteratorUtils.filter(traverser.get().edges(getDirection(), getEdgeLabels()),
            edge -> HasContainer.testAll(edge, hasContainers));
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:20,代码来源:HBaseVertexStep.java

示例2: getTypeFilter

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入方法依赖的package包/类
private static QueryBuilder getTypeFilter(HasContainer has) {
    BiPredicate<?, ?> biPredicate = has.getBiPredicate();
    if (biPredicate instanceof Compare) {
        QueryBuilder query = QueryBuilders.typeQuery(has.getValue().toString());
        if (biPredicate.equals(Compare.eq)) return query;
        return QueryBuilders.boolQuery().mustNot(query);
    } else if (biPredicate instanceof Contains) {
        Collection values = (Collection) has.getValue();
        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
        boolean within = biPredicate.equals(Contains.within);
        values.forEach(label -> {
            TypeQueryBuilder typeQueryBuilder = QueryBuilders.typeQuery(label.toString());
            if (within) boolQueryBuilder.should(typeQueryBuilder);
            else boolQueryBuilder.mustNot(typeQueryBuilder);
        });
        return boolQueryBuilder;
    } else throw new IllegalArgumentException("predicate not supported by unipop: " + biPredicate.toString());
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:19,代码来源:FilterHelper.java

示例3: processHasContainerIds

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入方法依赖的package包/类
/**
 * Helper method for providers that want to "fold in" {@link HasContainer}'s based on id checking into the ids of the {@link GraphStep}.
 *
 * @param graphStep    the GraphStep to potentially {@link GraphStep#addIds(Object...)}.
 * @param hasContainer The {@link HasContainer} to check for id validation.
 * @return true if the {@link HasContainer} updated ids and thus, was processed.
 */
public static boolean processHasContainerIds(final GraphStep<?, ?> graphStep, final HasContainer hasContainer) {
    if (hasContainer.getKey().equals(T.id.getAccessor()) && (hasContainer.getBiPredicate() == Compare.eq || hasContainer.getBiPredicate() == Contains.within)) {
        graphStep.addIds(hasContainer.getValue());
        return true;
    }
    return false;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:15,代码来源:GraphStep.java

示例4: explodeConnective

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入方法依赖的package包/类
public PredicatesHolder explodeConnective(HasContainer has) {
    if (has.getBiPredicate() instanceof ConnectiveP) {
        List<P> predicates = ((ConnectiveP) has.getBiPredicate()).getPredicates();
        PredicatesHolder.Clause clause = has.getPredicate() instanceof AndP ?
                PredicatesHolder.Clause.And : PredicatesHolder.Clause.Or;
        Set<HasContainer> hasContainers = predicates.stream()
                .map(p -> new HasContainer(has.getKey(), p)).collect(Collectors.toSet());
        return PredicatesHolderFactory.createFromPredicates(clause, hasContainers);
    }
    return PredicatesHolderFactory.predicate(has);
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:12,代码来源:DateFieldPropertySchema.java

示例5: processHasContainerIds

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入方法依赖的package包/类
/**
 * Helper method for providers that want to "fold in" {@link HasContainer}'s based on id checking into the ids of the {@link GraphStep}.
 *
 * @param graphStep    the GraphStep to potentially {@link GraphStep#addIds(Object...)}.
 * @param hasContainer The {@link HasContainer} to check for id validation.
 * @return true if the {@link HasContainer} updated ids and thus, was processed.
 */
public static boolean processHasContainerIds(final GraphStep<?, ?> graphStep, final HasContainer hasContainer) {
    if (hasContainer.getKey().equals(T.id.getAccessor()) && graphStep.ids.length == 0 &&
            (hasContainer.getBiPredicate() == Compare.eq || hasContainer.getBiPredicate() == Contains.within)) {
        graphStep.addIds(hasContainer.getValue());
        return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:16,代码来源:GraphStep.java


注:本文中的org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer.getBiPredicate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。