本文整理汇总了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));
}
示例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());
}
示例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;
}
示例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);
}
示例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;
}