phenoscape / phenoscape-kb-services

Web services application for the Phenoscape RDF knowledgebase.
https://kb.phenoscape.org/apidocs/#/
MIT License
1 stars 3 forks source link

Term detail API endpoint returns relationships #43

Open hlapp opened 8 years ago

hlapp commented 8 years ago

The Term detail API endpoint at /api/term according to documentation returns only a label and a textual definition. In reality this is not true. For one, it also returns the @id attribute with the term ID (which is a good thing and should be kept, but is counter to documentation).

Secondly, it also returns relationships. For the example in the docs (basihyal bone), this is the following:

"relationships": [
    {
      "property": {
        "@id": "http://purl.obolibrary.org/obo/RO_0002158",
        "label": "homologous to"
      },
      "value": {
        "@id": "http://purl.obolibrary.org/obo/UBERON_0003999",
        "label": "hyoid bone body"
      }
    },
    {
      "property": {
        "@id": "http://purl.obolibrary.org/obo/RO_0002202",
        "label": "develops from"
      },
      "value": {
        "@id": "http://purl.obolibrary.org/obo/UBERON_0011615",
        "label": "basihyal cartilage"
      }
    },
    {
      "property": {
        "@id": "http://purl.obolibrary.org/obo/RO_0002473",
        "label": "composed primarily of"
      },
      "value": {
        "@id": "http://purl.obolibrary.org/obo/UBERON_0002481",
        "label": "bone tissue"
      }
    }
  ]

Aside from the fact that it is counter to documentation, I'm wondering why it is missing the is_a or subClassOf relationships?

In principle the relationships of a term are useful information and seem pertinent to a term's detail. However, when introducing such changes that add an attribute with zero or more values (in contrast to one value such as for label and definition) one needs to be aware that they can easily break code that uses the API in a way that expects (and in the documentation is promised!) a simple list of single-valued attributes. See xu-hong/rphenoscape#6 and xu-hong/rphenoscape#8 as an example.

hlapp commented 6 years ago

The link to the API endpoint documentation above is obsolete, but at the now current documentation the same problem remain (documentation incorrect in not mentioning relationships), and the subClassOf/is_a are still not being returned.

$ curl -X GET "http://kb.phenoscape.org/api/term?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FUBERON_0011618" -H "accept: application/json"
balhoff commented 5 years ago

TODO:

balhoff commented 5 years ago

Depends on https://github.com/phenoscape/pipeline/issues/125