From 42c024e6ed49833442bee61da6dd5067d2e01829 Mon Sep 17 00:00:00 2001 From: rctauber Date: Wed, 27 Jan 2021 12:46:21 -0800 Subject: [PATCH 1/3] Do not create IRI from expression --- .../org/obolibrary/robot/QuotedEntityChecker.java | 13 ++++++++++++- .../java/org/obolibrary/robot/TemplateHelper.java | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/robot-core/src/main/java/org/obolibrary/robot/QuotedEntityChecker.java b/robot-core/src/main/java/org/obolibrary/robot/QuotedEntityChecker.java index 07ba7e0bf..0c2b9f565 100644 --- a/robot-core/src/main/java/org/obolibrary/robot/QuotedEntityChecker.java +++ b/robot-core/src/main/java/org/obolibrary/robot/QuotedEntityChecker.java @@ -353,11 +353,22 @@ public OWLAnnotationProperty getOWLAnnotationProperty(@Nonnull String name, bool */ @Override public OWLClass getOWLClass(@Nonnull String name) { + return getOWLClass(name, true); + } + + /** + * Find a class with the given name, or create one. Quotation marks will be removed if necessary. + * + * @param name the name of the entity to find + * @param create if false, do not create a new class + * @return a class, or null + */ + public OWLClass getOWLClass(@Nonnull String name, boolean create) { IRI iri = getIRI(classes, name); if (iri != null) { return dataFactory.getOWLClass(iri); } - if (ioHelper != null) { + if (ioHelper != null && create) { iri = ioHelper.createIRI(name); if (iri != null) { return dataFactory.getOWLClass(iri); diff --git a/robot-core/src/main/java/org/obolibrary/robot/TemplateHelper.java b/robot-core/src/main/java/org/obolibrary/robot/TemplateHelper.java index 753301882..fc3f07a21 100644 --- a/robot-core/src/main/java/org/obolibrary/robot/TemplateHelper.java +++ b/robot-core/src/main/java/org/obolibrary/robot/TemplateHelper.java @@ -990,7 +990,7 @@ protected static OWLClassExpression tryParse( if (checker != null) { // If we have a checker, try to get the class by label // This allows class labels with single quotes - expr = checker.getOWLClass(content); + expr = checker.getOWLClass(content, false); } if (expr == null) { // If not found by label, try to parse From de7af063dc955fc65271d8a6e4bad181875f3103 Mon Sep 17 00:00:00 2001 From: rctauber Date: Wed, 27 Jan 2021 12:50:28 -0800 Subject: [PATCH 2/3] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7141ceda3..a28ddcc6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Fix handling of class expressions from [`template`] [#808] + ## [1.8.0] - 2021-01-27 ### Added @@ -239,6 +242,7 @@ First official release of ROBOT! [`template`]: http://robot.obolibrary.org/template [`validate`]: http://robot.obolibrary.org/validate +[#808]: https://github.com/ontodev/robot/pull/808 [#802]: https://github.com/ontodev/robot/pull/802 [#796]: https://github.com/ontodev/robot/pull/796 [#793]: https://github.com/ontodev/robot/pull/793 From 47dd4dd49d0a62f12d7f206b8f9a1d58e11a1067 Mon Sep 17 00:00:00 2001 From: rctauber Date: Wed, 27 Jan 2021 12:55:30 -0800 Subject: [PATCH 3/3] Add test --- docs/examples/part_of_template.csv | 3 + docs/examples/part_of_uberon.owl | 1143 ++++++++++++++++++++++++++++ docs/template.md | 9 +- 3 files changed, 1150 insertions(+), 5 deletions(-) create mode 100644 docs/examples/part_of_template.csv create mode 100644 docs/examples/part_of_uberon.owl diff --git a/docs/examples/part_of_template.csv b/docs/examples/part_of_template.csv new file mode 100644 index 000000000..57054821d --- /dev/null +++ b/docs/examples/part_of_template.csv @@ -0,0 +1,3 @@ +ID,Label,Part +ID,LABEL,SC part_of some % +UBERON:123,new system,endocrine system diff --git a/docs/examples/part_of_uberon.owl b/docs/examples/part_of_uberon.owl new file mode 100644 index 000000000..d40e6e421 --- /dev/null +++ b/docs/examples/part_of_uberon.owl @@ -0,0 +1,1143 @@ + + + + + + + + + + + + + + + definition + + + + + + + + IAO:0000116 + uberon + editor_note + true + editor_note + editor note + + + + + + + + IAO:0000232 + uberon + curator_notes + true + curator_notes + curator notes + + + + + + + + An alternate textual definition for a class taken unmodified from an external source. This definition may have been used to derive a generalized definition for the new class. + UBPROP:0000001 + uberon + external_definition + true + external_definition + This annotation property may be replaced with an annotation property from an external ontology such as IAO + external_definition + + + + + + + + Notes on the homology status of this class. + UBPROP:0000003 + uberon + homology_notes + true + homology_notes + This annotation property may be replaced with an annotation property from an external ontology such as IAO + homology_notes + + + + + + + + Used to connect a class to an adjectival form of its label. For example, a class with label 'intestine' may have a relational adjective 'intestinal'. + UBPROP:0000007 + uberon + has_relational_adjective + true + has_relational_adjective + has_relational_adjective + + + + + + + + Notes on the how instances of this class vary across species. + UBPROP:0000008 + uberon + taxon_notes + true + taxon_notes + taxon_notes + + + + + + + + Notes on the evolved function of instances of this class. + This annotation property may be replaced with an annotation property from an external ontology such as IAO + UBPROP:0000009 + uberon + function_notes + true + function_notes + function_notes + + + + + + + + Notes on how similar or equivalent classes are represented in other ontologies. + This annotation property may be replaced with an annotation property from an external ontology such as IAO + UBPROP:0000012 + uberon + external_ontology_notes + true + external_ontology_notes + external_ontology_notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BFO:0000050 + uberon + part_of + part_of + part_of + + + + + + + + + X outer_layer_of Y iff: +. X :continuant that bearer_of some PATO:laminar +. X part_of Y +. exists Z :surface +. X has_boundary Z +. Z boundary_of Y + +has_boundary: http://purl.obolibrary.org/obo/RO_0002002 +boundary_of: http://purl.obolibrary.org/obo/RO_0002000 + RO:0002007 + uberon + bounding_layer_of + bounding_layer_of + A relationship that applies between a continuant and its outer, bounding layer. Examples include the relationship between a multicellular organism and its integument, between an animal cell and its plasma membrane, and between a membrane bound organelle and its outer/bounding membrane. + bounding layer of + + + + + + + + + + + + + + Material anatomical entity that has inherent 3D shape and is generated by coordinated expression of the organism's own genome. + + + AAO:0010825 + AEO:0000003 + BILA:0000003 + CARO:0000003 + EHDAA2:0003003 + EMAPA:0 + FBbt:00007001 + FMA:67135 + GAID:781 + HAO:0000003 + MA:0003000 + MESH:A13 + TAO:0000037 + TGMA:0001823 + VHOG:0001759 + WBbt:0000100 + XAO:0003000 + ZFA:0000037 + biological structure + uberon + UBERON:0000061 + + anatomical structure + + + + + + + + + + + + + + + Anatomical structure that performs a specific function or group of functions [WP]. + Organs are commonly observed as visibly distinct structures, but may also exist as loosely associated clusters of cells that work together to perform a specific function or functions. + CARO does not include a generic 'organ' class, only simple and compound organ + + + + + + EFO:0000634 + EMAPA:35949 + ENVO:01000162 + FMA:67498 + MA:0003001 + OpenCyc:Mx4rv5XMb5wpEbGdrcN5Y29ycA + OpenCyc:Mx4rwP3iWpwpEbGdrcN5Y29ycA + UMLS:C0178784 + WBbt:0003760 + uberon + anatomical unit + body organ + element + UBERON:0000062 + + organ + + + + + + + + + + + + + + + Anatomical structure which has as its direct parts two or more types of tissue and is continuous with one or more anatomical structures likewise constituted by two or more portions of tissues distinct from those of their complement. Examples: osteon, cortical bone, neck of femur, bronchopulmonary segment, left lobe of liver, anterior right side of heart, interventricular branch of left coronary artery, right atrium, mitral valve, head of pancreas[FMA]. + + + + AAO:0011124 + EFO:0000635 + FMA:82472 + cardinal organ part + uberon + regional part of organ + UBERON:0000064 + + + + organ part + + + + + + + + + Anatomical entity that has mass. + AAO:0010264 + AEO:0000006 + BILA:0000006 + CARO:0000006 + EHDAA2:0003006 + FBbt:00007016 + FMA:67165 + HAO:0000006 + TAO:0001836 + TGMA:0001826 + VHOG:0001721 + uberon + UBERON:0000465 + + material anatomical entity + + + + + + + + + + + + + + + Anatomical group that is has as its parts distinct anatomical structures interconnected by anatomical structures at a lower level of granularity[CARO]. A group of organs that work together to perform a certain task [Wikipedia]. + system + + + + + + AAO:0000007 + AEO:0000011 + BILA:0000011 + BSA:0000049 + CALOHA:TS-2088 + CARO:0000011 + EHDAA2:0003011 + EHDAA:392 + EMAPA:16103 + EV:0100000 + FBbt:00004856 + FMA:7149 + HAO:0000011 + MA:0000003 + OpenCyc:Mx4rCWM0QCtDEdyAAADggVbxzQ + TAO:0001439 + TGMA:0001831 + UMLS:C0460002 + VHOG:0001725 + WBbt:0005746 + WBbt:0005763 + XAO:0003002 + ZFA:0001439 + galen:AnatomicalSystem + body system + organ system + uberon + UBERON:0000467 + + + anatomical system + + + + + + + + + + Anatomical structure that is an individual member of a species and consists of more than one cell. + TODO - split body and mc organism? body continues after death stage + organismal + + + + + AAO:0010026 + AEO:0000191 + BILA:0000012 + BSA:0000038 + BTO:0000042 + CARO:0000012 + EFO:0002906 + EHDAA2:0003103 + EHDAA2:0003191 + EHDAA:1 + EHDAA:9178 + EMAPA:25765 + EV:0100016 + FBbt:00000001 + FMA:256135 + HAO:0000012 + TADS:0000001 + TAO:0001094 + TGMA:0001832 + VHOG:0000671 + WBbt:0007833 + XAO:0003004 + ZFA:0001094 + galen:Organism + multi-cellular organism + organism + whole organism + animal + uberon + Koerper + body + whole body + UBERON:0000468 + + + + multicellular organism + + + + + + + + + Anatomical structure which is a subdivision of a whole organism, consisting of components of multiple anatomical systems, largely surrounded by a contiguous region of integument. + Reflects CARO2. todo - check the inclusion of FMA 'cardinal body part here', and check child terms for consistency + + + + + AAO:0010053 + AEO:0000032 + BILA:0000032 + CALOHA:TS-2084 + CARO:0000032 + EFO:0000808 + EHDAA2:0003032 + FBbt:00007009 + FMA:7153 + HAO:0000032 + MA:0002433 + MAT:0000293 + MESH:A01 + MIAA:0000293 + OpenCyc:Mx4rvViAHJwpEbGdrcN5Y29ycA + TAO:0001308 + TGMA:0001840 + UMLS:C0229962 + VHOG:0001758 + XAO:0003013 + ZFA:0001308 + galen:BodyPart + anatomic region + uberon + body part + body region + cardinal body part + UBERON:0000475 + + + + organism subdivision + + + + + + + + + Anatomical structure consisting of at least two non-overlapping organs, multi-tissue aggregates or portion of tissues or cells of different types that does not constitute an organism, organ, multi-tissue aggregate, or portion of tissue. + AAO:0010008 + AEO:0000054 + BILA:0000054 + CARO:0000054 + EHDAA2:0003054 + HAO:0000054 + TAO:0001512 + TGMA:0001846 + VHOG:0001724 + XAO:0003001 + ZFA:0001512 + uberon + UBERON:0000480 + + anatomical group + + + + + + + + + + + + + + + The subdivision of the vertebrate body between the thorax and pelvis. The ventral part of the abdomen contains the abdominal cavity and visceral organs. The dorsal part includes the abdominal section of the vertebral column. + Vertebrate specific. In arthropods 'abdomen' is the most distal section of the body which lies behind the thorax or cephalothorax. If need be we can introduce some grouping class + abdominal + + + BTO:0000020 + CALOHA:TS-0001 + EFO:0000968 + EMAPA:35102 + EV:0100011 + FMA:9577 + GAID:16 + MA:0000029 + MAT:0000298 + MESH:A01.047 + MIAA:0000298 + OpenCyc:Mx4rvVjgyZwpEbGdrcN5Y29ycA + galen:Abdomen + abdominopelvic region + abdominopelvis + uberon + adult abdomen + belly + celiac region + UBERON:0000916 + + + abdomen + + + + + + + + + Anatomical system that consists of the glands and parts of glands that produce endocrine secretions and help to integrate and control bodily metabolic activity. + Anatomical system containing glands which regulates bodily functions though the secretion of hormones.[AAO] + Multicellular organisms have complex endocrine systems, allowing responses to environmental stimuli, regulation of development, reproduction, and homeostasis. Nuclear receptors (NRs), a metazoan-specific family of ligand-activated transcription factors, play central roles in endocrine responses, as intermediates between signaling molecules and target genes. The NR family includes ligand-bound and orphan receptors, that is, receptors with no known ligand or for which there is no ligand Pocket. Understanding NR evolution has been further improved by comparison of several completed genomes, particularly those of deuterostomes and ecdysozoans. In contrast, evolution of NR ligands is still much debated. One hypothesis proposes that several independent gains and losses of ligand-binding ability in NRs occurred in protostomes and deuterostomes. A second hypothesis, pertaining to the NR3 subfamily (vertebrate steroid hormone receptors and estrogen related receptor), proposes that before the divergence of protostomes and deuterostomes, there was an ancestral steroid receptor (AncSR) that was ligand-activated and that orphan receptors secondarily lost the ability to bind a ligand. (...) Our analysis reveals that steroidogenesis has been independently elaborated in the 3 main bilaterian lineages (...).[well established][VHOG] + endocrine + + + + + AAO:0010279 + CALOHA:TS-1301 + EFO:0002969 + EHDAA2:0002224 + EMAPA:35306 + EV:0100128 + FBbt:00005068 + FMA:9668 + GAID:439 + MA:0000012 + MESH:A06 + TAO:0001158 + UMLS:C0014136 + VHOG:0000098 + XAO:0000158 + ZFA:0001158 + endocrine glandular system + endocrine system + systema endocrinum + uberon + UBERON:0000949 + + + + endocrine system + + + + + + + + Biological entity that is either an individual member of a biological species or constitutes the structural organization of an individual member of a biological species. + + + + AAO:0010841 + AEO:0000000 + BILA:0000000 + CARO:0000000 + EHDAA2:0002229 + FBbt:10000000 + FBbt_root:00000000 + FMA:62955 + HAO:0000000 + MA:0000001 + TAO:0100000 + TGMA:0001822 + UMLS:C1515976 + XAO:0000000 + ZFA:0100000 + uberon + UBERON:0001062 + + anatomical entity + + + + + + + + + + + + + + + + + + + + Situated along the perimeter of the adrenal gland, the adrenal cortex mediates the stress response through the production of mineralocorticoids and glucocorticoids, including aldosterone and cortisol respectively. It is also a secondary site of androgen synthesis. [WP,unvetted]. + All craniates have groups of cells homologous to the mammalian adrenocortical and chromaffin tissues (medulla), but they are scattered in and near the kidneys in fishes. (...) The cortical and chromaffin tissues come together to form adrenal glands in tetrapods.[well established][VHOG] + Kardong states that mammals are the first to have distinct cortext and medulla, but this contradicts XAO + + + + + AAO:0011009 + BTO:0000045 + CALOHA:TS-0015 + EFO:0000237 + EMAPA:18427 + EV:0100136 + FMA:15632 + GAID:447 + MA:0000118 + MAT:0000494 + MESH:A06.407.071.140 + UMLS:C0001613 + VHOG:0001481 + XAO:0000165 + adrenal gland cortex + cortex (glandula suprarenalis) + cortex of adrenal gland + cortex of suprarenal gland + suprarenal cortex + uberon + cortex glandulae suprarenalis + suprarenal + UBERON:0001235 + + + adrenal cortex + + + + + + + + + + + + + + + + + Outermost layer of an organ[WP]. + cortical + this class is used more generically than in FMA, and includes e.g. cortex of hair + + EFO:0000383 + EHDAA:9344 + FMA:61109 + galen:Cortex + cortex + cortex of organ + uberon + UBERON:0001851 + + + cortex + + + + + + + + + + + + + + + Organism subdivision which is the part of the body posterior to the cervical region (or head, when cervical region not present) and anterior to the caudal region. Includes the sacrum when present. + Organism subdivision that is the part of the body posterior to the head and anterior to the tail.[AAO] + Organism subdivision which is the part of the body posterior to the head and anterior to the tail.[TAO] + + + + + AAO:0010339 + BILA:0000116 + BTO:0001493 + CALOHA:TS-1071 + EFO:0000966 + EMAPA:31857 + FMA:7181 + MA:0000004 + MAT:0000296 + MIAA:0000296 + OpenCyc:Mx4rvVkJjpwpEbGdrcN5Y29ycA + TAO:0001115 + UMLS:C0460005 + XAO:0000054 + XAO:0003025 + ZFA:0001115 + galen:Trunk + thoracolumbar region + torso + trunk region + uberon + Rumpf + UBERON:0002100 + + + + trunk + + + + + + + + + + + + + + + + + + + + + + + + + + Endocrine glands are glands of the endocrine system that secrete their products directly into the circulatory system rather than through a duct.[WP, modified]. + + + + + AEO:0000098 + BTO:0001488 + CALOHA:TS-1300 + EHDAA2:0003098 + EMAPA:35999 + FMA:9602 + GAID:335 + MA:0002563 + MESH:A06.407 + OpenCyc:Mx4rvbkiRZwpEbGdrcN5Y29ycA + UMLS:C0014133 + ductless gland + glandula endocrina + uberon + ductless gland + glandulae endocrinae + UBERON:0002368 + + + endocrine gland + + + + + + + + + + + + + + + + + + + + + + Either of a pair of complex endocrine organs near the anterior medial border of the kidney consisting of a mesodermal cortex that produces glucocorticoid, mineralocorticoid, and androgenic hormones and an ectodermal medulla that produces epinephrine and norepinephrine[BTO]. + Anatomical structure which is found on the surface of the kidney and secretes various hormones including epinephrine, norephinephrine, aldosterone, corticosterone, and cortisol.[AAO] + All craniates have groups of cells homologous to the mammalian adrenocortical and chromaffin tissues, but they are scattered in and near the kidneys in fishes. (...) The cortical and chromaffin tissues come together to form adrenal glands in tetrapods.[well established][VHOG] + The origin of the adrenal gland is still controversial. It is thought to share the same origin as the kidney and gonads, derived from coelomic epithelium of the urogenital ridge and/or the underlying mesenchyme (Keegan and Hammer, 2002; Morohashi, 1997). We follow Kardong and state homology at the level of the cortex and medulla rather than gland as a whole + suprarenal cortex manufactures corticosteroids; suprarenal medulla manufactures epinephrine and norepinephrine; suprarenal medulla receives preganglionic sympathetic innervation from the greater thoracic splanchnic n. + + + + + AAO:0010551 + BTO:0000047 + CALOHA:TS-0016 + EFO:0000238 + EMAPA:18426 + EV:0100135 + FMA:9604 + GAID:446 + MA:0000116 + MAT:0000071 + MESH:A06.407.071 + MIAA:0000071 + OpenCyc:Mx4rvXYiz5wpEbGdrcN5Y29ycA + UMLS:C0001625 + VHOG:0001141 + XAO:0000164 + galen:AdrenalGland + glandula adrenalis + glandula suprarenalis + uberon + adrenal + adrenal capsule + adrenal medulla cell + atrabiliary capsule + epinephric gland + epinephros + glandula suprarenalis + interrenal gland + suprarenal capsule + suprarenal gland + UBERON:0002369 + + + adrenal gland + + + + + + + + + + + + The abdominal segment of the torso. + + + EMAPA:35104 + FMA:259211 + MA:0000021 + uberon + abdomen/pelvis/perineum + lower body + lumbar region + UBERON:0002417 + abdominal segment of trunk + + + + + + + + + A gland is an organ in an animal's body that synthesizes a substance for release such as hormones or breast milk, often into the bloodstream (endocrine gland) or into cavities inside the body or its outer surface (exocrine gland). A gland is an organ specialised for secretion[GO]. + glandular + UBERON:MIAA_0000021 + + + + + AAO:0000212 + AEO:0000096 + BTO:0000522 + EFO:0000797 + EHDAA2:0003096 + EHDAA:2161 + EHDAA:4475 + EHDAA:6522 + EMAPA:18425 + FBbt:00100317 + FMA:86294 + HAO:0000375 + MA:0003038 + MAT:0000021 + MIAA:0000021 + OpenCyc:Mx4rwP3vyJwpEbGdrcN5Y29ycA + UMLS:C1285092 + WikipediaCategory:Glands + galen:Gland + uberon + Druese + glandula + UBERON:0002530 + + + gland + + + + + + + + + + + + + + + + This gland can either be a discrete structure located bilaterally above each kidney, or a cluster of cells in the head kidney that perform the functions of the adrenal gland. In either case, this organ consists of two cells types, aminergic chromaffin cells and steroidogenic cortical cells[GO] + keep this grouping class so long as it is required for GO + All craniates have groups of cells homologous to the mammalian adrenocortical and chromaffin tissues, but they are scattered in and near the kidneys in fishes. (...) The cortical and chromaffin tissues come together to form adrenal glands in tetrapods.[well established][VHOG] + VHOG:0001141 + adrenal gland - interrenal gland + adrenal gland/interrenal tissue + uberon + adrenal - interrenal gland + suprarenal gland - interrenal gland + UBERON:0006858 + + + adrenal/interrenal gland + + + + + + + + + + + + + + + + FMA:25054 + region of trunk + trunk subdivision + uberon + UBERON:0009569 + + subdivision of trunk + + + + + + + + + An anatomical structure that has more than one cell as a part. + CARO:0010000 + FBbt:00100313 + multicellular structure + uberon + UBERON:0010000 + + multicellular anatomical structure + + + + + + + + + + + + + + + A major subdivision of an organism that divides an organism along its main body axis (typically anterio-posterior axis). In vertebrates, this is based on the vertebral column. + Ideally this would be disjoint with analagous class for appendicular axes, but currently 'appendages' like antennae, horns cause a problem + axial subdivision of organism + uberon + body segment + main body segment + UBERON:0011676 + + subdivision of organism along main body axis + + + + + + + + + A principle subdivision of an organism that includes all structures along the primary axis, typically the anterior-posterior axis, from head to tail, including structures of the body proper where present (for example, ribs), but excluding appendages. + uberon + UBERON:0013701 + main body axis + + + + + + + + + + + + + + + The region of the organism associated with the visceral organs. + Cardinal body part, which consists of a maximal set of diverse subclasses of organ and organ part spatially associated with the vertebral column and ribcage. Examples: There is only one body proper[FMA:231424]. + AEO:0000103 + BTO:0001489 + FMA:231424 + uberon + body + whole body + UBERON:0013702 + + body proper + + + + + + + + + + + + + + new system + + + + + + + diff --git a/docs/template.md b/docs/template.md index 2f3252309..027757b3f 100644 --- a/docs/template.md +++ b/docs/template.md @@ -184,11 +184,10 @@ If the command includes `--ancestors`, the result ontology will include the ance ## Examples Create an output ontology that includes the input ontology and the terms defined in the template: - -``` -robot template --merge-before --input edit.owl \ - --template template.csv --output results/template.owl -``` + + robot template --merge-before --input edit.owl \ + --template part_of_template.csv --output part_of_uberon.owl + Create two outputs -- the templated terms ([`uberon_template.owl`](/examples/uberon_template.owl)) and the input ontology merged with the output ontology with an annotation ([`uberon_v2.owl`](/examples/uberon_v2)):