Package io.lumify.web.clientapi.model

Examples of io.lumify.web.clientapi.model.VisibilityJson


        assertEquals(2, edges.getRelationships().size());
        ClientApiElement restonVertex = edges.getRelationships().get(0).getVertex();
        assertHasProperty(restonVertex.getProperties(), ClavinTermMentionFilter.MULTI_VALUE_PROPERTY_KEY, LumifyProperties.CONCEPT_TYPE.getPropertyName(), CONCEPT_TEST_CITY);
        assertHasProperty(restonVertex.getProperties(), ClavinTermMentionFilter.MULTI_VALUE_PROPERTY_KEY, LumifyProperties.SOURCE.getPropertyName(), "CLAVIN");
        assertHasProperty(restonVertex.getProperties(), ClavinTermMentionFilter.MULTI_VALUE_PROPERTY_KEY, LumifyProperties.TITLE.getPropertyName(), "Reston (US, VA)");
        VisibilityJson visibilityJson = new VisibilityJson();
        visibilityJson.setSource("auth1");
        visibilityJson.addWorkspace(lumifyApi.getCurrentWorkspaceId());
        assertHasProperty(restonVertex.getProperties(), ClavinTermMentionFilter.MULTI_VALUE_PROPERTY_KEY, LumifyProperties.VISIBILITY_JSON.getPropertyName(), visibilityJson);

        ClientApiElement zipCodeVertex = edges.getRelationships().get(1).getVertex();
        assertHasProperty(zipCodeVertex.getProperties(), ZipCodeResolverTermMentionFilter.MULTI_VALUE_PROPERTY_KEY, LumifyProperties.CONCEPT_TYPE.getPropertyName(), CONCEPT_TEST_ZIP_CODE);
        assertHasProperty(zipCodeVertex.getProperties(), ZipCodeResolverTermMentionFilter.MULTI_VALUE_PROPERTY_KEY, LumifyProperties.SOURCE.getPropertyName(), "Zip Code Resolver");
        assertHasProperty(zipCodeVertex.getProperties(), ZipCodeResolverTermMentionFilter.MULTI_VALUE_PROPERTY_KEY, LumifyProperties.TITLE.getPropertyName(), "20191 - Reston, VA");
        visibilityJson = new VisibilityJson();
        visibilityJson.setSource("auth1");
        visibilityJson.addWorkspace(lumifyApi.getCurrentWorkspaceId());
        assertHasProperty(zipCodeVertex.getProperties(), ZipCodeResolverTermMentionFilter.MULTI_VALUE_PROPERTY_KEY, LumifyProperties.VISIBILITY_JSON.getPropertyName(), visibilityJson);

        lumifyApi.logout();
    }
View Full Code Here


            respondWithBadRequest(response, "visibilitySource", getString(request, "visibility.invalid"));
            chain.next(request, response);
            return;
        }

        VisibilityJson visibilityJson = GraphUtil.updateVisibilitySourceAndAddWorkspaceId(null, visibilitySource, workspaceId);
        LumifyVisibility lumifyVisibility = visibilityTranslator.toVisibility(visibilityJson);

        Concept concept = ontologyRepository.getConceptByIRI(conceptId);
        Vertex artifactVertex = graph.getVertex(artifactId, authorizations);
        ElementMutation<Vertex> resolvedVertexMutation;
