Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for discussion: create nodes for ancestral species #53

Open
cmungall opened this issue Apr 1, 2021 · 3 comments
Open

for discussion: create nodes for ancestral species #53

cmungall opened this issue Apr 1, 2021 · 3 comments

Comments

@cmungall
Copy link
Member

cmungall commented Apr 1, 2021

For each intermediate node in ncbitaxon there is an implicit ancestral species/organism. Note the node itself represents a superclass that encompasses all instances of the node.

We can inject additional nodes, this is a SKETCH of how it might work

  • Bilateria (NCBITaxon:33213)
    • ancestral Bilateria (ID: NCBITaxon:33213_anc)
    • descendants of ancestral Bilateria (ID: NCBITaxon:33213_desc)
      • Protostome
      • Deuterostome
      • ....

The hierarchy would still be pairwise disjoint facilitating taxon checks, see geneontology/gaferencer#81

note: any other ID scheme could be used for the inject nodes

ancestral-X would have taxrank=species, but is an OWL class whose members are individual organisms (likely all dead, except for very recently speciated species) just like other classes in the ontology.

Note: a completely orthogonal discussion is the extent to which axioms can be injected into the direct database translation. This should not be discussed here. But the proposal here could be implemented as a separate optional bridge owl file.

@cmungall cmungall added this to To do in Taxon Constraints across AOs via automation Apr 1, 2021
@cmungall
Copy link
Member Author

cmungall commented Apr 1, 2021

For additional formality:

if we have an instance-level relation (ie object property) between organisms geneological-parent-of, has-geneological-parent, and corresponding non-reflexive transitive ancestor relations, we can axiomatize

  • desc-X = X and genealogical-descendant-of anc-X

@cmungall
Copy link
Member Author

cmungall commented Apr 8, 2021

@balhoff came up with some SPARQL to inject this

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX in_taxon: <http://purl.obolibrary.org/obo/RO_0002162>
INSERT {
  ?ancestor a owl:Class .
  ?descendant a owl:Class .
  ?ancestor rdfs:subClassOf ?supertaxon .
  ?descendant rdfs:subClassOf ?supertaxon .
  ?descendant owl:disjointWith ?ancestor .
  ?subtaxon rdfs:subClassOf ?descendant .
  ?ancestor rdfs:subClassOf [
    a owl:Restriction ;
    owl:onProperty in_taxon: ;
    owl:someValuesFrom ?ancestor
  ] .
  ?descendant rdfs:subClassOf [
    a owl:Restriction ;
    owl:onProperty in_taxon: ;
    owl:someValuesFrom ?descendant
  ] .
  [  a owl:Restriction ;
     owl:onProperty in_taxon: ;
     owl:someValuesFrom ?ancestor ;
     owl:disjointWith [
       a owl:Restriction ;
       owl:onProperty in_taxon: ;
       owl:someValuesFrom ?descendant 
       ]
  ] .
}
WHERE {
  ?subtaxon rdfs:subClassOf ?supertaxon .
  FILTER(isIRI(?subtaxon))
  FILTER(isIRI(?supertaxon))
  FILTER(STRSTARTS(STR(?subtaxon), "http://purl.obolibrary.org/obo/NCBITaxon_"))
  FILTER(STRSTARTS(STR(?supertaxon), "http://purl.obolibrary.org/obo/NCBITaxon_"))
  BIND(IRI(REPLACE(STR(?supertaxon), "http://purl.obolibrary.org/obo/NCBITaxon_", "http://purl.obolibrary.org/obo/NCBITaxon_Ancestor_")) AS ?ancestor)
  BIND(IRI(REPLACE(STR(?supertaxon), "http://purl.obolibrary.org/obo/NCBITaxon_", "http://purl.obolibrary.org/obo/NCBITaxon_Descendant_")) AS ?descendant)
}

this would require a further robot step to remove redundancy (either reduce, or reason with appropriate options)

@balhoff
Copy link
Member

balhoff commented Apr 9, 2021

Here is a slight tweak to correct a problem where the additional nodes weren't being generated for leaf taxa:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX in_taxon: <http://purl.obolibrary.org/obo/RO_0002162>
INSERT {
  ?ancestor a owl:Class .
  ?descendant a owl:Class .
  ?ancestor rdfs:subClassOf ?supertaxon .
  ?descendant rdfs:subClassOf ?supertaxon .
  ?descendant owl:disjointWith ?ancestor .
  ?subtaxon rdfs:subClassOf ?descendant .
  ?ancestor rdfs:subClassOf [
    a owl:Restriction ;
    owl:onProperty in_taxon: ;
    owl:someValuesFrom ?ancestor
  ] .
  ?descendant rdfs:subClassOf [
    a owl:Restriction ;
    owl:onProperty in_taxon: ;
    owl:someValuesFrom ?descendant
  ] .
  [  a owl:Restriction ;
     owl:onProperty in_taxon: ;
     owl:someValuesFrom ?ancestor ;
     owl:disjointWith [
       a owl:Restriction ;
       owl:onProperty in_taxon: ;
       owl:someValuesFrom ?descendant 
       ]
  ] .
}
WHERE {
  ?supertaxon a owl:Class .
  OPTIONAL { 
    ?subtaxon rdfs:subClassOf ?supertaxon . 
    FILTER(isIRI(?subtaxon))
    FILTER(STRSTARTS(STR(?subtaxon), "http://purl.obolibrary.org/obo/NCBITaxon_"))
  }
  FILTER(isIRI(?supertaxon))
  FILTER(STRSTARTS(STR(?supertaxon), "http://purl.obolibrary.org/obo/NCBITaxon_"))
  BIND(IRI(REPLACE(STR(?supertaxon), "http://purl.obolibrary.org/obo/NCBITaxon_", "http://purl.obolibrary.org/obo/NCBITaxon_Ancestor_")) AS ?ancestor)
  BIND(IRI(REPLACE(STR(?supertaxon), "http://purl.obolibrary.org/obo/NCBITaxon_", "http://purl.obolibrary.org/obo/NCBITaxon_Descendant_")) AS ?descendant)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants