本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.withStrategies方法的典型用法代码示例。如果您正苦于以下问题:Java GraphTraversalSource.withStrategies方法的具体用法?Java GraphTraversalSource.withStrategies怎么用?Java GraphTraversalSource.withStrategies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
的用法示例。
在下文中一共展示了GraphTraversalSource.withStrategies方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: traversal
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; //导入方法依赖的package包/类
@Override
public GraphTraversalSource traversal(final Graph graph) {
if ((Boolean) graph.configuration().getProperty("skipTest"))
return graph.traversal();
//throw new VerificationException("This test current does not work with Gremlin-Python", EmptyTraversal.instance());
else {
final GraphTraversalSource g = graph.traversal();
return g.withStrategies(new TranslationStrategy(g, new GryoTranslator<>(JavaTranslator.of(g))));
}
}
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:11,代码来源:TinkerGraphGryoTranslatorProvider.java
示例2: traversal
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; //导入方法依赖的package包/类
@Override
public GraphTraversalSource traversal(final Graph graph) {
if ((Boolean) graph.configuration().getProperty("skipTest"))
return graph.traversal();
//throw new VerificationException("This test current does not work with Gremlin-Python", EmptyTraversal.instance());
else {
final GraphTraversalSource g = graph.traversal();
return g.withStrategies(new TranslationStrategy(g, new GraphSONTranslator<>(JavaTranslator.of(g))));
}
}
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:11,代码来源:TinkerGraphGraphSONTranslatorProvider.java
示例3: filter
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; //导入方法依赖的package包/类
private GraphTraversalSource filter(GraphTraversalSource g, HttpExchange exchange) throws IOException {
// Parse the query string
// TODO This should be a Map<String, Collection<String>>
Map<String, String> query = Splitter.on('&')
.omitEmptyStrings()
.withKeyValueSeparator('=')
.split(Strings.nullToEmpty(exchange.getRequestURI().getQuery()));
// Use "?p=00000000-0000-0000-0001-000000000000" to filter by partition
if (query.containsKey("p")) {
String key = g.getGraph().configuration().getString("bdio.partitionStrategy.partitionKey", GraphTool.DEFAULT_PARTITION_KEY);
return g.withStrategies(PartitionStrategy.build()
.partitionKey(key)
.readPartitions(query.get("p")) // TODO This should be a query.get("p").toArray(EMPTY)
.create());
}
// Use "?l=l1,l2,...,lN" to filter by label
if (query.containsKey("l")) {
// TODO This should be splitting each of multiple "l" values
List<String> labels = Splitter.on(",").omitEmptyStrings().splitToList(query.get("l"));
if (!labels.isEmpty()) {
String label = labels.get(0);
String[] otherLabels = labels.subList(1, labels.size()).toArray(EMPTY);
return g.withStrategies(SubgraphStrategy.build()
.vertices(hasLabel(label, otherLabels))
.create());
}
}
// Use "?m=" to filter to metadata only
if (query.containsKey("m")) {
String metadataLabel = g.getGraph().configuration().getString("bdio.metadataLabel");
return g.withStrategies(SubgraphStrategy.build()
.vertices(hasLabel(metadataLabel))
.create());
}
// Just return the unfiltered traversal source
return g;
}