Package edu.stanford.bmir.protege.web.server.owlapi

Examples of edu.stanford.bmir.protege.web.server.owlapi.OWLAPIProject


        OWLAPIProjectManager pm = OWLAPIProjectManager.getProjectManager();
        return pm.getProject(projectId);
    }

    public RevisionNumber getHeadRevisionNumber(ProjectId projectId) {
        OWLAPIProject project = getProject(projectId);
        return project.getRevisionNumber();
    }
View Full Code Here


        return project.getRevisionNumber();
    }


    public List<RevisionSummary> getRevisionSummaries(ProjectId projectId) {
        OWLAPIProject project = getProject(projectId);
        OWLAPIChangeManager changeManager = project.getChangeManager();
        return changeManager.getRevisionSummaries();
    }
View Full Code Here

    public static final IRI OBO_NAMESPACE_IRI = Obo2OWLConstants.Obo2OWLVocabulary.IRI_OIO_hasOboNamespace.getIRI();

    public synchronized Set<OBONamespace> getNamespaces(ProjectId projectId) {
//        if (cache == null) {
        OWLAPIProject project = getProject(projectId);
        OBONamespaceCache cache = OBONamespaceCache.createCache(project);
//        }
        return cache.getNamespaces();
    }
View Full Code Here

        return new OBOTermId(id, label, namespace);
    }


    public void setTermId(ProjectId projectId, OWLEntity entity, OBOTermId termId) {
        OWLAPIProject project = getProject(projectId);
        OBOTermId existingTermId = getTermId(projectId, entity);
        IRI iri = entity.getIRI();
        List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
        StringBuilder description = new StringBuilder();
        if (!existingTermId.getName().equals(termId.getName())) {
            // Update label
            changes.addAll(replaceStringAnnotationValue(projectId, iri, OWLRDFVocabulary.RDFS_LABEL.getIRI(), termId.getName()));
            description.append("Set term name to ");
            description.append(termId.getName());
            description.append(" ");
        }
        if (!existingTermId.getNamespace().equals(termId.getNamespace())) {
            changes.addAll(replaceStringAnnotationValue(projectId, iri, OBO_NAMESPACE_IRI, termId.getNamespace()));
            description.append("Set term namespace to ");
            description.append(termId.getNamespace());
        }
        if (!changes.isEmpty()) {
            UserId userId = getUserInSessionAndEnsureSignedIn();
            project.applyChanges(userId, changes, description.toString().trim());
        }
    }
