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


Java GraphStep.getIds方法代码示例

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


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

示例1: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
void apply() {
    final Step<?, ?> startStep = traversal.getStartStep();

    if (!(startStep instanceof GraphStep)) {
        return;
    }
    final GraphStep originalGraphStep = (GraphStep) startStep;

    if (this.sqlgGraph.features().supportsBatchMode() && this.sqlgGraph.tx().isInNormalBatchMode()) {
        this.sqlgGraph.tx().flush();
    }

    if (originalGraphStep.getIds().length > 0) {
        Object id = originalGraphStep.getIds()[0];
        if (id != null) {
            Class clazz = id.getClass();
            if (!Stream.of(originalGraphStep.getIds()).allMatch(i -> clazz.isAssignableFrom(i.getClass())))
                throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
        }
    }
    if (this.canNotBeOptimized()) {
        this.logger.debug("gremlin not optimized due to path or tree step. " + this.traversal.toString() + "\nPath to gremlin:\n" + ExceptionUtils.getStackTrace(new Throwable()));
        return;
    }
    combineSteps();
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:27,代码来源:GraphStrategy.java

示例2: TinkerGraphStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
public TinkerGraphStep(final GraphStep<S, E> originalGraphStep) {
    super(originalGraphStep.getTraversal(), originalGraphStep.getReturnClass(), originalGraphStep.isStartStep(), originalGraphStep.getIds());
    originalGraphStep.getLabels().forEach(this::addLabel);

    // we used to only setIteratorSupplier() if there were no ids OR the first id was instanceof Element,
    // but that allowed the filter in g.V(v).has('k','v') to be ignored.  this created problems for
    // PartitionStrategy which wants to prevent someone from passing "v" from one TraversalSource to
    // another TraversalSource using a different partition
    this.setIteratorSupplier(() -> (Iterator<E>) (Vertex.class.isAssignableFrom(this.returnClass) ? this.vertices() : this.edges()));
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:11,代码来源:TinkerGraphStep.java

示例3: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    TraversalHelper.getStepsOfAssignableClass(HasStep.class, traversal).stream()
            .filter(hasStep -> ((HasStep<?>) hasStep).getHasContainers().get(0).getKey().equals(T.id.getAccessor()))
            .forEach(hasStep -> ((HasStep<?>) hasStep).getHasContainers().get(0).setKey(this.idPropertyKey));

    if (traversal.getStartStep() instanceof GraphStep) {
        final GraphStep graphStep = (GraphStep) traversal.getStartStep();
        // only need to apply the custom id if ids were assigned - otherwise we want the full iterator.
        // note that it is then only necessary to replace the step if the id is a non-element.  other tests
        // in the suite validate that items in getIds() is uniform so it is ok to just test the first item
        // in the list.
        if (graphStep.getIds().length > 0 && !(graphStep.getIds()[0] instanceof Element)) {
            if (graphStep instanceof HasContainerHolder)
                ((HasContainerHolder) graphStep).addHasContainer(new HasContainer(this.idPropertyKey, P.within(Arrays.asList(graphStep.getIds()))));
            else
                TraversalHelper.insertAfterStep(new HasStep(traversal, new HasContainer(this.idPropertyKey, P.within(Arrays.asList(graphStep.getIds())))), graphStep, traversal);
            graphStep.clearIds();
        }
    }
    TraversalHelper.getStepsOfAssignableClass(IdStep.class, traversal).stream().forEach(step -> {
        TraversalHelper.replaceStep(step, new PropertiesStep(traversal, PropertyType.VALUE, idPropertyKey), traversal);
    });

    // in each case below, determine if the T.id is present and if so, replace T.id with the idPropertyKey or if
    // it is not present then shove it in there and generate an id
    traversal.getSteps().forEach(step -> {
        if (step instanceof AddVertexStep || step instanceof AddVertexStartStep || step instanceof AddEdgeStep) {
            final Parameterizing parameterizing = (Parameterizing) step;
            if (parameterizing.getParameters().contains(T.id))
                parameterizing.getParameters().rename(T.id, this.idPropertyKey);
            else if (!parameterizing.getParameters().contains(this.idPropertyKey))
                parameterizing.getParameters().set(this.idPropertyKey, idMaker.get());
        }
    });
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:37,代码来源:ElementIdStrategy.java

示例4: LiteGraphStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
public LiteGraphStep(final GraphStep<S, E> originalGraphStep) {
    super(originalGraphStep.getTraversal(), originalGraphStep.getReturnClass(), originalGraphStep.isStartStep(), originalGraphStep.getIds());
    originalGraphStep.getLabels().forEach(this::addLabel);

    // we used to only setIteratorSupplier() if there were no ids OR the first id was instanceof Element,
    // but that allowed the filter in g.V(v).has('k','v') to be ignored.  this created problems for
    // PartitionStrategy which wants to prevent someone from passing "v" from one TraversalSource to
    // another TraversalSource using a different partition
    this.setIteratorSupplier(() -> (Iterator<E>) (Vertex.class.isAssignableFrom(this.returnClass) ? this.vertices() : this.edges()));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:11,代码来源:LiteGraphStep.java

示例5: TitanGraphStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
public TitanGraphStep(final GraphStep<S, E> originalStep) {
    super(originalStep.getTraversal(), originalStep.getReturnClass(), originalStep.isStartStep(), originalStep.getIds());
    originalStep.getLabels().forEach(this::addLabel);
    this.setIteratorSupplier(() -> {
        TitanTransaction tx = TitanTraversalUtil.getTx(traversal);
        TitanGraphQuery query = tx.query();
        for (HasContainer condition : hasContainers) {
            query.has(condition.getKey(), TitanPredicate.Converter.convert(condition.getBiPredicate()), condition.getValue());
        }
        for (OrderEntry order : orders) query.orderBy(order.key, order.order);
        if (limit != BaseQuery.NO_LIMIT) query.limit(limit);
        ((GraphCentricQueryBuilder) query).profiler(queryProfiler);
        return Vertex.class.isAssignableFrom(this.returnClass) ? query.vertices().iterator() : query.edges().iterator();
    });
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:16,代码来源:TitanGraphStep.java

示例6: UniGraphStartStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
public UniGraphStartStep(GraphStep<S, E> originalStep, ControllerManager controllerManager) {
    super(originalStep.getTraversal(), originalStep.getReturnClass(), originalStep.isStartStep(), originalStep.getIds());
    originalStep.getLabels().forEach(this::addLabel);
    this.predicates = UniGraph.createIdPredicate(originalStep.getIds(), originalStep.getReturnClass());
    this.stepDescriptor = new StepDescriptor(this);
    this.controllers = controllerManager.getControllers(SearchQuery.SearchController.class);
    this.setIteratorSupplier(this::query);
    limit = -1;
    this.propertyKeys = new HashSet<>();
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:11,代码来源:UniGraphStartStep.java

示例7: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    TraversalHelper.getStepsOfAssignableClass(HasStep.class, traversal).stream()
            .filter(hasStep -> ((HasStep<?>) hasStep).getHasContainers().get(0).getKey().equals(T.id.getAccessor()))
            .forEach(hasStep -> ((HasStep<?>) hasStep).getHasContainers().get(0).setKey(this.idPropertyKey));

    if (traversal.getStartStep() instanceof GraphStep) {
        final GraphStep graphStep = (GraphStep) traversal.getStartStep();
        // only need to apply the custom id if ids were assigned - otherwise we want the full iterator.
        // note that it is then only necessary to replace the step if the id is a non-element.  other tests
        // in the suite validate that items in getIds() is uniform so it is ok to just test the first item
        // in the list.
        if (graphStep.getIds().length > 0 && !(graphStep.getIds()[0] instanceof Element)) {
            if (graphStep instanceof HasContainerHolder)
                ((HasContainerHolder) graphStep).addHasContainer(new HasContainer(this.idPropertyKey, P.within(Arrays.asList(graphStep.getIds()))));
            else
                TraversalHelper.insertAfterStep(new HasStep(traversal, new HasContainer(this.idPropertyKey, P.within(Arrays.asList(graphStep.getIds())))), graphStep, traversal);
            graphStep.clearIds();
        }
    }
    TraversalHelper.getStepsOfAssignableClass(IdStep.class, traversal).stream().forEach(step -> {
        TraversalHelper.replaceStep(step, new PropertiesStep(traversal, PropertyType.VALUE, idPropertyKey), traversal);
    });

    // in each case below, determine if the T.id is present and if so, replace T.id with the idPropertyKey or if
    // it is not present then shove it in there and generate an id
    traversal.getSteps().forEach(step -> {
        if (step instanceof AddVertexStep || step instanceof AddVertexStartStep || step instanceof AddEdgeStep) {
            final Parameterizing parameterizing = (Parameterizing) step;
            if (parameterizing.getParameters().contains(T.id))
                parameterizing.getParameters().rename(T.id, this.idPropertyKey);
            else if (!parameterizing.getParameters().contains(this.idPropertyKey))
                parameterizing.getParameters().set(null, this.idPropertyKey, idMaker.get());
        }
    });
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:37,代码来源:ElementIdStrategy.java

示例8: BitsyGraphStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
public BitsyGraphStep(final GraphStep<S, E> originalGraphStep) {
    super(originalGraphStep.getTraversal(), originalGraphStep.getReturnClass(), originalGraphStep.isStartStep(), originalGraphStep.getIds());
    originalGraphStep.getLabels().forEach(this::addLabel);
    this.setIteratorSupplier(() -> (Iterator<E>) (Vertex.class.isAssignableFrom(this.returnClass) ? this.vertices() : this.edges()));
}
 
开发者ID:lambdazen,项目名称:bitsy,代码行数:6,代码来源:BitsyGraphStep.java

示例9: HBaseGraphStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public HBaseGraphStep(final GraphStep<S, E> originalGraphStep) {
    super(originalGraphStep.getTraversal(), originalGraphStep.getReturnClass(), originalGraphStep.isStartStep(), originalGraphStep.getIds());
    originalGraphStep.getLabels().forEach(this::addLabel);
    this.setIteratorSupplier(() -> (Iterator<E>) (Vertex.class.isAssignableFrom(this.returnClass) ? this.vertices() : this.edges()));
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:7,代码来源:HBaseGraphStep.java

示例10: Neo4jGraphStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
public Neo4jGraphStep(final GraphStep<S, E> originalGraphStep) {
    super(originalGraphStep.getTraversal(), originalGraphStep.getReturnClass(), originalGraphStep.isStartStep(), originalGraphStep.getIds());
    originalGraphStep.getLabels().forEach(this::addLabel);
    this.setIteratorSupplier(() -> (Iterator<E>) (Vertex.class.isAssignableFrom(this.returnClass) ? this.vertices() : this.edges()));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:6,代码来源:Neo4jGraphStep.java

示例11: OrientGraphStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
public OrientGraphStep(final GraphStep<S, E> originalGraphStep) {
    super(originalGraphStep.getTraversal(), originalGraphStep.getReturnClass(), originalGraphStep.isStartStep(), originalGraphStep.getIds());
    originalGraphStep.getLabels().forEach(this::addLabel);
    this.setIteratorSupplier(() -> (Iterator<E>) (isVertexStep() ? this.vertices() : this.edges()));
}
 
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:6,代码来源:OrientGraphStep.java

示例12: constructSqlgStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入方法依赖的package包/类
@Override
protected SqlgStep constructSqlgStep(Step startStep) {
    Preconditions.checkArgument(startStep instanceof GraphStep, "Expected a GraphStep, found instead a " + startStep.getClass().getName());
    GraphStep<?, ?> graphStep = (GraphStep) startStep;
    return new SqlgGraphStep(this.sqlgGraph, this.traversal, graphStep.getReturnClass(), graphStep.isStartStep(), graphStep.getIds());
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:7,代码来源:GraphStrategy.java


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