Package org.securegraph

Examples of org.securegraph.Vertex


        NodeList countryNodes = (NodeList) countryXPath.evaluate(doc, XPathConstants.NODESET);
        for (int i = 0; i < countryNodes.getLength(); i++) {
            Node countryNode = countryNodes.item(i);
            String countryId = getAttributeValue(countryNode, "id");
            Vertex countryVertex = importCountryNode(countryId, countryNode);
            importCountryFlag(indirFile, countryId, countryVertex);
            importCountyMap(indirFile, countryId, countryVertex);
        }
    }
View Full Code Here


        if (!flagFileName.exists()) {
            LOGGER.debug("Could not find flag file: %s", flagFileName);
            return null;
        }

        Vertex flagVertex = fileImport.importFile(flagFileName, false, visibilitySource, null, getUser(), getAuthorizations());

        String flagTitle = "Flag of " + LumifyProperties.TITLE.getPropertyValue(countryVertex);
        Map<String, Object> flagImageMetadata = new HashMap<String, Object>();
        LumifyProperties.CONFIDENCE.setMetadata(flagImageMetadata, 0.5);
        LumifyProperties.TITLE.addPropertyValue(flagVertex, MULTI_VALUE_KEY, flagTitle, flagImageMetadata, visibility, getAuthorizations());

        getGraph().addEdge(FLAG_EDGE_ID_PREFIX + countryId, countryVertex, flagVertex, entityHasImageIri, visibility, getAuthorizations());
        LumifyProperties.ENTITY_IMAGE_VERTEX_ID.addPropertyValue(countryVertex, MULTI_VALUE_KEY, flagVertex.getId().toString(), visibility, getAuthorizations());

        return flagVertex;
    }
View Full Code Here

        if (!mapFileName.exists()) {
            LOGGER.debug("Could not find map file: %s", mapFileName);
            return null;
        }

        Vertex mapVertex = fileImport.importFile(mapFileName, false, visibilitySource, null, getUser(), getAuthorizations());

        String flagTitle = "Map of " + LumifyProperties.TITLE.getPropertyValue(countryVertex);
        Map<String, Object> mapImageMetadata = new HashMap<String, Object>();
        LumifyProperties.CONFIDENCE.setMetadata(mapImageMetadata, 0.5);
        LumifyProperties.TITLE.addPropertyValue(mapVertex, MULTI_VALUE_KEY, flagTitle, mapImageMetadata, visibility, getAuthorizations());
View Full Code Here

        ClientApiElement element = handle(graphVertexId, workspaceId, authorizations);
        respondWithClientApiObject(response, element);
    }

    private ClientApiElement handle(String graphVertexId, String workspaceId, Authorizations authorizations) {
        Vertex vertex = graph.getVertex(graphVertexId, authorizations);
        if (vertex == null) {
            return null;
        }
        return ClientApiConverter.toClientApi(vertex, workspaceId, authorizations);
    }
