EBISPOT / OLS

Ontology Lookup Service from SPOT at EBI
http://www.ebi.ac.uk/ols
Apache License 2.0
95 stars 40 forks source link

"id" field change in select result? #150

Open shenzhuxi opened 6 years ago

shenzhuxi commented 6 years ago

http://www.ebi.ac.uk/ols/api/select?type=class&ontology=edam&sort=label%20desc&q=d I just found that the result is different today. Before: "id":"edam:http://edamontology.org/topic_3404" Now: "id":"edam:class:http://edamontology.org/topic_3404" Why "class" was added here? Is it a permanent change? How can I get update notification for this kind of change?

LLTommy commented 6 years ago

I can not imaging that this changed recently. When was "before"? (Just because we did not deploy a new version of the software recently)

Also I do believe that you want to look at the 'iri' field instead of the 'id' field. Wouldn't this solve your problem?

shenzhuxi commented 6 years ago

It seems changed on 8 May. https://github.com/EBISPOT/OLS/commit/ee3b5a634904262c8c691ba06986d660a3de512d#diff-faf801fd6bb233c4b95fb4f82af912e0

+    private String generateId(String ontologyName, String type, String iri) {
+        return ontologyName.toLowerCase() +  ":" + type  +":" + iri;

Since <uniqueKey>id</uniqueKey> is in Solr schema.xml, I thought that it's safer to used it as the unique id.

LLTommy commented 6 years ago

Oh ok, 8 of May. We have to wait for Simon to reply to this then, I don't know about this change. However, I still think it would be safer to work with the iri than with the id field.

simonjupp commented 6 years ago

The id is an internal id used specifically by the search index and therefore not necessarily stable. It was previously constructed from the ontology name and entity URI but we added the entity type to deal with cases where the same URI is used for a class, property or individual within an ontology.

We will add some documentation to make this clear and sorry for the inconvenience. Any major API changes will be announced on the OLS announce mailing list that you can sign up to here https://listserver.ebi.ac.uk/mailman/listinfo/ols-announce

shenzhuxi commented 6 years ago

I'm using the highlighting for autocomplete in https://github.com/ebiwd/ebi_ols which is used in multiple EBI sites.

"highlighting":{
"edam:class:http://edamontology.org/topic_3404":{
"label_autosuggest":[
"<b>Dermatology</b>"
],
"synonym_autosuggest":[
"<b>Dermatological</b> <b>disorders</b>"
]
},
}

You can see that "id" is key, and there is not other unique field like "iri" in this case.

simonjupp commented 6 years ago

right, it is needed for that, but you shouldn't rely on the structure of the id, just that the document in the results will be used as the key for highlighting information.