View Full Code Here

            project.applyChanges(userId, changes, description.toString().trim());
        }
    }

    public List<OBOXRef> getXRefs(ProjectId projectId, OWLEntity term) {
        OWLAPIProject project = getProject(projectId);
        IRI subject = term.getIRI();
        List<OBOXRef> xrefs = new ArrayList<OBOXRef>();
        for (OWLAnnotationAssertionAxiom ax : project.getRootOntology().getAnnotationAssertionAxioms(subject)) {
            final OWLAnnotationProperty property = ax.getProperty();
            if (isXRefProperty(property)) {
                OBOXRef xref = convertAnnotationToXRef(ax.getAnnotation(), ax.getAnnotations());
                xrefs.add(xref);
            }
View Full Code Here

    public void setXRefs(ProjectId projectId, OWLEntity term, List<OBOXRef> xrefs) throws NotSignedInException {
        ensureSignedIn();
        IRI subject = term.getIRI();
        Set<OWLAnnotation> annotations = convertOBOXRefsToOWLAnnotations(projectId, xrefs);
        List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
        OWLAPIProject project = getProject(projectId);
        OWLOntology rootOntology = project.getRootOntology();

        // Remove OLD
        for (OWLAnnotationAssertionAxiom ax : rootOntology.getAnnotationAssertionAxioms(subject)) {
            if (isXRefProperty(ax.getProperty())) {
                changes.add(new RemoveAxiom(rootOntology, ax));
            }
        }

        // Add NEW
        for (OWLAnnotation annotation : annotations) {
            OWLDataFactory df = project.getDataFactory();
            changes.add(new AddAxiom(rootOntology, df.getOWLAnnotationAssertionAxiom(subject, annotation)));
        }

        project.applyChanges(getUserInSessionAndEnsureSignedIn(), changes, "Set XRefs");

    }
View Full Code Here

        project.applyChanges(getUserInSessionAndEnsureSignedIn(), changes, "Set XRefs");

    }

    private String getStringAnnotationValue(ProjectId projectId, org.semanticweb.owlapi.model.IRI annotationSubject, org.semanticweb.owlapi.model.IRI annotationPropertyIRI, String defaultValue) {
        OWLAPIProject project = getProject(projectId);
        OWLAnnotationAssertionAxiom labelAnnotation = null;
        for (OWLOntology ontology : project.getRootOntology().getImportsClosure()) {
            Set<OWLAnnotationAssertionAxiom> annotationAssertionAxioms = ontology.getAnnotationAssertionAxioms(annotationSubject);
            for (OWLAnnotationAssertionAxiom ax : annotationAssertionAxioms) {
                if (ax.getProperty().getIRI().equals(annotationPropertyIRI)) {
                    labelAnnotation = ax;
                    break;
View Full Code Here

        return label;
    }

    public List<OWLOntologyChange> replaceStringAnnotationValue(ProjectId projectId, org.semanticweb.owlapi.model.IRI annotationSubject, org.semanticweb.owlapi.model.IRI annotationPropertyIRI, String replaceWith) {
        List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
        OWLAPIProject project = getProject(projectId);
        OWLOntology rootOntology = project.getRootOntology();

        OWLDataFactory df = project.getDataFactory();
        OWLAnnotationProperty property = df.getOWLAnnotationProperty(annotationPropertyIRI);
        OWLLiteral value = df.getOWLLiteral(replaceWith);


        for (OWLOntology ontology : rootOntology.getImportsClosure()) {
View Full Code Here

    public OBOTermDefinition getDefinition(ProjectId projectId, OWLEntity term) {
        if (!(term.isOWLClass())) {
            return OBOTermDefinition.empty();
        }
        OWLAPIProject project = getProject(projectId);
        OWLAnnotationAssertionAxiom definitionAnnotation = null;
        for (OWLOntology ontology : project.getRootOntology().getImportsClosure()) {
            Set<OWLAnnotationAssertionAxiom> annotationAssertionAxioms = ontology.getAnnotationAssertionAxioms(term.getIRI());
            for (OWLAnnotationAssertionAxiom ax : annotationAssertionAxioms) {
                OWLAnnotationProperty property = ax.getProperty();
                if (isOBODefinitionProperty(property)) {
                    definitionAnnotation = ax;
View Full Code Here

    public void setDefinition(ProjectId projectId, OWLEntity term, OBOTermDefinition definition) {
        List<OBOXRef> xRefs = definition.getXRefs();
        Set<OWLAnnotation> xrefAnnotations = convertOBOXRefsToOWLAnnotations(projectId, xRefs);

        OWLAPIProject project = getProject(projectId);
        IRI subject = term.getIRI();
        OWLDataFactory df = project.getDataFactory();
        final IRI defIRI = getIRI(OBOFormatConstants.OboFormatTag.TAG_DEF);
        OWLAnnotationProperty defAnnotationProperty = df.getOWLAnnotationProperty(defIRI);
        OWLLiteral defLiteral = df.getOWLLiteral(definition.getDefinition());
        OWLAnnotationAssertionAxiom definitionAssertion = df.getOWLAnnotationAssertionAxiom(defAnnotationProperty, subject, defLiteral, xrefAnnotations);

        List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
        OWLOntology ont = project.getRootOntology();
        for (OWLAnnotationAssertionAxiom existingAx : ont.getAnnotationAssertionAxioms(subject)) {
            if (existingAx.getProperty().getIRI().equals(defIRI)) {
                changes.add(new RemoveAxiom(ont, existingAx));
                Set<OWLAnnotation> nonXRefAnnotations = getAxiomAnnotationsExcludingXRefs(existingAx);
                OWLAxiom fullyAnnotatedDefinitionAssertion = definitionAssertion.getAnnotatedAxiom(nonXRefAnnotations);
                changes.add(new AddAxiom(ont, fullyAnnotatedDefinitionAssertion));
            }
        }
        if (changes.isEmpty()) {
            // New
            changes.add(new AddAxiom(ont, definitionAssertion));
        }
        UserId userId = getUserInSessionAndEnsureSignedIn();
        project.applyChanges(userId, changes, "Set term definition");
    }
View Full Code Here

TOP

Related Classes of edu.stanford.bmir.protege.web.server.owlapi.OWLAPIProject

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.