Package io.lumify.core.model.ontology

Examples of io.lumify.core.model.ontology.Concept


        this.workQueueRepository = workQueueRepository;
        this.graph = graph;

        authorizationRepository.addAuthorizationToGraph(VISIBILITY_STRING);

        Concept userConcept = ontologyRepository.getConceptByIRI(UserRepository.USER_CONCEPT_IRI);
        checkNotNull(userConcept);

        Concept longRunningProcessConcept = ontologyRepository.getOrCreateConcept(null, LONG_RUNNING_PROCESS_CONCEPT_IRI, "workspace", null);
        checkNotNull(longRunningProcessConcept);
        List<Concept> userConceptList = new ArrayList<Concept>();
        userConceptList.add(userConcept);
        List<Concept> longRunningProcessConceptList = new ArrayList<Concept>();
        longRunningProcessConceptList.add(longRunningProcessConcept);
View Full Code Here


        this.userListenerUtil = userListenerUtil;

        authorizationRepository.addAuthorizationToGraph(VISIBILITY_STRING);
        authorizationRepository.addAuthorizationToGraph(LumifyVisibility.SUPER_USER_VISIBILITY_STRING);

        Concept userConcept = ontologyRepository.getOrCreateConcept(null, USER_CONCEPT_IRI, "lumifyUser", null);
        userConceptId = userConcept.getTitle();

        Set<String> authorizationsSet = new HashSet<String>();
        authorizationsSet.add(VISIBILITY_STRING);
        authorizationsSet.add(LumifyVisibility.SUPER_USER_VISIBILITY_STRING);
        this.authorizations = authorizationRepository.createAuthorizations(authorizationsSet);
View Full Code Here

        this.lockRepository = lockRepository;

        authorizationRepository.addAuthorizationToGraph(VISIBILITY_STRING);
        authorizationRepository.addAuthorizationToGraph(LumifyVisibility.SUPER_USER_VISIBILITY_STRING);

        Concept rootConcept = ontologyRepository.getConceptByIRI(OntologyRepository.ROOT_CONCEPT_IRI);

        Concept workspaceConcept = ontologyRepository.getOrCreateConcept(null, WORKSPACE_CONCEPT_IRI, "workspace", null);
        workspaceConceptId = workspaceConcept.getTitle();

        ArrayList<Concept> workspaceConceptList = new ArrayList<Concept>();
        workspaceConceptList.add(workspaceConcept);

        ArrayList<Concept> rootConceptList = new ArrayList<Concept>();
View Full Code Here

        String timeFormula = getRequiredParameter(request, "timeFormula");

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

        Concept concept = ontologyRepository.getConceptByIRI(conceptIRI);
        if (concept == null) {
            respondWithNotFound(response, "concept " + conceptIRI + " not found");
            return;
        }

        if (displayName.length() != 0) {
            concept.setProperty(LumifyProperties.DISPLAY_NAME.getPropertyName(), displayName, authorizations);
        }

        if (color.length() != 0) {
            concept.setProperty(LumifyProperties.COLOR.getPropertyName(), color, authorizations);
        }

        if (timeFormula.length() != 0) {
            concept.setProperty(LumifyProperties.TITLE_FORMULA.getPropertyName(), titleFormula, authorizations);
        } else {
            concept.removeProperty(LumifyProperties.TITLE_FORMULA.getPropertyName(), authorizations);
        }

        if (subtitleFormula.length() != 0) {
            concept.setProperty(LumifyProperties.SUBTITLE_FORMULA.getPropertyName(), subtitleFormula, authorizations);
        } else {
            concept.removeProperty(LumifyProperties.SUBTITLE_FORMULA.getPropertyName(), authorizations);
        }

        if (timeFormula.length() != 0) {
            concept.setProperty(LumifyProperties.TIME_FORMULA.getPropertyName(), timeFormula, authorizations);
        } else {
            concept.removeProperty(LumifyProperties.TIME_FORMULA.getPropertyName(), authorizations);
        }

        ontologyRepository.clearCache();

        respondWithHtml(response, "OK");
View Full Code Here

    }

    @Override
    public void execute(InputStream in, GraphPropertyWorkData data) throws Exception {
        String mimeType = LumifyProperties.MIME_TYPE.getPropertyValue(data.getElement());
        Concept concept = null;

        if (imageConcept != null && mimeType.startsWith("image")) {
            concept = imageConcept;
        } else if (audioConcept != null && mimeType.startsWith("audio")) {
            concept = audioConcept;
        } else if (videoConcept != null && mimeType.startsWith("video")) {
            concept = videoConcept;
        } else if (documentConcept != null) {
            concept = documentConcept;
        }

        if (concept == null) {
            LOGGER.debug("skipping, no concept mapped for vertex " + data.getElement().getId());
            return;
        }

        LOGGER.debug("assigning concept type %s to vertex %s", concept.getTitle(), data.getElement().getId());
        LumifyProperties.CONCEPT_TYPE.setProperty(data.getElement(), concept.getTitle(), data.createPropertyMetadata(), data.getVisibility(), getAuthorizations());
        getGraph().flush();
        getWorkQueueRepository().pushGraphPropertyQueue(data.getElement(), null, LumifyProperties.CONCEPT_TYPE.getPropertyName(),
                data.getWorkspaceId(), data.getVisibilitySource());
    }
