mapping-commons / sssom-api

Apache License 2.0
7 stars 0 forks source link

Return facet list for each page #51

Open anitacaron opened 1 year ago

anitacaron commented 1 year ago

The JSON result should have

{
"data": [{..}],
"pagination": {},
"facets": {
 "mapping_justification": [],
 "predicate_id": [],
 "mapping_provider": [],
 "object_source": [],
 "confidence": [],
 "mapping_set_title": []
}
}
anitacaron commented 1 year ago

The facets don't have a label for the UI. How to deal with it?

This is how it's returned:

"facets": {
    "mapping_justification": [
      "https://w3id.org/semapv/LogicalReasoning",
      "https://w3id.org/semapv/LexicalMatching"
    ],
    "predicate": [
      "http://www.w3.org/2004/02/skos/core#closeMatch",
      "http://www.w3.org/2004/02/skos/core#exactMatch"
    ],
    "mapping_provider": null,
    "object_source": null
  }
matentzn commented 1 year ago

One option is to have a SEMPAV endpoint embedded in the API. This would allow to do things like returning SEMAPV vocabulary metadata that could be displayed in tooltips in the likes.

anitacaron commented 1 year ago

Can you give a link to the SEMPAV endpoint? I couldn't find it.

matentzn commented 1 year ago

No no, there is no SEMAPV endpoint - only the vocabulary https://github.com/mapping-commons/semantic-mapping-vocabulary/blob/main/semapv.owl

Basically we have two options:

  1. We have the UI depend on OLS for obtaining labels for sempav, and make a semapv OLS endpoint mandatory when configuring the UI (this could be ok because we can simply link the public OLS endpoint for this purpose)
  2. We add a very basic /terminology endpoint to the SSSOM API to request labels and definitions for semapv / sssom vocabulary. Input: ID (CURIE), output: Label, Definition

I personally prefer the second because this is self contained, but you may want to check with @udp for which solution is advidable.

anitacaron commented 1 year ago

I looked into the vocabulary file semapv.owl, and it seems they have different IRIs used for the mapping_justification values.

The IRI I have when generating SSSOM:

https://w3id.org/semapv/LexicalMatching

The IRI in the semapv.owl file:

https://w3id.org/semapv/vocab/LexicalMatching

Which one is not up to date?

matentzn commented 1 year ago
https://w3id.org/semapv/vocab/LexicalMatching

Is correct.

I had already fixed that in bioregistry: https://bioregistry.io/registry/semapv

Made an issue in sssom py to fix this: https://github.com/mapping-commons/sssom-py/issues/362