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


Java GraphTraversal.as方法代码示例

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


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

示例1: applyTraversal

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
/**
 * @param traversal the traversal to extend with this Fragment
 * @param graph     the graph to execute the traversal on
 */
public final GraphTraversal<Vertex, ? extends Element> applyTraversal(
        GraphTraversal<Vertex, ? extends Element> traversal, GraknTx graph,
        Collection<Var> vars, @Nullable Var currentVar) {
    if (currentVar != null) {
        if (!currentVar.equals(start())) {
            if (vars.contains(start())) {
                // If the variable name has been visited but the traversal is not at that variable name, select it
                traversal.select(start().name());
            } else {
                // Restart traversal when fragments are disconnected
                traversal.V().as(start().name());
            }
        }
    } else {
        // If the variable name has not been visited yet, remember it and use the 'as' step
        traversal.as(start().name());
    }

    vars.add(start());

    traversal = applyTraversalInner(traversal, graph, vars);

    Var end = end();
    if (end != null) {
        assignVar(traversal, end, vars);
    }

    vars.addAll(vars());

    return traversal;
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:36,代码来源:Fragment.java

示例2: assignVar

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
static <T, U> GraphTraversal<T, U> assignVar(GraphTraversal<T, U> traversal, Var var, Collection<Var> vars) {
    if (!vars.contains(var)) {
        // This variable name has not been encountered before, remember it and use the 'as' step
        return traversal.as(var.name());
    } else {
        // This variable name has been encountered before, confirm it is the same
        return traversal.where(P.eq(var.name()));
    }
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:10,代码来源:Fragment.java

示例3: traverseToRole

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
/**
 * Optionally traverse from a {@link Schema.EdgeLabel#ROLE_PLAYER} edge to the {@link Role} it mentions, plus any super-types.
 *
 * @param traversal the traversal, starting from the {@link Schema.EdgeLabel#ROLE_PLAYER}  edge
 * @param role the variable to assign to the role. If not present, do nothing
 * @param edgeProperty the edge property to look up the role label ID
 */
static void traverseToRole(
        GraphTraversal<?, Edge> traversal, @Nullable Var role, Schema.EdgeProperty edgeProperty,
        Collection<Var> vars) {
    if (role != null) {
        Var edge = Graql.var();
        traversal.as(edge.name());
        Fragments.outSubs(Fragments.traverseSchemaConceptFromEdge(traversal, edgeProperty));
        assignVar(traversal, role, vars).select(edge.name());
    }
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:18,代码来源:AbstractRolePlayerFragment.java


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