Package com.tinkerpop.blueprints

Examples of com.tinkerpop.blueprints.Vertex


                    .entity(JSONObject.quote("An error occurred: " + e.getMessage())).build());
        }
    }

    private Vertex findVertex(String vertexId) {
        Vertex vertex = getGraph().getVertex(vertexId);
        if (vertex == null) {
            String message = "Vertex with [" + vertexId + "] cannot be found.";
            LOG.info(message);
            throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)
                    .entity(JSONObject.quote(message)).build());
View Full Code Here


                                        @DefaultValue("false") @QueryParam("relationships")
                                        final String relationships) {
        checkIfMetadataMappingServiceIsEnabled();
        LOG.info("Get vertex for vertexId= " + vertexId);
        try {
            Vertex vertex = findVertex(vertexId);

            Map<String, String> vertexProperties = getVertexProperties(vertex, Boolean.valueOf(relationships));

            JSONObject response = new JSONObject();
            response.put(RESULTS, new JSONObject(vertexProperties));
View Full Code Here

                vertex.<String>getProperty(RelationshipProperty.TYPE.getName()));
        // get the properties from relationships
        if (captureRelationships && (vertexType == RelationshipType.FEED_INSTANCE
                || vertexType == RelationshipType.PROCESS_INSTANCE)) {
            for (Edge edge : vertex.getEdges(Direction.OUT)) {
                Vertex toVertex = edge.getVertex(Direction.IN);
                addRelationships(vertexType, toVertex, vertexProperties);
            }
        }

        return vertexProperties;
View Full Code Here

        }
    }

    private void addEntityRelationships(Vertex vertex, Map<String, String> vertexProperties) {
        for (Edge edge : vertex.getEdges(Direction.OUT)) {
            Vertex toVertex = edge.getVertex(Direction.IN);
            String value = toVertex.getProperty(RelationshipProperty.NAME.getName());
            RelationshipType toVertexType = RelationshipType.fromString(
                    toVertex.<String>getProperty(RelationshipProperty.TYPE.getName()));

            switch (toVertexType) {
            case TAGS:
                vertexProperties.put(edge.getLabel(), value);
                break;
View Full Code Here

    public Response getVertexEdges(@PathParam("id") String vertexId,
                                   @PathParam("direction") String direction) {
        checkIfMetadataMappingServiceIsEnabled();
        LOG.info("Get vertex edges for vertexId= " + vertexId + ", direction= " + direction);
        try {
            Vertex vertex = findVertex(vertexId);

            return getVertexEdges(vertex, direction);

        } catch (JSONException e) {
            throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR)
View Full Code Here

        String processInstanceName = getProcessInstanceName(entityName,
                lineageMetadata.get(LineageArgs.NOMINAL_TIME.getOptionName()));
        LOG.info("Adding process instance: " + processInstanceName);

        String timestamp = getTimestamp(lineageMetadata);
        Vertex processInstance = addVertex(processInstanceName, RelationshipType.PROCESS_INSTANCE, timestamp);
        addWorkflowInstanceProperties(processInstance, lineageMetadata);

        addInstanceToEntity(processInstance, entityName,
                RelationshipType.PROCESS_ENTITY, RelationshipLabel.INSTANCE_ENTITY_EDGE);
        addInstanceToEntity(processInstance, lineageMetadata.get(LineageArgs.CLUSTER.getOptionName()),
View Full Code Here

                + SchemaHelper.formatDateUTCToISO8601(nominalTime, PROCESS_INSTANCE_FORMAT);
    }

    public void addInstanceToEntity(Vertex instanceVertex, String entityName,
                                    RelationshipType entityType, RelationshipLabel edgeLabel) {
        Vertex entityVertex = findVertex(entityName, entityType);
        LOG.info("Vertex exists? name=" + entityName + ", type=" + entityType + ", v=" + entityVertex);
        if (entityVertex == null) {
            // todo - throw new IllegalStateException(entityType + " entity vertex must exist " + entityName);
            LOG.error("Illegal State: " + entityType + " vertex must exist for " + entityName);
            return;
View Full Code Here

            LOG.info("Computing feed instance for : name=" + feedName + ", path= "
                    + feedInstancePath + ", in cluster: " + clusterName);
            String feedInstanceName = getFeedInstanceName(feedName, clusterName, feedInstancePath);
            LOG.info("Adding feed instance: " + feedInstanceName);
            Vertex feedInstance = addVertex(feedInstanceName, RelationshipType.FEED_INSTANCE,
                    getTimestamp(lineageMetadata));

            addProcessFeedEdge(processInstance, feedInstance, edgeLabel);

            addInstanceToEntity(feedInstance, feedName,
View Full Code Here

        super(graph, preserveHistory);
    }

    public void addClusterEntity(Cluster clusterEntity) {
        LOG.info("Adding cluster entity: " + clusterEntity.getName());
        Vertex clusterVertex = addVertex(clusterEntity.getName(), RelationshipType.CLUSTER_ENTITY);

        addColoRelation(clusterEntity.getColo(), clusterVertex);
        addDataClassification(clusterEntity.getTags(), clusterVertex);
    }
View Full Code Here

        addDataClassification(clusterEntity.getTags(), clusterVertex);
    }

    public void addFeedEntity(Feed feed) {
        LOG.info("Adding feed entity: " + feed.getName());
        Vertex feedVertex = addVertex(feed.getName(), RelationshipType.FEED_ENTITY);

        addUserRelation(feedVertex);
        addDataClassification(feed.getTags(), feedVertex);
        addGroups(feed.getGroups(), feedVertex);
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.Vertex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.