View Full Code Here

    }

    private ClientApiElement handle(String conceptType, String visibilitySource, User user, String workspaceId, Authorizations authorizations) {
        Workspace workspace = getWorkspaceRepository().findById(workspaceId, user);

        VisibilityJson visibilityJson = GraphUtil.updateVisibilitySourceAndAddWorkspaceId(null, visibilitySource, workspaceId);
        LumifyVisibility lumifyVisibility = this.visibilityTranslator.toVisibility(visibilityJson);
        Visibility visibility = lumifyVisibility.getVisibility();

        VertexBuilder vertexBuilder = this.graph.prepareVertex(visibility);
        LumifyProperties.VISIBILITY_JSON.setProperty(vertexBuilder, visibilityJson, visibility);
View Full Code Here

            response.sendError(HttpServletResponse.SC_BAD_REQUEST);
            chain.next(request, response);
            return;
        }

        VisibilityJson visibilityJson;
        if (vertexSandboxStatus == SandboxStatus.PUBLIC) {
            visibilityJson = LumifyProperties.VISIBILITY_JSON.getPropertyValue(edge);
            visibilityJson = GraphUtil.updateVisibilityJsonRemoveFromWorkspace(visibilityJson, workspaceId);
        } else {
            visibilityJson = LumifyProperties.VISIBILITY_JSON.getPropertyValue(resolvedVertex);
View Full Code Here

                continue;
            }

            String id = String.format("GEO-ZIPCODE-%s", zipCodeEntry.getZipCode());
            String title = String.format("%s - %s, %s", zipCodeEntry.getZipCode(), zipCodeEntry.getCity(), zipCodeEntry.getState());
            VisibilityJson sourceVertexVisibilityJson = LumifyProperties.VISIBILITY_JSON.getPropertyValue(sourceVertex);
            Map<String, Object> metadata = new HashMap<String, Object>();
            LumifyProperties.VISIBILITY_JSON.setMetadata(metadata, sourceVertexVisibilityJson);
            GeoPoint geoPoint = new GeoPoint(zipCodeEntry.getLatitude(), zipCodeEntry.getLongitude());
            ElementBuilder<Vertex> resolvedToVertexBuilder = getGraph().prepareVertex(id, sourceVertex.getVisibility())
                    .addPropertyValue(MULTI_VALUE_PROPERTY_KEY, geoLocationIri, geoPoint, metadata, sourceVertex.getVisibility());
            LumifyProperties.CONCEPT_TYPE.addPropertyValue(resolvedToVertexBuilder, MULTI_VALUE_PROPERTY_KEY, zipCodeIri, metadata, sourceVertex.getVisibility());
            LumifyProperties.SOURCE.addPropertyValue(resolvedToVertexBuilder, MULTI_VALUE_PROPERTY_KEY, "Zip Code Resolver", metadata, sourceVertex.getVisibility());
            LumifyProperties.TITLE.addPropertyValue(resolvedToVertexBuilder, MULTI_VALUE_PROPERTY_KEY, title, metadata, sourceVertex.getVisibility());
            LumifyProperties.VISIBILITY_JSON.addPropertyValue(resolvedToVertexBuilder, MULTI_VALUE_PROPERTY_KEY, sourceVertexVisibilityJson, metadata, sourceVertex.getVisibility());
            Vertex zipCodeVertex = resolvedToVertexBuilder.save(authorizations);
            getGraph().flush();

            String edgeId = sourceVertex.getId() + "-" + artifactHasEntityIri + "-" + zipCodeVertex.getId();
            Edge resolvedEdge = getGraph().prepareEdge(edgeId, sourceVertex, zipCodeVertex, artifactHasEntityIri, sourceVertex.getVisibility()).save(authorizations);
            LumifyProperties.VISIBILITY_JSON.addPropertyValue(resolvedEdge, MULTI_VALUE_PROPERTY_KEY, sourceVertexVisibilityJson, metadata, sourceVertex.getVisibility(), authorizations);
            VisibilityJson visibilityJson = LumifyProperties.TERM_MENTION_VISIBILITY_JSON.getPropertyValue(termMention);
            if (visibilityJson != null && visibilityJson.getWorkspaces().size() > 0) {
                Set<String> workspaceIds = visibilityJson.getWorkspaces();
                for (String workspaceId : workspaceIds) {
                    workspaceRepository.updateEntityOnWorkspace(workspaceRepository.findById(workspaceId, user), id, false, null, user);
                }
            }
