geneontology / obographs

Basic and Advanced OBO Graphs: specification and reference implementation
64 stars 12 forks source link

Annotations on xref annotation assertions are not serialized in json #44

Open cmungall opened 5 years ago

cmungall commented 5 years ago

Carried over from https://github.com/monarch-initiative/mondo/issues/753

test case

[Term]
id: X:1
xref: X:2 {source="X:3"}

produces:

      "meta" : {
        "xrefs" : [ {
          "val" : "X:2"
        } ]
      },

loses source

matentzn commented 11 months ago

We need to start acting on this. What about:

{
  "id": "http://purl.obolibrary.org/obo/MONDO_0014957",
  "meta": {
      "xrefs": [
          {
              "val": "OMIM:617182",
              "annotations": [
                  {
                      "pred": "oboInOwl:source",
                      "val": "OMIM:617182"
                  },
                  {
                      "pred": "http://www.w3.org/2000/01/rdf-schema#seeAlso",
                      "val": "https://github.com/monarch-initiative/mondo/issues/1623"
                  }
              ]
          },
          {
              "val": "UMLS:C4310678"
          }
      ],
      "synonyms": [
          {
              "pred": "hasExactSynonym",
              "val": "language delay and attention Deficit-hyperactivity disorder/cognitive impairment with or without Cardiac arrhythmia",
              "xrefs": [
                  "OMIM:617182"
              ],
              "annotations": [
                  {
                      "pred": "oboInOwl:source",
                      "val": "OMIM:617182"
                  },
                  {
                      "pred": "http://www.w3.org/2000/01/rdf-schema#seeAlso",
                      "val": "https://github.com/monarch-initiative/mondo/issues/1623"
                  }
              ]
          },
          {
              "pred": "hasExactSynonym",
              "val": "LADCI",
              "xrefs": [
                  "MONDOLEX:0014957",
                  "OMIM:617182"
              ],
              "synonymType": "http://purl.obolibrary.org/obo/mondo#ABBREVIATION"
          }
      ],
      "basicPropertyValues": [
          {
              "pred": "http://www.w3.org/2004/02/skos/core#exactMatch",
              "val": "http://linkedlifedata.com/resource/umls/id/C4310678",
              "annotations": [
                  {
                      "pred": "oboInOwl:source",
                      "val": "OMIM:617182"
                  },
                  {
                      "pred": "http://www.w3.org/2000/01/rdf-schema#seeAlso",
                      "val": "https://github.com/monarch-initiative/mondo/issues/1623"
                  }
              ]
          },
          {
              "pred": "http://www.w3.org/2004/02/skos/core#exactMatch",
              "val": "https://omim.org/entry/617182"
          }
      ]
  },
  "type": "CLASS",
  "lbl": "language delay and attention deficit-hyperactivity disorder/cognitive impairment with or without cardiac arrhythmia"
}
cmungall commented 11 months ago

I realize annotations is quite user-friendly to an OWL user, but the intended translation is

id: X:1
xref: X:2 {source="X:3"}

to

nodes:
  - id: X:1
     meta:
        xrefs:
           - val: X:2
              meta:
                 basicPropertyValues:
                   pred: oboInOwl:source
                   val: X:3

While I don't love the excessive nesting here, this is consistent with the composition-over-inheritance design of obographs dating back to <2015.

The basic principle is that (owl) annotations go on a meta object. This applies to entity axioms and to axiom annotations. Commonly used annotation predicates get their own priviliged key (xrefs, synonyms, def), others go in a generic basicPropertyValues object.

Note this design allows for arbitrary Nth order annotations. I think nesting any more than the above would be an anti-pattern. However, others in the OBO community have expressed a desire to do this, and OWL allows it, so the genericity buys us something here

matentzn commented 11 months ago

Can you carefully check that this is what you mean?

{
    "id": "http://purl.obolibrary.org/obo/MONDO_0014957",
    "meta": {
        "xrefs": [
            {
                "val": "OMIM:617182",
                "meta": {
                    "basicPropertyValues": [
                        {
                            "pred": "oboInOwl:source",
                            "val": "OMIM:617182"
                        },
                        {
                            "pred": "http://www.w3.org/2000/01/rdf-schema#seeAlso",
                            "val": "https://github.com/monarch-initiative/mondo/issues/1623"
                        }
                    ]
                }
            },
            {
                "val": "UMLS:C4310678"
            }
        ],
        "synonyms": [
            {
                "pred": "hasExactSynonym",
                "val": "language delay and attention Deficit-hyperactivity disorder/cognitive impairment with or without Cardiac arrhythmia",
                "xrefs": [
                    "OMIM:617182"
                ],
                "meta": {
                    "basicPropertyValues": [
                        {
                            "pred": "oboInOwl:source",
                            "val": "OMIM:617182"
                        },
                        {
                            "pred": "http://www.w3.org/2000/01/rdf-schema#seeAlso",
                            "val": "https://github.com/monarch-initiative/mondo/issues/1623"
                        }
                    ]
                }
            },
            {
                "pred": "hasExactSynonym",
                "val": "LADCI",
                "xrefs": [
                    "MONDOLEX:0014957",
                    "OMIM:617182"
                ],
                "synonymType": "http://purl.obolibrary.org/obo/mondo#ABBREVIATION"
            }
        ],
        "basicPropertyValues": [
            {
                "pred": "http://www.w3.org/2004/02/skos/core#exactMatch",
                "val": "http://linkedlifedata.com/resource/umls/id/C4310678",
                "meta": {
                    "basicPropertyValues": [
                        {
                            "pred": "oboInOwl:source",
                            "val": "OMIM:617182"
                        },
                        {
                            "pred": "http://www.w3.org/2000/01/rdf-schema#seeAlso",
                            "val": "https://github.com/monarch-initiative/mondo/issues/1623"
                        }
                    ]
                }
            },
            {
                "pred": "http://www.w3.org/2004/02/skos/core#exactMatch",
                "val": "https://omim.org/entry/617182"
            }
        ]
    },
    "type": "CLASS",
    "lbl": "language delay and attention deficit-hyperactivity disorder/cognitive impairment with or without cardiac arrhythmia"
}
cmungall commented 11 months ago

yes!

julesjacobsen commented 11 months ago

Related to #97, what are the prefix definitions for oboInOwl:source or http://www.w3.org/2004/02/skos/core#exactMatch or http://www.w3.org/2000/01/rdf-schema#seeAlso.

Presumably the fully qualified URIs do not require a prefix definition as they are complete. But otherwise, is it possible that any field of a PropertyValue e.g. pred, val or xref can be a CURIE which requires a PrefixDefinition?