geneontology / obographs

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

Add a prefixes header #97

Open cmungall opened 1 year ago

cmungall commented 1 year ago

Consistent with other RDF serializations we should add a prefixes header

  prefixes:
    slot_uri: sh:declare
    range: PrefixDeclaration
    multivalued: true
    inlined: true
    description: >-
      A collection of mappings between prefixes and namespaces, used to map CURIEs (e.g. GO:0008150) to
      IRIs (e.g. http://purl.obolibrary.org/obo/GO_0008150)

range:

  PrefixDeclaration:
    class_uri: sh:PrefixDeclaration
    description: >-
      A mapping between an individual prefix (e.g. GO) and a namespace (e.g. http://purl.obolibrary.org/obo/GO_)
    attributes:
      prefix:
        key: true
        slot_uri: sh:prefix
        description: The prefix of a prefix declaration.
        range: string
        comments:
          - It is strongly recommended that the prefix is a valid NCName
      namespace:
        slot_uri: sh:namespace
        description: The namespace associated with a prefix in a prefix declaration.
        range: uri
matentzn commented 1 year ago

This is another very important issue for now.

julesjacobsen commented 1 year ago

So this in on the Graph object?

graphDocument:
  graphs:
    -  id: hp
       prefixes:
           - prefix: "HP"
             namespace: "http://purl.obolibrary.org/obo/HP_"

To answer my own question, yes. However, this is also found on the GraphDocument, so presumably that is a unique set of all PrefixDefinitions found in all Graph instances?

julesjacobsen commented 1 year ago

Also, where are these gleamed from? Post-OWL translation or from the OWL file?

cmungall commented 1 year ago

@balhoff can we align with how we want to do for obo format. I am still keen to place explicitly in owl domain of discourse via shacl data model but if you think prefix declarations persist enough...

balhoff commented 1 year ago

@cmungall @julesjacobsen you can retrieve the prefix declarations that were used in the ontology when it was parsed, if the format was a PrefixOWLOntologyFormat: https://github.com/owlcs/owlapi/pull/1102/files#diff-dc57a7f9dedea84b58b14d5ac747bfcbf65c94ee8264219cacf2a35c67f78193R55-R57

I think this is the way that prefix declarations generally move between parsing and serializing in the OWL API.

balhoff commented 1 year ago

By the way, the OBO format code assumes the http://purl.obolibrary.org/obo/{IDSPACE} mechanism outside of the rest of the prefix mappings (OBO ontology prefixes are implicit). I don't know if you want to do that here or not.

matentzn commented 1 year ago

Moving @julesjacobsen comment back here.

@cmungall can you help with this?

I wonder about this. Given the following synonym type def.

{
              "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"
                  }
              ]
          }
  1. Under which exact circumstances should which exact value of a pred slot be serialised as a CURIE?
  2. Under which exact circumstances should which exact value of a val slot be serialised as a CURIE?

You can use the above examples from above:

  1. "xrefs": [ "OMIM:617182"],
  2. "pred": "oboInOwl:source",
  3. "val": "OMIM:617182"
  4. "pred": "http://www.w3.org/2000/01/rdf-schema#seeAlso",
  5. "val": "https://github.com/monarch-initiative/mondo/issues/1623"

How is this driven by the obographs schema?