View Full Code Here

        LOGGER.debug("Extracting phone numbers from provided text");

        final String text = CharStreams.toString(new InputStreamReader(in, Charsets.UTF_8));

        Vertex sourceVertex = (Vertex) data.getElement();
        VisibilityJson visibilityJson = LumifyProperties.VISIBILITY_JSON.getPropertyValue(sourceVertex);
        final Iterable<PhoneNumberMatch> phoneNumbers = phoneNumberUtil.findNumbers(text, defaultRegionCode);
        List<Vertex> termMentions = new ArrayList<Vertex>();
        for (final PhoneNumberMatch phoneNumber : phoneNumbers) {
            final String formattedNumber = phoneNumberUtil.format(phoneNumber.number(), PhoneNumberUtil.PhoneNumberFormat.E164);
            int start = phoneNumber.start();
View Full Code Here

            } catch (Exception ex) {
                throw new LumifyCsvException(state, mappingVertex, property, ex);
            }
        }
        if (!foundVisibilityJson) {
            VisibilityJson visibilityJson = state.getData().getVisibilityJson();
            LumifyProperties.VISIBILITY_JSON.setProperty(v, visibilityJson, visibility);
        }
        Vertex vertex = v.save(getAuthorizations());
        getGraph().flush();
        createHasEntityEdge(state, vertex, visibility);
View Full Code Here

            response.sendError(HttpServletResponse.SC_BAD_REQUEST);
            chain.next(request, response);
            return;
        }

        VisibilityJson visibilityJson;
        if (vertexSandboxStatus == SandboxStatus.PUBLIC) {
            visibilityJson = LumifyProperties.VISIBILITY_JSON.getPropertyValue(edge);
            visibilityJson = GraphUtil.updateVisibilityJsonRemoveFromWorkspace(visibilityJson, workspaceId);
        } else {
            visibilityJson = LumifyProperties.VISIBILITY_JSON.getPropertyValue(resolvedVertex);
            visibilityJson = GraphUtil.updateVisibilityJsonRemoveFromWorkspace(visibilityJson, workspaceId);
        }
        LumifyVisibility lumifyVisibility = visibilityTranslator.toVisibility(visibilityJson);

        // remove edge
        graph.removeEdge(edge, authorizations);
        auditRepository.auditRelationship(AuditAction.DELETE, artifactVertex, resolvedVertex, edge, "", "", user, lumifyVisibility.getVisibility());

        // remove property
        LumifyProperties.DETECTED_OBJECT.removeProperty(artifactVertex, multiValueKey, authorizations);

        graph.flush();

        this.workQueueRepository.pushEdgeDeletion(edge);
        this.workQueueRepository.pushGraphPropertyQueue(artifactVertex, multiValueKey,
                LumifyProperties.DETECTED_OBJECT.getPropertyName(), workspaceId, visibilityJson.getSource());

        auditRepository.auditVertex(AuditAction.UNRESOLVE, resolvedVertex.getId(), "", "", user, lumifyVisibility.getVisibility());

        ClientApiElement result = ClientApiConverter.toClientApi(artifactVertex, workspaceId, authorizations);
        respondWithClientApiObject(response, result);
View Full Code Here

        }
        this.authorizations = this.userRepository.getAuthorizations(user);
    }

    private void createTermMention(Vertex tweetVertex, Vertex vertex, Edge edge, String conceptUri, JSONArray offsets) {
        VisibilityJson visibilitySource = new VisibilityJson();
        long startOffset = offsets.getInt(0);
        long endOffset = offsets.getInt(1);
        String title = LumifyProperties.TITLE.getPropertyValue(vertex);

        new TermMentionBuilder()
View Full Code Here

            }

            StreamingPropertyValue rawValue = new StreamingPropertyValue(fileInputStream, byte[].class);
            rawValue.searchIndex(false);

            VisibilityJson visibilityJson = GraphUtil.updateVisibilitySourceAndAddWorkspaceId(null, visibilitySource, workspace == null ? null : workspace.getWorkspaceId());
            LumifyVisibility lumifyVisibility = this.visibilityTranslator.toVisibility(visibilityJson);
            Visibility visibility = lumifyVisibility.getVisibility();
            Map<String, Object> propertyMetadata = new HashMap<String, Object>();
            LumifyProperties.CONFIDENCE.setMetadata(propertyMetadata, 0.1);
            LumifyProperties.VISIBILITY_JSON.setMetadata(propertyMetadata, visibilityJson);
View Full Code Here

TOP

Related Classes of io.lumify.web.clientapi.model.VisibilityJson

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.