@Override public GraphTraversalSource traversal(final Graph graph) { return new GraphTraversalSource(graph).withComputer(FulgoraGraphComputer.class); }
@Override public GraphTraversalSource traversal(final Graph graph, final TraversalStrategy... strategies) { return new GraphTraversalSource(graph).withComputer(FulgoraGraphComputer.class).withStrategies(strategies); }
/** * Generate a reusable {@link GraphTraversalSource} instance. * The {@link GraphTraversalSource} provides methods for creating * {@link org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal} instances. * * @return A graph traversal source */ public default GraphTraversalSource traversal() { return new GraphTraversalSource(this); }
/** * Generate a reusable {@link GraphTraversalSource} instance. * The {@link GraphTraversalSource} provides methods for creating * {@link org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal} instances. * * @return A graph traversal source */ public default GraphTraversalSource traversal() { return new GraphTraversalSource(this); }
/** * Get all {@link InlineHintModel} instances attached to this {@link ReportFileModel} */ default List<InlineHintModel> getInlineHints() { List<Vertex> vertices = new GraphTraversalSource(getWrappedGraph().getBaseGraph()).V(getElement()) .in(FileReferenceModel.FILE_MODEL) .has(WindupVertexFrame.TYPE_PROP, InlineHintModel.TYPE) .toList(); return vertices.stream().map(v -> getGraph().frameElement(v, InlineHintModel.class)) .collect(Collectors.toList()); }
/** * Get all {@link ClassificationModel} instances attached to this {@link ReportFileModel} */ @Adjacency(label = ClassificationModel.FILE_MODEL, direction = Direction.IN) default List<ClassificationModel> getClassificationModels() { List<Vertex> vertices = new GraphTraversalSource(getWrappedGraph().getBaseGraph()).V(getElement()) .in(ClassificationModel.FILE_MODEL) .toList(); return vertices.stream().map(v -> getGraph().frameElement(v, ClassificationModel.class)) .collect(Collectors.toList()); }
/** * Get all {@link InlineHintModel} instances attached to this {@link ReportFileModel} */ default List<InlineHintModel> getInlineHints() { List<Vertex> vertices = new GraphTraversalSource(getWrappedGraph().getBaseGraph()).V(getElement()) .in(FileReferenceModel.FILE_MODEL) .has(WindupVertexFrame.TYPE_PROP, InlineHintModel.TYPE) .toList(); return vertices.stream().map(v -> getGraph().frameElement(v, InlineHintModel.class)) .collect(Collectors.toList()); }
/** * Returns the number of method parameters to this method */ default long countParameters() { return new GraphTraversalSource(getWrappedGraph().getBaseGraph()).V(getElement()) .in(METHOD_PARAMETER).toList().size(); }
private Iterable<InlineHintModel> getInlineHintModels(List<Vertex> initialProjectVertices) { GraphTraversal<Vertex, Vertex> inlineHintPipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(initialProjectVertices); inlineHintPipeline.out(ProjectModel.PROJECT_MODEL_TO_FILE); inlineHintPipeline.in(InlineHintModel.FILE_MODEL).has(WindupVertexFrame.TYPE_PROP, P.eq(InlineHintModel.TYPE)); Set<InlineHintModel> results = new LinkedHashSet<>(); for (Vertex v : inlineHintPipeline.toList()) { results.add(frame(v)); } return results; }
/** * Gets all {@link JarManifestModel}s associated with this archive. */ public Iterable<JarManifestModel> getManifestsByArchive(ArchiveModel archiveModel) { GraphTraversal<Vertex, Vertex> pipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(archiveModel.getElement()); pipeline.out(JarManifestModel.ARCHIVE); return new FramedVertexIterable<>(getGraphContext().getFramed(), pipeline.toList(), JarManifestModel.class); } }
public boolean isMavenConfiguration(XmlFileModel resource) { return new GraphTraversalSource(this.getGraphContext().getGraph()) .V(resource) .in("xmlFacet") .as("facet") .has(WindupVertexFrame.TYPE_PROP, GraphTypeManager.getTypeValue(this.getType())) .select("facet") .hasNext(); }
/** * Gets all {@link InlineHintModel} instances that are directly associated with the given {@link FileReferenceModel} */ public Iterable<InlineHintModel> getHintsForFileReference(FileReferenceModel reference) { GraphTraversal<Vertex, Vertex> inlineHintPipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(reference.getElement()); inlineHintPipeline.in(InlineHintModel.FILE_LOCATION_REFERENCE); inlineHintPipeline.has(WindupVertexFrame.TYPE_PROP, Text.textContains(InlineHintModel.TYPE)); return new FramedVertexIterable<>(getGraphContext().getFramed(), inlineHintPipeline.toList(), InlineHintModel.class); }
/** * Return all {@link ClassificationModel} instances that are attached to the given {@link FileModel} instance. */ public Iterable<ClassificationModel> getClassifications(FileModel model) { GraphTraversal<Vertex, Vertex> pipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(model.getElement()); pipeline.in(ClassificationModel.FILE_MODEL); pipeline.has(WindupVertexFrame.TYPE_PROP, Text.textContains(ClassificationModel.TYPE)); return new FramedVertexIterable<>(getGraphContext().getFramed(), pipeline.toList(), ClassificationModel.class); }
/** * Gets all {@link InlineHintModel} instances that are directly associated with the given {@link FileModel} */ public Iterable<InlineHintModel> getHintsForFile(FileModel file) { GraphTraversal<Vertex, Vertex> inlineHintPipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(file.getElement()); inlineHintPipeline.in(FileReferenceModel.FILE_MODEL); inlineHintPipeline.has(WindupVertexFrame.TYPE_PROP, Text.textContains(InlineHintModel.TYPE)); return new FramedVertexIterable<>(getGraphContext().getFramed(), inlineHintPipeline.toList(), InlineHintModel.class); }
@SuppressWarnings("unchecked") public Iterable<PersistedProjectModelTraversalModel> getRootTraversalsByType(PersistedProjectModelTraversalModel.PersistedTraversalType persistedTraversalType) { List<Vertex> vertexList = new GraphTraversalSource(getGraphContext().getGraph()).V() .has(WindupVertexFrame.TYPE_PROP, PersistedProjectModelTraversalModel.TYPE) .has(PersistedProjectModelTraversalModel.TRAVERSAL_TYPE, persistedTraversalType.toString()) .has(PersistedProjectModelTraversalModel.ROOT, true) .toList(); return new FramedVertexIterable<>(getGraphContext().getFramed(), vertexList, PersistedProjectModelTraversalModel.class); } }
/** * Return all {@link ClassificationModel} instances that are attached to the given {@link FileModel} instance with a specific classification name. */ public Iterable<ClassificationModel> getClassificationByName(FileModel model, String classificationName) { GraphTraversal<Vertex, Vertex> pipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(model.getElement()); pipeline.in(ClassificationModel.FILE_MODEL); pipeline.has(WindupVertexFrame.TYPE_PROP, Text.textContains(ClassificationModel.TYPE)); pipeline.has(ClassificationModel.CLASSIFICATION, classificationName); return new FramedVertexIterable<>(getGraphContext().getFramed(), pipeline.toList(), ClassificationModel.class); }
@Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.has(DoctypeMetaModel.PROPERTY_PUBLIC_ID, Text.textRegex(REGEX_HIBERNATE)); Traversal<?, ?> systemIDQuery = event.getGraphContext().getQuery(DoctypeMetaModel.class) .getRawTraversal().has(DoctypeMetaModel.PROPERTY_SYSTEM_ID, Text.textRegex(REGEX_HIBERNATE)); GraphTraversal<Vertex, Vertex> systemIdPipeline = new GraphTraversalSource(event.getGraphContext().getGraph()).V(systemIDQuery.toList()); pipeline.union(systemIdPipeline); pipeline.dedup(); } };
@Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.has(DoctypeMetaModel.PROPERTY_PUBLIC_ID, Text.textRegex(REGEX_HIBERNATE)); Traversal<?, ?> systemIDQuery = event.getGraphContext().getQuery(DoctypeMetaModel.class) .getRawTraversal().has(DoctypeMetaModel.PROPERTY_SYSTEM_ID, Text.textRegex(REGEX_HIBERNATE)); GraphTraversal<Vertex, Vertex> systemIdPipeline = new GraphTraversalSource(event.getGraphContext().getGraph()).V(systemIDQuery.toList()); pipeline.union(systemIdPipeline); pipeline.dedup(); } };
@Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.has(DoctypeMetaModel.PROPERTY_PUBLIC_ID, Text.textRegex(REGEX_HIBERNATE)); Traversal<?, ?> systemIDQuery = event.getGraphContext().getQuery(DoctypeMetaModel.class) .getRawTraversal() .has(DoctypeMetaModel.PROPERTY_SYSTEM_ID, Text.textRegex(REGEX_HIBERNATE)); GraphTraversal<Vertex, Vertex> systemIdPipeline = new GraphTraversalSource(event.getGraphContext().getGraph()).V(systemIDQuery.toList()); pipeline.union(systemIdPipeline); pipeline.dedup(); } };
@Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.has(DoctypeMetaModel.PROPERTY_PUBLIC_ID, Text.textRegex(REGEX_HIBERNATE)); Traversal<?, ?> systemIDQuery = event.getGraphContext().getQuery(DoctypeMetaModel.class) .getRawTraversal() .has(DoctypeMetaModel.PROPERTY_SYSTEM_ID, Text.textRegex(REGEX_HIBERNATE)); GraphTraversal<Vertex, Vertex> systemIdPipeline = new GraphTraversalSource(event.getGraphContext().getGraph()).V(systemIDQuery.toList()); pipeline.union(systemIdPipeline); pipeline.dedup(); } };