• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HasContainer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



HasContainer类属于org.apache.tinkerpop.gremlin.process.traversal.step.util包,在下文中一共展示了HasContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    if (TraversalHelper.onGraphComputer(traversal))
        return;

    for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
        final TinkerGraphStep<?, ?> tinkerGraphStep = new TinkerGraphStep<>(originalGraphStep);
        TraversalHelper.replaceStep(originalGraphStep, tinkerGraphStep, traversal);
        Step<?, ?> currentStep = tinkerGraphStep.getNextStep();
        while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
            if (currentStep instanceof HasStep) {
                for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
                    if (!GraphStep.processHasContainerIds(tinkerGraphStep, hasContainer))
                        tinkerGraphStep.addHasContainer(hasContainer);
                }
                TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
                traversal.removeStep(currentStep);
            }
            currentStep = currentStep.getNextStep();
        }
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:23,代码来源:TinkerGraphStepStrategy.java


示例2: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
	for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
		final BitsyGraphStep<?, ?> bitsyGraphStep = new BitsyGraphStep<>(originalGraphStep);
		TraversalHelper.replaceStep(originalGraphStep, bitsyGraphStep, traversal);
		Step<?, ?> currentStep = bitsyGraphStep.getNextStep();
		while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
			if (currentStep instanceof HasStep) {
				for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
					if (!GraphStep.processHasContainerIds(bitsyGraphStep, hasContainer))
						bitsyGraphStep.addHasContainer(hasContainer);
				}
				TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
				traversal.removeStep(currentStep);
			}
			currentStep = currentStep.getNextStep();
		}
	}
}
 
开发者ID:lambdazen,项目名称:bitsy,代码行数:20,代码来源:BitsyTraversalStrategy.java


示例3: 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


示例4: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    for (final VertexStep originalVertexStep : TraversalHelper.getStepsOfClass(VertexStep.class, traversal)) {
        final HBaseVertexStep<?> hbaseVertexStep = new HBaseVertexStep<>(originalVertexStep);
        TraversalHelper.replaceStep(originalVertexStep, hbaseVertexStep, traversal);
        Step<?, ?> currentStep = hbaseVertexStep.getNextStep();
        while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
            if (currentStep instanceof HasStep) {
                for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
                    hbaseVertexStep.addHasContainer(hasContainer);
                }
                TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
                traversal.removeStep(currentStep);
            }
            currentStep = currentStep.getNextStep();
        }
    }
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:20,代码来源:HBaseVertexStepStrategy.java


示例5: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
        final HBaseGraphStep<?, ?> hbaseGraphStep = new HBaseGraphStep<>(originalGraphStep);
        TraversalHelper.replaceStep(originalGraphStep, hbaseGraphStep, traversal);
        Step<?, ?> currentStep = hbaseGraphStep.getNextStep();
        while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
            if (currentStep instanceof HasStep) {
                for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
                    if (!GraphStep.processHasContainerIds(hbaseGraphStep, hasContainer))
                        hbaseGraphStep.addHasContainer(hasContainer);
                }
                TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
                traversal.removeStep(currentStep);
            }
            currentStep = currentStep.getNextStep();
        }
    }
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:21,代码来源:HBaseGraphStepStrategy.java


示例6: foldInHasContainer

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
public static void foldInHasContainer(final HasStepFolder titanStep, final Traversal.Admin<?, ?> traversal) {

        Step<?, ?> currentStep = titanStep.getNextStep();
        while (true) {
            if (currentStep instanceof HasContainerHolder) {
                Iterable<HasContainer> containers = ((HasContainerHolder) currentStep).getHasContainers();
                if (validTitanHas(containers)) {
                    titanStep.addAll(containers);
                    currentStep.getLabels().forEach(titanStep::addLabel);
                    traversal.removeStep(currentStep);
                }
            } else if (currentStep instanceof IdentityStep) {
                // do nothing, has no impact
            } else {
                break;
            }
            currentStep = currentStep.getNextStep();
        }
    }
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:20,代码来源:HasStepFolder.java


