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


Java Path.get方法代码示例

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


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

示例1: getScopeValue

import org.apache.tinkerpop.gremlin.process.traversal.Path; //导入方法依赖的package包/类
public default <S> S getScopeValue(final Pop pop, final String key, final Traverser.Admin<?> traverser) throws IllegalArgumentException {
    if (traverser.getSideEffects().exists(key))
        return traverser.getSideEffects().<S>get(key);
    ///
    final Object object = traverser.get();
    if (object instanceof Map && ((Map<String, S>) object).containsKey(key))
        return ((Map<String, S>) object).get(key);
    ///
    final Path path = traverser.path();
    if (path.hasLabel(key))
        return null == pop ? path.get(key) : path.get(pop, key);
    ///
    throw new IllegalArgumentException("Neither the sideEffects, map, nor path has a " + key + "-key: " + this);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:15,代码来源:Scoping.java

示例2: getNullableScopeValue

import org.apache.tinkerpop.gremlin.process.traversal.Path; //导入方法依赖的package包/类
public default <S> S getNullableScopeValue(final Pop pop, final String key, final Traverser.Admin<?> traverser) {
    if (traverser.getSideEffects().exists(key))
        return traverser.getSideEffects().<S>get(key);
    ///
    final Object object = traverser.get();
    if (object instanceof Map && ((Map<String, S>) object).containsKey(key))
        return ((Map<String, S>) object).get(key);
    ///
    final Path path = traverser.path();
    if (path.hasLabel(key))
        return null == pop ? path.get(key) : path.get(pop, key);
    ///
    return null;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:15,代码来源:Scoping.java

示例3: shouldSerializePathAsDetached

import org.apache.tinkerpop.gremlin.process.traversal.Path; //导入方法依赖的package包/类
@Test
@LoadGraphWith(LoadGraphWith.GraphData.MODERN)
public void shouldSerializePathAsDetached() throws Exception {
    final GryoIo gryoIo = graph.io(GryoIo.build());
    final GryoWriter gryoWriter = gryoIo.writer().create();
    final GryoReader gryoReader = gryoIo.reader().create();

    final Path p = g.V(convertToVertexId("marko")).as("a").outE().as("b").inV().as("c").path()
            .filter(t -> ((Vertex) t.get().objects().get(2)).value("name").equals("lop")).next();
    final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    gryoWriter.writeObject(outputStream, p);

    final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
    final Path detached = gryoReader.readObject(inputStream, DetachedPath.class);
    assertNotNull(detached);
    assertEquals(p.labels().size(), detached.labels().size());
    assertEquals(p.labels().get(0).size(), detached.labels().get(0).size());
    assertEquals(p.labels().get(1).size(), detached.labels().get(1).size());
    assertEquals(p.labels().get(2).size(), detached.labels().get(2).size());
    assertTrue(p.labels().stream().flatMap(Collection::stream).allMatch(detached::hasLabel));

    final Vertex vOut = p.get("a");
    final Vertex detachedVOut = detached.get("a");
    assertEquals(vOut.label(), detachedVOut.label());
    assertEquals(vOut.id(), detachedVOut.id());

    // this is a SimpleTraverser so no properties are present in detachment
    assertFalse(detachedVOut.properties().hasNext());

    final Edge e = p.get("b");
    final Edge detachedE = detached.get("b");
    assertEquals(e.label(), detachedE.label());
    assertEquals(e.id(), detachedE.id());

    // this is a SimpleTraverser so no properties are present in detachment
    assertFalse(detachedE.properties().hasNext());

    final Vertex vIn = p.get("c");
    final Vertex detachedVIn = detached.get("c");
    assertEquals(vIn.label(), detachedVIn.label());
    assertEquals(vIn.id(), detachedVIn.id());

    // this is a SimpleTraverser so no properties are present in detachment
    assertFalse(detachedVIn.properties().hasNext());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:46,代码来源:SerializationTest.java


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