View Full Code Here

            return;
        }

        String id = resolvedVertexId == null ? graph.getIdGenerator().nextId() : resolvedVertexId;

        Concept concept = ontologyRepository.getConceptByIRI(conceptId);

        final Vertex artifactVertex = graph.getVertex(artifactId, authorizations);
        LumifyVisibility lumifyVisibility = visibilityTranslator.toVisibility(visibilityJson);
        Map<String, Object> metadata = new HashMap<String, Object>();
        LumifyProperties.VISIBILITY_JSON.setMetadata(metadata, visibilityJson);
        ElementMutation<Vertex> vertexMutation;
        Vertex vertex;
        if (resolvedVertexId != null) {
            vertex = graph.getVertex(id, authorizations);
            vertexMutation = vertex.prepareMutation();
        } else {
            vertexMutation = graph.prepareVertex(id, lumifyVisibility.getVisibility());
            GraphUtil.addJustificationToMutation(vertexMutation, justificationText, sourceInfo, lumifyVisibility);

            LumifyProperties.CONCEPT_TYPE.setProperty(vertexMutation, conceptId, metadata, lumifyVisibility.getVisibility());
            LumifyProperties.TITLE.addPropertyValue(vertexMutation, MULTI_VALUE_KEY, title, metadata, lumifyVisibility.getVisibility());

            vertex = vertexMutation.save(authorizations);

            auditRepository.auditVertexElementMutation(AuditAction.UPDATE, vertexMutation, vertex, "", user, lumifyVisibility.getVisibility());

            LumifyProperties.VISIBILITY_JSON.setProperty(vertexMutation, visibilityJson, metadata, lumifyVisibility.getVisibility());

            this.graph.flush();

            workspaceRepository.updateEntityOnWorkspace(workspace, vertex.getId(), false, null, user);
        }

        // TODO: a better way to check if the same edge exists instead of looking it up every time?
        Edge edge = graph.addEdge(artifactVertex, vertex, this.artifactHasEntityIri, lumifyVisibility.getVisibility(), authorizations);
        LumifyProperties.VISIBILITY_JSON.setProperty(edge, visibilityJson, metadata, lumifyVisibility.getVisibility(), authorizations);

        auditRepository.auditRelationship(AuditAction.CREATE, artifactVertex, vertex, edge, "", "", user, lumifyVisibility.getVisibility());

        new TermMentionBuilder()
                .sourceVertex(artifactVertex)
                .propertyKey(propertyKey)
                .start(mentionStart)
                .end(mentionEnd)
                .title(title)
                .conceptIri(concept.getIRI())
                .visibilityJson(visibilityJson)
                .resolvedTo(vertex, edge)
                .process(getClass().getSimpleName())
                .save(this.graph, visibilityTranslator, authorizations);
View Full Code Here

        Map<String, List<AttributeClass>> conceptTypeAttributeClassListMap = new HashMap<String, List<AttributeClass>>();
        for (Vertex vertex : vertices) {
            String conceptType = LumifyProperties.CONCEPT_TYPE.getPropertyValue(vertex);
            if (!conceptTypeAttributeClassListMap.containsKey(conceptType)) {
                List<AttributeClass> conceptAttributeClasses = new ArrayList<AttributeClass>();
                Concept concept = ontologyRepository.getConceptByIRI(conceptType);
                for (OntologyProperty property : concept.getProperties()) {
                    if (property.getUserVisible()) {
                        String name = property.getTitle();
                        String type = AttributeClass.TYPE_TEXT;
                        AttributeClass attributeClass = new AttributeClass(name, type, false);
                        conceptAttributeClasses.add(attributeClass);
View Full Code Here

        Map<String, CustomImage> customImageMap = new HashMap<String, CustomImage>();
        for (Vertex vertex : vertices) {
            String conceptType = LumifyProperties.CONCEPT_TYPE.getPropertyValue(vertex);
            if (!customImageMap.containsKey(conceptType)) {
                CustomImage customImage = null;
                Concept concept = ontologyRepository.getConceptByIRI(conceptType);
                byte[] glyphIcon = getGlyphIcon(concept, ontologyRepository);
                if (glyphIcon != null) {
                    customImage = new CustomImage(conceptType, glyphIcon);
                }
                customImageMap.put(conceptType, customImage);
View Full Code Here

        this.workQueueRepository = workQueueRepository;
        this.visibilityTranslator = visibilityTranslator;
        this.workspaceRepository = workspaceRepository;

        this.conceptIri = configuration.get(Configuration.ONTOLOGY_IRI_ENTITY_IMAGE);
        Concept concept = ontologyRepository.getConceptByIRI(conceptIri);
        if (concept == null) {
            LOGGER.error("Could not find concept '%s' for entity upload. Configuration key %s", conceptIri, Configuration.ONTOLOGY_IRI_ENTITY_IMAGE);
        }

        this.entityHasImageIri = this.getConfiguration().get(Configuration.ONTOLOGY_IRI_ENTITY_HAS_IMAGE);
View Full Code Here

    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, HandlerChain chain) throws Exception {
        final String graphVertexId = getAttributeString(request, ATTR_GRAPH_VERTEX_ID);
        final List<Part> files = Lists.newArrayList(request.getParts());

        Concept concept = ontologyRepository.getConceptByIRI(conceptIri);
        checkNotNull(concept, "Could not find image concept: " + conceptIri);

        if (files.size() != 1) {
            throw new RuntimeException("Wrong number of uploaded files. Expected 1 got " + files.size());
        }
View Full Code Here

TOP

Related Classes of io.lumify.core.model.ontology.Concept

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.