示例7: createIdPredicate

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
public static <E extends Element> PredicatesHolder createIdPredicate(Object[] ids, Class<E> returnType) {
    ElementHelper.validateMixedElementIds(returnType, ids);
    //if (ids.length > 0 && Vertex.class.isAssignableFrom(ids[0].getClass()))  return new ArrayIterator<>(ids);
    if (ids.length > 0) {
        List<Object> collect = Stream.of(ids).map(id -> {
            if (id instanceof Element)
                return ((Element) id).id();
            return id;
        }).collect(Collectors.toList());

        HasContainer idPredicate = new HasContainer(T.id.getAccessor(), P.within(collect));
        return PredicatesHolderFactory.predicate(idPredicate);
    }

    return PredicatesHolderFactory.empty();
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:17,代码来源:UniGraph.java


示例8: and

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
public static PredicatesHolder and(Set<PredicatesHolder> predicatesHolders) {
    if(predicatesHolders.stream().filter(PredicatesHolder::isAborted).count() > 0) return abort();

    Set<PredicatesHolder> filteredPredicateHolders = predicatesHolders.stream()
            .filter(PredicatesHolder::notEmpty).collect(Collectors.toSet());
    if(filteredPredicateHolders.size() == 0) return empty();
    if(filteredPredicateHolders.size() == 1) return filteredPredicateHolders.iterator().next();

    List<HasContainer> predicates = new ArrayList<>();
    List<PredicatesHolder> children = new ArrayList<>();
    for(PredicatesHolder predicatesHolder : filteredPredicateHolders){
        if(predicatesHolder.getClause().equals(PredicatesHolder.Clause.And)){
            predicates.addAll(predicatesHolder.getPredicates());
            children.addAll(predicatesHolder.getChildren());
        }
        else children.add(predicatesHolder);
    }

    return new PredicatesHolder(PredicatesHolder.Clause.And, predicates, children);
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:21,代码来源:PredicatesHolderFactory.java


示例9: search

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
@Override
public <E extends Element> Iterator<E> search(SearchQuery<E> uniQuery) {
    if(uniQuery.getReturnType() != Vertex.class)
        return EmptyIterator.instance();
    PredicatesHolder predicates = uniQuery.getPredicates();
    List<? extends VirtualVertexSchema> filteredSchemas = vertexSchemas.stream()
            .filter(schema -> !schema.toPredicates(predicates).getClause().equals(PredicatesHolder.Clause.Abort)).collect(Collectors.toList());
    Optional<HasContainer> ids = predicates.getPredicates().stream().filter(has -> has.getKey().equals(T.id.getAccessor())).findFirst();
    Optional<HasContainer> labels = predicates.getPredicates().stream().filter(has -> has.getKey().equals(T.label.getAccessor())).findFirst();
    if (!ids.isPresent() || !labels.isPresent()){
        return EmptyIterator.instance();
    }
    ArrayList<Map<String, Object>> elements = new ArrayList<>();
    Object idObject = ids.get().getValue();
    Collection<Object> idsCol = idObject instanceof Collection ?
            ((Collection) idObject) : Collections.singleton(idObject);

    Object labelObject = labels.get().getValue();
    Collection<Object> labelCol = labelObject instanceof Collection ?
            ((Collection) labelObject) : Collections.singleton(labelObject);

    idsCol.forEach(id -> labelCol.forEach(label -> elements.add(createElement(id, label.toString()))));

    return (Iterator<E>) elements.stream().flatMap(fields -> filteredSchemas.stream().flatMap(schema -> Stream.of(schema.createElement(fields)))).filter(v -> v != null).iterator();
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:26,代码来源:VirtualController.java


示例10: toPredicate

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
@Override
public PredicatesHolder toPredicate(HasContainer has) {
    Object value = has.getValue();
    Set<PredicatesHolder> predicates = new HashSet<>();
    if (value instanceof String) {
        String valueString = value.toString();
        predicates.add(stringValueToPredicate(valueString, has, false));
    } else if (value instanceof Collection) {
        Collection collection = (Collection) value;
        collection.forEach(v -> predicates.add(stringValueToPredicate(v.toString(), has, true)));
        Map<String, List<HasContainer>> collect = predicates.stream().flatMap(p -> p.getPredicates().stream()).collect(Collectors.groupingBy(p -> p.getKey()));
        if (collect.size() == 0) return PredicatesHolderFactory.abort();
        predicates.clear();
        collect.forEach((key, hasContainers) -> {
            List<Object> values = hasContainers.stream().map(HasContainer::getValue)
                    .map(l -> ((Collection) l).iterator().next()).collect(Collectors.toList());
            predicates.add(PredicatesHolderFactory.predicate(new HasContainer(key,
                    new P(has.getBiPredicate(), values))));
        });
    }
    return PredicatesHolderFactory.and(predicates);
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:23,代码来源:ConcatenateFieldPropertySchema.java


示例11: toPredicate

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
@Override
public PredicatesHolder toPredicate(HasContainer has) {
    P predicate;
    if (has != null && !test(has.getPredicate())) {
        return PredicatesHolderFactory.abort();
    } else if (has != null) {
        predicate = has.getPredicate().clone();
        if (reverseAlias != null) {
            Object predicateValue = predicate.getValue();
            if (reverseAlias.containsKey(predicateValue.toString())){
                predicate.setValue(reverseAlias.get(predicateValue.toString()));
            }
        }
    } else if (include != null) {
        predicate = P.within(include);
    } else if (exclude != null) {
        predicate = P.without(exclude);
    } else return PredicatesHolderFactory.empty();

    P translatedPredicate = type.translate(predicate);

    HasContainer hasContainer = new HasContainer(this.field, translatedPredicate);
    return PredicatesHolderFactory.predicate(hasContainer);
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:25,代码来源:FieldPropertySchema.java


示例12: 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


示例13: findClassLabelsInHasContainers

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
private Set<String> findClassLabelsInHasContainers() {
    Set<String> classLabels = new HashSet<>();

    Optional<HasContainer> container = this.hasContainers.stream()
            .filter(hasContainer -> isLabelKey(hasContainer.getKey()))
            .findFirst();

    if (container.isPresent()) {
        Object value = container.get().getValue();

        //The ugly part. Is there anyway to know the return type of a predicate value ?
        if (value instanceof List) {
            ((List) value).forEach(label -> classLabels.add((String) label));
        } else {
            classLabels.add((String) value);
        }
    }

    return classLabels;
}
 
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:21,代码来源:OrientGraphStep.java


示例14: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
        final Neo4jGraphStep<?, ?> neo4jGraphStep = new Neo4jGraphStep<>(originalGraphStep);
        TraversalHelper.replaceStep(originalGraphStep, neo4jGraphStep, traversal);
        Step<?, ?> currentStep = neo4jGraphStep.getNextStep();
        while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
            if (currentStep instanceof HasStep) {
                for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
                    if (!GraphStep.processHasContainerIds(neo4jGraphStep, hasContainer))
                        neo4jGraphStep.addHasContainer(hasContainer);
                }
                TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
                traversal.removeStep(currentStep);
            }
            currentStep = currentStep.getNextStep();
        }
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:20,代码来源:Neo4jGraphStepStrategy.java


示例15: edges

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
private Iterator<? extends Edge> edges() {
    final TinkerGraph graph = (TinkerGraph) this.getTraversal().getGraph().get();
    final HasContainer indexedContainer = getIndexKey(Edge.class);
    // ids are present, filter on them first
    if (null == this.ids)
        return Collections.emptyIterator();
    else if (this.ids.length > 0)
        return this.iteratorList(graph.edges(this.ids));
    else
        return null == indexedContainer ?
                this.iteratorList(graph.edges()) :
                TinkerHelper.queryEdgeIndex(graph, indexedContainer.getKey(), indexedContainer.getPredicate().getValue()).stream()
                        .filter(edge -> HasContainer.testAll(edge, this.hasContainers))
                        .collect(Collectors.<Edge>toList()).iterator();
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:16,代码来源:TinkerGraphStep.java


示例16: vertices

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
private Iterator<? extends Vertex> vertices() {
    final TinkerGraph graph = (TinkerGraph) this.getTraversal().getGraph().get();
    final HasContainer indexedContainer = getIndexKey(Vertex.class);
    // ids are present, filter on them first
    if (null == this.ids)
        return Collections.emptyIterator();
    else if (this.ids.length > 0)
        return this.iteratorList(graph.vertices(this.ids));
    else
        return null == indexedContainer ?
                this.iteratorList(graph.vertices()) :
                IteratorUtils.filter(TinkerHelper.queryVertexIndex(graph, indexedContainer.getKey(), indexedContainer.getPredicate().getValue()).iterator(),
                        vertex -> HasContainer.testAll(vertex, this.hasContainers));
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:15,代码来源:TinkerGraphStep.java


示例17: getIndexKey

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
private HasContainer getIndexKey(final Class<? extends Element> indexedClass) {
    final Set<String> indexedKeys = ((TinkerGraph) this.getTraversal().getGraph().get()).getIndexedKeys(indexedClass);

    final Iterator<HasContainer> itty = IteratorUtils.filter(hasContainers.iterator(),
            c -> c.getPredicate().getBiPredicate() == Compare.eq && indexedKeys.contains(c.getKey()));
    return itty.hasNext() ? itty.next() : null;

}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:9,代码来源:TinkerGraphStep.java


示例18: iteratorList

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
private <E extends Element> Iterator<E> iteratorList(final Iterator<E> iterator) {
    final List<E> list = new ArrayList<>();
    while (iterator.hasNext()) {
        final E e = iterator.next();
        if (HasContainer.testAll(e, this.hasContainers))
            list.add(e);
    }
    return list.iterator();
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:10,代码来源:TinkerGraphStep.java


示例19: addHasContainer

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
@Override
public void addHasContainer(final HasContainer hasContainer) {
    if (hasContainer.getPredicate() instanceof AndP) {
        for (final P<?> predicate : ((AndP<?>) hasContainer.getPredicate()).getPredicates()) {
            this.addHasContainer(new HasContainer(hasContainer.getKey(), predicate));
        }
    } else
        this.hasContainers.add(hasContainer);
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:10,代码来源:TinkerGraphStep.java


示例20: g_V

import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; //导入依赖的package包/类
private static GraphTraversal.Admin<?, ?> g_V(final Object... hasKeyValues) {
    final GraphTraversal.Admin<?, ?> traversal = new DefaultGraphTraversal<>();
    final TinkerGraphStep<Vertex, Vertex> graphStep = new TinkerGraphStep<>(new GraphStep<>(traversal, Vertex.class, true));
    for (int i = 0; i < hasKeyValues.length; i = i + 2) {
        graphStep.addHasContainer(new HasContainer((String) hasKeyValues[i], (P) hasKeyValues[i + 1]));
    }
    return traversal.addStep(graphStep);
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:9,代码来源:TinkerGraphStepStrategyTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IAsyncCallback类代码示例发布时间:2022-05-22
下一篇:
Java ScanEnvironment类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap