private void translateState(State state, OWLNamedIndividual owlState) { this.stateToOWLMap.put(state, owlState); this.addClass(owlState, this.factory.getOWLClass(IRI.create(CDAO.STANDARD_STATE))); if (StringUtils.isNotBlank(state.getLabel())) { final OWLLiteral label = this.factory.getOWLLiteral(state.getLabel()); this.addAnnotation(OWLRDFVocabulary.RDFS_LABEL.getIRI(), owlState.getIRI(), label); } if (StringUtils.isNotBlank(state.getComment())) { final OWLLiteral comment = factory.getOWLLiteral(state.getComment()); this.addAnnotation(OWLRDFVocabulary.RDFS_COMMENT.getIRI(), owlState.getIRI(), comment); } int phenotypeIndex = 0; final OWLObjectProperty denotes = this.factory.getOWLObjectProperty(IRI.create(IAO.DENOTES)); for (Phenotype phenotype : state.getPhenotypes()) { phenotypeIndex++; final IRI phenotypeIRI = IRI.create(owlState.getIRI().toURI().toString() + "/phenotype/" + phenotypeIndex); final OWLClass owlPhenotype = this.factory.getOWLClass(phenotypeIRI); final OWLObjectAllValuesFrom denotesOnlyPhenotype = this.factory.getOWLObjectAllValuesFrom(denotes, owlPhenotype); this.ontologyManager.addAxiom( ontology, this.factory.getOWLClassAssertionAxiom(denotesOnlyPhenotype, owlState)); this.translatePhenotype(phenotype, owlPhenotype); } }
private void deleteSelectedPhenotype() { final State state = this.getSelectedState(); if (state != null) { final Phenotype phenotype = this.getSelectedPhenotype(); if (phenotype != null) { state.removePhenotype(phenotype); } } }
private void addPhenotype() { final State state = this.getSelectedState(); if (state != null) { final Phenotype phenotype = state.newPhenotype(); phenotype.setEntity(this.getAutofillEntity()); final OBOClass possibleQuality = this.getAutofillQuality(); if ((possibleQuality != null) && (possibleQuality.getID().equals(COUNT))) { phenotype.setQuality(this.getAutofillQuality()); } } }
private void translateMatrixCell( Taxon taxon, Character character, State state, OWLNamedIndividual matrixCell) { this.addClass(matrixCell, this.factory.getOWLClass(IRI.create(CDAO.MATRIX_CELL))); this.addPropertyAssertion( IRI.create(CDAO.BELONGS_TO_CHARACTER), matrixCell, this.characterToOWLMap.get(character)); this.addPropertyAssertion( IRI.create(CDAO.BELONGS_TO_TU), matrixCell, this.taxonOTUToOWLMap.get(taxon)); this.addPropertyAssertion( IRI.create(CDAO.HAS_STATE), matrixCell, this.stateToOWLMap.get(state)); if (taxon.getValidName() != null) { final IRI taxonIRI = this.convertOBOIRI(taxon.getValidName().getID()); final OWLClass taxonClass = this.factory.getOWLClass(taxonIRI); for (Phenotype phenotype : state.getPhenotypes()) { final OWLClass eq = this.phenotypeToOWLMap.get(phenotype); final OWLObjectProperty exhibits = this.factory.getOWLObjectProperty(IRI.create(PHENOSCAPE.EXHIBITS)); final OWLClassExpression exhibitsSomeEQ = this.factory.getOWLObjectSomeValuesFrom(exhibits, eq); final OWLAnnotationProperty positedBy = this.factory.getOWLAnnotationProperty(IRI.create(PHENOSCAPE.POSITED_BY)); final OWLAnnotation positedByAnnotation = this.factory.getOWLAnnotation(positedBy, matrixCell.getIRI()); final Set<OWLAnnotation> annotations = Collections.singleton(positedByAnnotation); final OWLSubClassOfAxiom annotatedSubClassOfAxiom = this.factory.getOWLSubClassOfAxiom(taxonClass, exhibitsSomeEQ, annotations); this.ontologyManager.addAxiom(this.ontology, annotatedSubClassOfAxiom); } } }
private OBOClass getAutofillQuality() { // check current state for (State state : this.getController().getCurrentStatesSelectionModel().getSelected()) { for (Phenotype phenotype : state.getPhenotypes()) { if (phenotype.getQuality() != null) { return phenotype.getQuality(); } } } // then check all states for (State state : this.getController().getStatesForCurrentCharacterSelection()) { for (Phenotype phenotype : state.getPhenotypes()) { if (phenotype.getQuality() != null) { return phenotype.getQuality(); } } } return null; }