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

Java PropertiesStep类代码示例

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

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



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

示例1: shouldAlterTraversalToIncludeIdWhereNecessary

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
@Test
public void shouldAlterTraversalToIncludeIdWhereNecessary() {
    final ElementIdStrategy strategy = ElementIdStrategy.build().create();
    strategy.apply(traversal.asAdmin());

    final Step step = (Step) traversal.asAdmin().getSteps().get(expectedInsertedSteps);
    if (step instanceof AddVertexStep)
        assertTrue(((AddVertexStep) step).getParameters().contains(strategy.getIdPropertyKey()));
    else if (step instanceof AddVertexStartStep)
        assertTrue(((AddVertexStartStep) step).getParameters().contains(strategy.getIdPropertyKey()));
    else if (step instanceof AddEdgeStep)
        assertTrue(((AddEdgeStep) step).getParameters().contains(strategy.getIdPropertyKey()));
    else if (step instanceof PropertiesStep)
        assertEquals(strategy.getIdPropertyKey(), ((PropertiesStep) step).getPropertyKeys()[0]);
    else
        fail("Check test definition - the expectedInsertedSteps should be the index of the step to trigger the ID substitution");
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:ElementIdStrategyTraverseTest.java


示例2: shouldRemoveStepsCorrectly

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
@Test
public void shouldRemoveStepsCorrectly() {
    final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
    traversal.asAdmin().addStep(new IdentityStep(traversal));
    traversal.asAdmin().addStep(new HasStep(traversal));
    traversal.asAdmin().addStep(new LambdaFilterStep(traversal, traverser -> true));

    traversal.asAdmin().addStep(new PropertiesStep(traversal, PropertyType.VALUE, "marko"));
    traversal.asAdmin().removeStep(3);
    validateToyTraversal(traversal);

    traversal.asAdmin().addStep(0, new PropertiesStep(traversal, PropertyType.PROPERTY, "marko"));
    traversal.asAdmin().removeStep(0);
    validateToyTraversal(traversal);

    traversal.asAdmin().removeStep(1);
    traversal.asAdmin().addStep(1, new HasStep(traversal));
    validateToyTraversal(traversal);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:20,代码来源:TraversalHelperTest.java


示例3: processesPropertyType

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
private static final char processesPropertyType(Step step) {
    while (!(step instanceof EmptyStep)) {
        if (step instanceof FilterStep || step instanceof SideEffectStep)
            step = step.getPreviousStep();
        else if (step instanceof GraphStep && ((GraphStep) step).returnsVertex())
            return 'v';
        else if (step instanceof EdgeVertexStep)
            return 'v';
        else if (step instanceof VertexStep)
            return ((VertexStep) step).returnsVertex() ? 'v' : 'p';
        else if (step instanceof PropertyMapStep || step instanceof PropertiesStep)
            return 'p';
        else
            return 'x';
    }
    return 'x';
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:18,代码来源:SubgraphStrategy.java


示例4: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
@Override
public void apply(Traversal.Admin<?, ?> traversal) {

    // Retrieve all graph (`V()`) steps - this is the step the strategy should replace
    List<GraphStep> graphSteps = TraversalHelper.getStepsOfAssignableClass(GraphStep.class, traversal);

    for (GraphStep graphStep : graphSteps) {
        // For each graph step, confirm it follows this pattern:
        // `V().filter(__.properties(a).where(P.eq(b)))`

        if (!(graphStep.getNextStep() instanceof TraversalFilterStep)) continue;
        TraversalFilterStep<Vertex> filterStep = (TraversalFilterStep<Vertex>) graphStep.getNextStep();

        // Retrieve the filter steps e.g. `__.properties(a).where(P.eq(b))`
        List<Step> steps = stepsFromFilterStep(filterStep);

        if (steps.size() < 2) continue;
        Step propertiesStep = steps.get(0); // This is `properties(a)`
        Step whereStep = steps.get(1);      // This is `filter(__.where(P.eq(b)))`

        // Get the property key `a`
        if (!(propertiesStep instanceof PropertiesStep)) continue;
        Optional<String> propertyKey = propertyFromPropertiesStep((PropertiesStep<Vertex>) propertiesStep);
        if (!propertyKey.isPresent()) continue;

        // Get the step label `b`
        if (!(whereStep instanceof WherePredicateStep)) continue;
        Optional<String> label = labelFromWhereEqPredicate((WherePredicateStep<Vertex>) whereStep);
        if (!label.isPresent()) continue;

        executeStrategy(traversal, graphStep, filterStep, propertyKey.get(), label.get());
    }
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:34,代码来源:JanusPreviousPropertyStepStrategy.java


示例5: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的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


示例6: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的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


示例7: isLocalElement

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
private static boolean isLocalElement(final Step<?, ?> step) {
    return step instanceof PropertiesStep || step instanceof PropertyMapStep ||
            step instanceof IdStep || step instanceof LabelStep || step instanceof SackStep ||
            step instanceof PropertyKeyStep || step instanceof PropertyValueStep ||
            step instanceof TailGlobalStep || step instanceof RangeGlobalStep || step instanceof HasStep ||
            step instanceof ConnectiveStep;
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:8,代码来源:MasterExecutor.java


示例8: propertyFromPropertiesStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
private Optional<String> propertyFromPropertiesStep(PropertiesStep<Vertex> propertiesStep) {
    String[] propertyKeys = propertiesStep.getPropertyKeys();
    if (propertyKeys.length != 1) return Optional.empty();
    return Optional.of(propertyKeys[0]);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:6,代码来源:JanusPreviousPropertyStepStrategy.java


示例9: has

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
public default GraphTraversal<S, E> has(final String propertyKey, final Traversal<?, ?> propertyTraversal) {
    return this.filter(propertyTraversal.asAdmin().addStep(0, new PropertiesStep(propertyTraversal.asAdmin(), PropertyType.VALUE, propertyKey)));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:4,代码来源:GraphTraversal.java


示例10: isLocalStarGraph

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
private static char isLocalStarGraph(final Traversal.Admin<?, ?> traversal, char state) {
    if (state == 'u' &&
            (traversal instanceof ElementValueTraversal ||
                    (traversal instanceof TokenTraversal && !((TokenTraversal) traversal).getToken().equals(T.id))))
        return 'x';
    for (final Step step : traversal.getSteps()) {
        if ((step instanceof PropertiesStep || step instanceof LabelStep || step instanceof PropertyMapStep) && state == 'u')
            return 'x';
        else if (step instanceof VertexStep) {
            if (state == 'u') return 'x';
            state = ((VertexStep) step).returnsVertex() ? 'u' : 'e';
        } else if (step instanceof EdgeVertexStep) {
            state = 'u';
        } else if (step instanceof HasContainerHolder && state == 'u') {
            if (((HasContainerHolder) step).getHasContainers().stream()
                    .filter(c -> !c.getKey().equals(T.id.getAccessor()))
                    .findAny().isPresent()) return 'x';
        } else if (step instanceof TraversalParent) {
            final char currState = state;
            Set<Character> states = ((TraversalParent) step).getLocalChildren().stream()
                    .map(t -> isLocalStarGraph(t.asAdmin(), currState))
                    .collect(Collectors.toSet());
            if (states.contains('x'))
                return 'x';
            else if (!(step instanceof ByModulating)) {
                if (states.contains('u'))
                    state = 'u';
                else if (states.contains('e'))
                    state = 'e';
            }
            states = ((TraversalParent) step).getGlobalChildren().stream()
                    .map(t -> isLocalStarGraph(t.asAdmin(), currState))
                    .collect(Collectors.toSet());
            if (states.contains('x'))
                return 'x';
            else if (states.contains('u'))
                state = 'u';
            else if (states.contains('e'))
                state = 'e';
            if (state != currState && (step instanceof RepeatStep || step instanceof MatchStep))
                return 'x';
        }
    }
    return state;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:46,代码来源:TraversalHelper.java


示例11: isLocalElement

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
private static boolean isLocalElement(final Step<?, ?> step) {
    return step instanceof PropertiesStep || step instanceof PropertyMapStep ||
            step instanceof IdStep || step instanceof LabelStep || step instanceof SackStep ||
            step instanceof PropertyKeyStep || step instanceof PropertyValueStep ||
            step instanceof TailGlobalStep || step instanceof RangeGlobalStep || step instanceof HasStep;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:7,代码来源:MasterExecutor.java


示例12: TitanPropertiesStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的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


示例13: has

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
/**
 * Filters vertices, edges and vertex properties based on their properties.
 *
 * @param accessor          the {@link T} accessor of the property to filter on
 * @param propertyTraversal the traversal to filter the accessor value by
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.1.0-incubating
 */
public default GraphTraversal<S, E> has(final T accessor, final Traversal<?, ?> propertyTraversal) {
    this.asAdmin().getBytecode().addStep(Symbols.has, accessor, propertyTraversal);
    return this.asAdmin().addStep(
            new TraversalFilterStep<>(this.asAdmin(), propertyTraversal.asAdmin().addStep(0,
                    new PropertiesStep(propertyTraversal.asAdmin(), PropertyType.VALUE, accessor.getAccessor()))));
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:16,代码来源:GraphTraversal.java


示例14: properties

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
/**
 * Map the {@link Element} to its associated properties given the provide property keys.
 * If no property keys are provided, then all properties are emitted.
 *
 * @param propertyKeys the properties to retrieve
 * @param <E2>         the value type of the returned properties
 * @return the traversal with an appended {@link PropertiesStep}.
 */
public default <E2> GraphTraversal<S, ? extends Property<E2>> properties(final String... propertyKeys) {
    return this.asAdmin().addStep(new PropertiesStep<>(this.asAdmin(), PropertyType.PROPERTY, propertyKeys));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:GraphTraversal.java


示例15: values

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
/**
 * Map the {@link Element} to the values of the associated properties given the provide property keys.
 * If no property keys are provided, then all property values are emitted.
 *
 * @param propertyKeys the properties to retrieve their value from
 * @param <E2>         the value type of the properties
 * @return the traversal with an appended {@link PropertiesStep}.
 */
public default <E2> GraphTraversal<S, E2> values(final String... propertyKeys) {
    return this.asAdmin().addStep(new PropertiesStep<>(this.asAdmin(), PropertyType.VALUE, propertyKeys));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:GraphTraversal.java


示例16: isOptimizable

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
/**
 * Checks whether a given step is optimizable or not.
 *
 * @param step the step to check
 * @return <code>true</code> if the step is optimizable, otherwise <code>false</code>
 */
private static boolean isOptimizable(final Step step) {
    return ((step instanceof VertexStep && ((VertexStep) step).returnsVertex()) ||
            (step instanceof PropertiesStep && PropertyType.VALUE.equals(((PropertiesStep) step).getReturnType()))) && (step.getTraversal().getEndStep().getLabels().isEmpty() || step.getNextStep() instanceof CountGlobalStep);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:11,代码来源:AdjacentToIncidentStrategy.java


示例17: properties

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
/**
 * Map the {@link Element} to its associated properties given the provide property keys.
 * If no property keys are provided, then all properties are emitted.
 *
 * @param propertyKeys the properties to retrieve
 * @param <E2>         the value type of the returned properties
 * @return the traversal with an appended {@link PropertiesStep}.
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#properties-step" target="_blank">Reference Documentation - Properties Step</a>
 * @since 3.0.0-incubating
 */
public default <E2> GraphTraversal<S, ? extends Property<E2>> properties(final String... propertyKeys) {
    this.asAdmin().getBytecode().addStep(Symbols.properties, propertyKeys);
    return this.asAdmin().addStep(new PropertiesStep<>(this.asAdmin(), PropertyType.PROPERTY, propertyKeys));
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:15,代码来源:GraphTraversal.java


示例18: values

import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; //导入依赖的package包/类
/**
 * Map the {@link Element} to the values of the associated properties given the provide property keys.
 * If no property keys are provided, then all property values are emitted.
 *
 * @param propertyKeys the properties to retrieve their value from
 * @param <E2>         the value type of the properties
 * @return the traversal with an appended {@link PropertiesStep}.
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#values-step" target="_blank">Reference Documentation - Values Step</a>
 * @since 3.0.0-incubating
 */
public default <E2> GraphTraversal<S, E2> values(final String... propertyKeys) {
    this.asAdmin().getBytecode().addStep(Symbols.values, propertyKeys);
    return this.asAdmin().addStep(new PropertiesStep<>(this.asAdmin(), PropertyType.VALUE, propertyKeys));
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:15,代码来源:GraphTraversal.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java UnsignedIntegerTwoBytes类代码示例发布时间: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