@Override public void shortestPath(final Vertex fromNode, Integer node) { final Vertex v2 = titanGraph.getVertices(NODE_ID, node).iterator().next(); @SuppressWarnings("rawtypes") final GremlinPipeline<String, List> pathPipe = new GremlinPipeline<String, List>(fromNode).as(SIMILAR) .out(SIMILAR).loop(SIMILAR, new PipeFunction<LoopBundle<Vertex>, Boolean>() { // @Override public Boolean compute(LoopBundle<Vertex> bundle) { return bundle.getLoops() < 5 && !bundle.getObject().equals(v2); } }).path(); }
@Override public void query(GraphRewrite event, GremlinPipeline<Vertex, Vertex> pipeline) { Predicate regexPredicate = new Predicate() { @Override public boolean evaluate(Object first, Object second) { return ((String) first).matches((String) second); } }; pipeline.as("result") .out(FileReferenceModel.FILE_MODEL) .out(JavaSourceFileModel.JAVA_CLASS_MODEL) .has(JavaClassModel.QUALIFIED_NAME, regexPredicate, compiledTypeFilterPattern.pattern()) .back("result"); } }
public boolean isMavenConfiguration(XmlFileModel resource) { return (new GremlinPipeline<Vertex, Vertex>(resource.asVertex())).in("xmlFacet").as("facet") .has(WindupVertexFrame.TYPE_PROP, this.getTypeValueForSearch()).back("facet") .iterator().hasNext(); }
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(); }
public MavenProjectModel getMavenConfigurationFromResource(XmlFileModel resource) { @SuppressWarnings("unchecked") Iterator<Vertex> v = (Iterator<Vertex>) (new GremlinPipeline<Vertex, Vertex>(resource.asVertex())) .in("xmlFacet").as("facet") .has(WindupVertexFrame.TYPE_PROP, this.getTypeValueForSearch()).back("facet") .iterator(); if (v.hasNext()) { return getGraphContext().getFramed().frame(v.next(), this.getType()); } return null; }
pipeline.has(WindupVertexFrame.TYPE_PROP, Text.CONTAINS, InlineHintModel.TYPE); pipeline.as("inlineHintVertex"); pipeline.out(InlineHintModel.FILE_LOCATION_REFERENCE).has(WindupVertexFrame.TYPE_PROP, Text.CONTAINS, JavaTypeReferenceModel.TYPE);