Skip to content

Commit

Permalink
Merge pull request #54 from phenoscape/issue-51
Browse files Browse the repository at this point in the history
Set quality label when quality is automatically populated.
  • Loading branch information
balhoff authored Feb 21, 2020
2 parents 2158fa9 + d5d7b42 commit 645bad1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/scala/org/phenoscape/owl/PhenexToOWL.scala
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ object PhenexToOWL extends OWLTask {
annotations += factory.getOWLAnnotation(quality_term, quality.getIRI)
((quality, qualityLabel), axioms)
})
val qualityLabel = qualityAndLabelOption.map(_._2).getOrElse("")
var qualityLabel = qualityAndLabelOption.map(_._2).getOrElse("")
val (relatedEntityAndLabelOption, relatedEntityAxioms) = optionWithSet(for {
qualityElement <- qualityElementOption
relatedEntityElement <- Option(qualityElement.getChild("related_entity", phenoNS))
Expand All @@ -256,12 +256,14 @@ object PhenexToOWL extends OWLTask {
axioms ++ AbsenceClassGenerator.generateAllAbsenceAxiomsForEntity(relatedEntity))
})
val relatedEntityLabel = relatedEntityAndLabelOption.map(_._2).map(re => s" $re").getOrElse("")
val phenotypeLabel = s"$entityLabel $qualityLabel$relatedEntityLabel"
val eqPhenotypeOption = (entityAndLabelOption.map(_._1), qualityAndLabelOption.map(_._1), relatedEntityAndLabelOption.map(_._1)) match {
case (None, None, _) => None
case (Some(entity), None, None) => Option(has_part some (Present and (inheres_in some entity)))
case (Some(entity), None, None) =>
qualityLabel = "present"
Option(has_part some (Present and (inheres_in some entity)))
case (Some(entity), None, Some(_)) =>
logger.warn("Related entity with no quality. Shouldn't be possible.")
qualityLabel = "present"
Option(has_part some (Present and (inheres_in some entity)))
case (Some(entity), Some(Absent), None) => Option(
(has_part some (LacksAllPartsOfType and (inheres_in some MultiCellularOrganism) and (towards value Individual(entity.getIRI))))
Expand All @@ -277,6 +279,7 @@ object PhenexToOWL extends OWLTask {
case (Some(entity), Some(quality), Some(relatedEntity)) => Option(has_part some (quality and (inheres_in some entity) and (towards some relatedEntity)))
//TODO comparisons, etc.
}
val phenotypeLabel = s"$entityLabel $qualityLabel$relatedEntityLabel"
val (phenotypeClass, phenotypeAxioms) = optionWithSet(eqPhenotypeOption.map(ExpressionUtil.nameForExpressionWithAxioms))
annotations += factory.getOWLAnnotation(RDFSLabel, factory.getOWLLiteral(phenotypeLabel))
val annotationAxioms = phenotypeClass.map(term => annotations.map(factory.getOWLAnnotationAssertionAxiom(term.getIRI, _))).toSet.flatten
Expand Down

0 comments on commit 645bad1

Please sign in to comment.