Package org.securegraph

Examples of org.securegraph.VertexBuilder


        return depth;
    }

    private Vertex createPageVertex(LineData lineData) {
        String wikipediaPageVertexId = WikipediaConstants.getWikipediaPageVertexId(lineData.getPageTitle());
        VertexBuilder pageVertexBuilder = prepareVertex(wikipediaPageVertexId, visibility);
        LumifyProperties.CONCEPT_TYPE.setProperty(pageVertexBuilder, WikipediaConstants.WIKIPEDIA_PAGE_CONCEPT_URI, visibility);

        Map<String, Object> titleMetadata = new HashMap<String, Object>();
        LumifyProperties.CONFIDENCE.setMetadata(titleMetadata, 0.1);
        LumifyProperties.TITLE.addPropertyValue(pageVertexBuilder, ImportMR.MULTI_VALUE_KEY, lineData.getPageTitle(), titleMetadata, visibility);

        return pageVertexBuilder.save(authorizations);
    }
View Full Code Here


    private Vertex importCountryNode(String id, Node countryNode) throws XPathExpressionException {
        String name = getAttributeValue(countryNode, "name");

        LOGGER.debug("importing %s:%s", id, name);

        VertexBuilder vertex = getGraph().prepareVertex(COUNTRY_ID_PREFIX + id, visibility);
        LumifyProperties.CONCEPT_TYPE.setProperty(vertex, WorldFactbookOntology.CONCEPT_TYPE_COUNTRY, visibility);
        LumifyProperties.TITLE.addPropertyValue(vertex, MULTI_VALUE_KEY, name, visibility);

        NodeList fieldNodes = (NodeList) fieldsXPath.evaluate(countryNode, XPathConstants.NODESET);
        for (int i = 0; i < fieldNodes.getLength(); i++) {
            Node fieldNode = fieldNodes.item(i);
            String ref = getAttributeValue(fieldNode, "ref");
            String value = fieldNode.getTextContent();
            vertex.addPropertyValue(MULTI_VALUE_KEY, "http://lumify.io/worldfactbook#" + ref, value, visibility);
        }

        return vertex.save(getAuthorizations());
    }
View Full Code Here

        propertyValue = toValueGeo(row, propertyValue);

        if (propertyValue == null) {
            // skip null values
        } else {
            VertexBuilder v = getDataImporter().getGraph().prepareVertex(getObjectId(row), getDataImporter().getVisibility());
            v.addPropertyValue(propertyKey, propertyName, propertyValue, getDataImporter().getVisibility());
            v.save(getDataImporter().getAuthorizations());
        }
    }
View Full Code Here

            String title = row.getTitle();
            if (title == null) {
                title = "";
            }

            VertexBuilder vertexBuilder = getDataImporter().getGraph().prepareVertex(getMediaId(row), getDataImporter().getVisibility());
            LumifyProperties.RAW.addPropertyValue(vertexBuilder, propertyKey, propertyValue, getDataImporter().getVisibility());
            LumifyProperties.TITLE.setProperty(vertexBuilder, title, getDataImporter().getVisibility());
            Vertex mediaVertex = vertexBuilder.save(getDataImporter().getAuthorizations());

            Vertex sourceVertex = getVertexCache().get(getObjectVertexId(row.getLinkObjectId()));
            checkNotNull(sourceVertex, "Could not find source vertex for media object: " + row.getLinkObjectId());

            String edgeId = getEdgeId(row);
View Full Code Here

        if (ptObjectType == null) {
            throw new LumifyException("Could not find object type: " + row.getType());
        }
        String conceptTypeUri = getConceptTypeUri(ptObjectType.getUri());

        VertexBuilder v = getDataImporter().getGraph().prepareVertex(getObjectId(row), getDataImporter().getVisibility());
        LumifyProperties.CONCEPT_TYPE.setProperty(v, conceptTypeUri, getDataImporter().getVisibility());
        v.save(getDataImporter().getAuthorizations());
    }
View Full Code Here

        }

        String edgeId = TheMovieDbOntology.getHasImageEdgeId(key.getId(), key.getImagePath());
        String title = key.getTitle();
        String vertexId = TheMovieDbOntology.getImageVertexId(key.getImagePath());
        VertexBuilder m = prepareVertex(vertexId, visibility);
        LumifyProperties.CONCEPT_TYPE.addPropertyValue(m, MULTI_VALUE_KEY, conceptType, visibility);
        LumifyProperties.SOURCE.addPropertyValue(m, MULTI_VALUE_KEY, SOURCE, visibility);
        StreamingPropertyValue rawValue = new StreamingPropertyValue(new ByteArrayInputStream(value.getBytes()), byte[].class);
        rawValue.store(true);
        rawValue.searchIndex(false);
        LumifyProperties.RAW.addPropertyValue(m, MULTI_VALUE_KEY, rawValue, visibility);
        LumifyProperties.TITLE.addPropertyValue(m, MULTI_VALUE_KEY, "Image of " + title, visibility);
        Vertex profileImageVertex = m.save(authorizations);

        VertexBuilder sourceVertexMutation = prepareVertex(sourceVertexId, visibility);
        LumifyProperties.ENTITY_IMAGE_VERTEX_ID.addPropertyValue(sourceVertexMutation, MULTI_VALUE_KEY, profileImageVertex.getId(), visibility);
        Vertex sourceVertex = sourceVertexMutation.save(authorizations);

        addEdge(edgeId, sourceVertex, profileImageVertex, edgeLabel, visibility, authorizations);

        context.getCounter(TheMovieDbImportCounters.IMAGES_PROCESSED).increment(1);
    }
View Full Code Here

TOP

Related Classes of org.securegraph.VertexBuilder

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.