Examples of Vertex


Examples of org.securegraph.Vertex

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

        String widthStr = getOptionalParameter(request, "width");
        int[] boundaryDims = new int[]{200, 200};

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

        if (widthStr != null) {
            boundaryDims[0] = boundaryDims[1] = Integer.parseInt(widthStr);

            response.setContentType("image/jpeg");
            response.addHeader("Content-Disposition", "inline; filename=thumbnail" + boundaryDims[0] + ".jpg");
            setMaxAge(response, EXPIRES_1_HOUR);

            byte[] thumbnailData = artifactThumbnailRepository.getThumbnailData(artifactVertex.getId(), "poster-frame", boundaryDims[0], boundaryDims[1], user);
            if (thumbnailData != null) {
                LOGGER.debug("Cache hit for: %s (poster-frame) %d x %d", graphVertexId, boundaryDims[0], boundaryDims[1]);
                ServletOutputStream out = response.getOutputStream();
                out.write(thumbnailData);
                out.close();
                return;
            }
        }

        StreamingPropertyValue rawPosterFrameValue = RAW_POSTER_FRAME.getPropertyValue(artifactVertex);
        if (rawPosterFrameValue == null) {
            LOGGER.warn("Could not find raw poster from for artifact: %s", artifactVertex.getId());
            respondWithNotFound(response);
            return;
        }

        InputStream in = rawPosterFrameValue.getInputStream();
View Full Code Here

Examples of org.securegraph.Vertex

        public boolean download;
        public boolean playback;
    }

    public void handle(HttpServletResponse response, String graphVertexId, String propertyName, String propertyKey, PlaybackOptions playbackOptions, Authorizations authorizations) throws IOException {
        Vertex vertex = graph.getVertex(graphVertexId, authorizations);
        if (vertex == null) {
            respondWithNotFound(response, String.format("vertex %s not found", graphVertexId));
            return;
        }

        Property property = vertex.getProperty(propertyKey, propertyName);
        if (property == null) {
            respondWithNotFound(response, String.format("property %s:%s not found on vertex %s", propertyKey, propertyName, vertex.getId()));
            return;
        }

        handle(response, vertex, property, playbackOptions);
    }
View Full Code Here

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

Examples of org.securegraph.Vertex

        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

Examples of org.securegraph.Vertex

        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

Examples of org.securegraph.Vertex

        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

Examples of org.securegraph.Vertex

        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

Examples of org.securegraph.Vertex

                .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

Examples of org.securegraph.Vertex

        );
    }

    @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

Examples of org.securegraph.Vertex

        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
TOP
Copyright © 2018 www.massapi.com. 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.