本文整理汇总了Java中com.tinkerpop.gremlin.java.GremlinPipeline.toList方法的典型用法代码示例。如果您正苦于以下问题:Java GremlinPipeline.toList方法的具体用法?Java GremlinPipeline.toList怎么用?Java GremlinPipeline.toList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tinkerpop.gremlin.java.GremlinPipeline
的用法示例。
在下文中一共展示了GremlinPipeline.toList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPipeline
import com.tinkerpop.gremlin.java.GremlinPipeline; //导入方法依赖的package包/类
@Test
public void testPipeline() throws Exception {
// Add custom data
Vertex a = g.addVertex(null);
Vertex b = g.addVertex(null);
a.setProperty("name", "marko");
b.setProperty("name", "peter");
Edge e = g.addEdge(null, a, b, "knows");
e.setProperty("since", 2006);
// Create a pipeline
GremlinPipeline pipe = new GremlinPipeline();
pipe.start(g.getVertex(1))
.out("knows")
.property("name");
pipe.next(); // the next String name in the pipe
pipe.next(5); // the next 5 String names in the pipe as a List
pipe.iterate(); // while(true) { pipe.next() } (useful when only side-effects are desired)
pipe.toList(); // fill a list of all the elements in the pipe
pipe.count(); // the number of objects in the pipe
}
示例2: functionToInstructions
import com.tinkerpop.gremlin.java.GremlinPipeline; //导入方法依赖的package包/类
public static List<Instruction> functionToInstructions(Function func)
{
GremlinPipeline<Function, Instruction> pipe = new GremlinPipeline<>();
pipe.start(func).out(EdgeTypes.IS_FUNCTION_OF).out(EdgeTypes.IS_BB_OF);
return pipe.toList();
}
示例3: executeQuery
import com.tinkerpop.gremlin.java.GremlinPipeline; //导入方法依赖的package包/类
private List<Vertex> executeQuery() {
GremlinPipeline pipeline = buildPipeline().as("root");
Pipe expressionPipe = queryExpression.asPipe();
// AlwaysQuery returns null for pipe
return expressionPipe == null ? pipeline.toList() :
pipeline.add(expressionPipe).back("root").toList();
}
示例4: getVertexesForSubject
import com.tinkerpop.gremlin.java.GremlinPipeline; //导入方法依赖的package包/类
public static List<Vertex> getVertexesForSubject(
NerdleFact questionExtraction, TinkerGraph graph) {
final List<NerdleArg> questionsArguments = questionExtraction
.getArguments();
final NerdlePredicate questionPredicate = questionExtraction
.getPredicate();
GremlinPipeline<Iterable<Vertex>, Vertex> pipeline = new GremlinPipeline<Iterable<Vertex>, Vertex>();
pipeline.filter(new PipeFunction<Vertex, Boolean>() {
@Override
public Boolean compute(Vertex vertex) {
NerdleFact transform = NerdleGraphTransformer.transform(vertex);
for (NerdleArg arg : transform.getArguments()) {
boolean match = FuzzyStringMatcher.fuzzyArgumentMatcher(
questionsArguments, arg.getText());
if (match)
return true;
}
return false;
}
});
pipeline.start(graph.getVertices(NerdleGraphTransformer.PROPERTY_LEMMA,
questionPredicate.getLemma()));
List<Vertex> list = pipeline.toList();
return list;
}
示例5: functionToAlocs
import com.tinkerpop.gremlin.java.GremlinPipeline; //导入方法依赖的package包/类
public static List<Aloc> functionToAlocs(Function function)
{
GremlinPipeline<Function, Aloc> pipe = new GremlinPipeline<>();
pipe.start(function).out(ALOC_USE_EDGE).dedup().cast(Aloc.class);
return pipe.toList();
}
示例6: getVertexesForArgument
import com.tinkerpop.gremlin.java.GremlinPipeline; //导入方法依赖的package包/类
public static List<Vertex> getVertexesForArgument(
NerdleFact questionExtraction, TinkerGraph graph) {
final NerdlePredicate predicate = questionExtraction.getPredicate();
final NerdleSubject subject = questionExtraction.getSubject();
GremlinPipeline<Iterable<Vertex>, Vertex> pipeline = new GremlinPipeline<Iterable<Vertex>, Vertex>();
pipeline.filter(new PipeFunction<Vertex, Boolean>() {
@Override
public Boolean compute(Vertex vertex) {
boolean subjectMatch = false;
boolean hasArgument = false;
for (Vertex connectedVertex : vertex.getVertices(Direction.OUT)) {
if (connectedVertex
.getProperty(
NerdleGraphTransformer.PROPERTY_CLAUSE_TYPE)
.equals(NerdleGraphTransformer.VALUE_CLAUSE_TYPE_SUBJECT)) {
subjectMatch = FuzzyStringMatcher.fuzzySubjectMatcher(
subject.getText(),
connectedVertex.getProperty(
NerdleGraphTransformer.PROPERTY_TEXT)
.toString());
}
if (connectedVertex
.getProperty(
NerdleGraphTransformer.PROPERTY_CLAUSE_TYPE)
.equals(NerdleGraphTransformer.VALUE_CLAUSE_TYPE_ARGUMENT)) {
hasArgument = true;
}
}
if (subjectMatch && hasArgument) {
return true;
}
return false;
}
});
pipeline.start(graph.getVertices(NerdleGraphTransformer.PROPERTY_LEMMA,
predicate.getLemma()));
List<Vertex> list = pipeline.toList();
// System.out.println(list);
return list;
}