View Full Code Here

        authorizations = new InMemoryAuthorizations(TermMentionRepository.VISIBILITY);
    }

    @Test
    public void testGetHighlightedText() throws Exception {
        Vertex sourceVertex = graph.addVertex("1", visibility, authorizations);

        ArrayList<Vertex> terms = new ArrayList<Vertex>();
        terms.add(createTermMention(sourceVertex, "joe ferner", PERSON_IRI, 18, 28));
        terms.add(createTermMention(sourceVertex, "jeff kunkle", PERSON_IRI, 33, 44, "uniq1"));
        List<OffsetItem> termAndTermMetadata = new EntityHighlighter().convertTermMentionsToOffsetItems(terms, "", authorizations);
View Full Code Here

                .process(process)
                .save(graph, visibilityTranslator, authorizations);
    }

    public void testGetHighlightedTextOverlaps() throws Exception {
        Vertex sourceVertex = graph.addVertex("1", visibility, authorizations);

        ArrayList<Vertex> terms = new ArrayList<Vertex>();
        terms.add(createTermMention(sourceVertex, "joe ferner", PERSON_IRI, 18, 28));
        terms.add(createTermMention(sourceVertex, "jeff kunkle", PERSON_IRI, 18, 21));
        List<OffsetItem> termAndTermMetadata = new EntityHighlighter().convertTermMentionsToOffsetItems(terms, "", authorizations);
View Full Code Here

        );
    }

    @Test
    public void testGetHighlightedTextWithAccentedCharacters() throws Exception {
        Vertex sourceVertex = graph.addVertex("1", visibility, authorizations);

        ArrayList<Vertex> terms = new ArrayList<Vertex>();
        terms.add(createTermMention(sourceVertex, "US", LOCATION_IRI, 48, 50));
        List<OffsetItem> termAndTermMetadata = new EntityHighlighter().convertTermMentionsToOffsetItems(terms, "", authorizations);
        String highlightText = EntityHighlighter.getHighlightedText("Ejército de Liberación Nacional® partnered with US on peace treaty", termAndTermMetadata);
View Full Code Here

        ClientApiElement element = handle(graphVertexId, visibilitySource, workspaceId, user, authorizations);
        respondWithClientApiObject(response, element);
    }

    private ClientApiElement handle(String graphVertexId, String visibilitySource, String workspaceId, User user, Authorizations authorizations) {
        Vertex graphVertex = graph.getVertex(graphVertexId, authorizations);
        if (graphVertex == null) {
            return null;
        }

        LOGGER.info("changing vertex (%s) visibility source to %s", graphVertex.getId(), visibilitySource);

        GraphUtil.VisibilityAndElementMutation<Vertex> setPropertyResult = GraphUtil.updateElementVisibilitySource(visibilityTranslator, graphVertex, GraphUtil.getSandboxStatus(graphVertex, workspaceId), visibilitySource, workspaceId, authorizations);
        auditRepository.auditVertexElementMutation(AuditAction.UPDATE, setPropertyResult.elementMutation, graphVertex, "", user, setPropertyResult.visibility.getVisibility());

        this.graph.flush();
View Full Code Here

        List<String> vertexIdsToGet = new ArrayList<String>();
        List<Vertex> vertices = new ArrayList<Vertex>();

        // get the vertices already in the cache
        for (String vertexId : vertexIds) {
            Vertex v = this.vertexCache.getIfPresent(vertexId);
            if (v == null) {
                vertexIdsToGet.add(vertexId);
            } else {
                vertices.add(v);
            }
        }

        // get the vertices not in the cache
        Iterable<Vertex> newVertices = getDataImporter().getGraph().getVertices(vertexIdsToGet, getDataImporter().getAuthorizations());
        for (Vertex v : newVertices) {
            vertices.add(v);
            this.vertexCache.put(v.getId(), v);
        }

        // build a map to return
        return Maps.uniqueIndex(vertices, new Function<Vertex, String>() {
            @Override
View Full Code Here

        User user = getUser(request);
        Authorizations authorizations = getAuthorizations(request, user);

        String graphVertexId = UrlUtils.urlDecode(getAttributeString(request, "graphVertexId"));

        Vertex artifactVertex = graph.getVertex(graphVertexId, authorizations);
        if (artifactVertex == null) {
            respondWithNotFound(response);
            return;
        }

        String fileName = LumifyProperties.FILE_NAME.getPropertyValue(artifactVertex);
        if (fileName == null) {
            fileName = LumifyProperties.TITLE.getPropertyValue(artifactVertex);
        }

        if (playback) {
            handlePartialPlayback(request, response, artifactVertex, fileName, user);
        } else {
            String mimeType = getMimeType(artifactVertex);
            response.setContentType(mimeType);
            setMaxAge(response, EXPIRES_1_HOUR);
            if (download) {
                response.addHeader("Content-Disposition", "attachment; filename=" + fileName);
            } else {
                response.addHeader("Content-Disposition", "inline; filename=" + fileName);
            }

            StreamingPropertyValue rawValue = LumifyProperties.RAW.getPropertyValue(artifactVertex);
            if (rawValue == null) {
                LOGGER.warn("Could not find raw on artifact: %s", artifactVertex.getId());
                respondWithNotFound(response);
                return;
            }
            InputStream in = rawValue.getInputStream();
            try {
View Full Code Here

TOP

Related Classes of org.securegraph.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.