-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jstree/children endpoint returns 500 for V1 (legacy) API #645
Comments
The IDs used to be simple numbers in OLS3 but in OLS4 they are base64 strings. See: [ {
"id" : "aHR0cDovL3B1cmwub2JvbGlicmFyeS5vcmcvb2JvL1BDT18wMDAwMDMx",
"parent" : "#",
"iri" : "http://purl.obolibrary.org/obo/PCO_0000031",
"text" : "organismal entity",
"state" : {
"opened" : false,
"selected" : true
},
"children" : true,
"a_attr" : {
"iri" : "http://purl.obolibrary.org/obo/PCO_0000031",
"ontology_name" : "agro",
"title" : "http://purl.obolibrary.org/obo/PCO_0000031",
"class" : "is_a"
},
"ontology_name" : "agro"
}, {
"id" : "aHR0cDovL3d3dy53My5vcmcvMjAwMi8wNy9vd2wjVGhpbmc=",
"parent" : "#",
"iri" : "http://www.w3.org/2002/07/owl#Thing",
"text" : "Thing",
"state" : {
"opened" : true
},
"children" : false,
"a_attr" : {
"iri" : "http://www.w3.org/2002/07/owl#Thing",
"ontology_name" : "agro",
"title" : "http://www.w3.org/2002/07/owl#Thing",
"class" : "is_a"
},
"ontology_name" : "agro"
} ] Note the ID is which returns [ {
"id" : "aHR0cDovL3B1cmwub2JvbGlicmFyeS5vcmcvb2JvL1BDT18wMDAwMDMxO2h0dHA6Ly9wdXJsLm9ib2xpYnJhcnkub3JnL29iby9QQ09fMDAwMDAwMA==",
"parent" : "aHR0cDovL3B1cmwub2JvbGlicmFyeS5vcmcvb2JvL1BDT18wMDAwMDMx",
"iri" : "http://purl.obolibrary.org/obo/PCO_0000000",
"text" : "collection of organisms",
"state" : {
"opened" : false
},
"children" : true,
"a_attr" : {
"iri" : "http://purl.obolibrary.org/obo/PCO_0000000",
"ontology_name" : "agro",
"title" : "http://purl.obolibrary.org/obo/PCO_0000000",
"class" : "is_a"
},
"ontology_name" : "agro"
} ] This should be compatible with the unmodified tree widget code from OLS3 as we tested it at the time. The numeric IDs were changed to be base64'd IRIs to ensure the same API call returns the same result every time (as the numbers were not order guaranteed). |
@jamesamcl |
Thanks @jamesamcl for the clarification... in terms of response @Pooya-Oladazimi I believe returning a 404 error instead of an empty set would be a better approach here as the child being searched doesn't exist. |
I had a further look at this and noticed a problem with it. As an example, look at this call that returns the jsTree for the term "generically dependent continuant" from AGRO ontology: Now if you decode the base64 "parent" field: you get two Iris: This is not correct since the term has only one parent and this one is a list of ancestors. Without a direct parent, tree building faces some issues. The equivalent call in OLS3: |
The "parent" field indeed contains a base64 string of a concatenated list of ancestors, because that's the only way to uniquely identify the parent node (as the same class can appear multiple times in the tree if there are different paths to it through its ancestors, so just the immediate parent would not be enough). You're not actually supposed to decode it, it's just a unique identifier for the parent node. In OLS3 numbers were generated (specifically, node IDs from neo4j), in OLS4 we use this string, but it still serves the same purpose. This API was built to support the tree view widget: https://github.com/EBISPOT/ols-treeview so maybe looking at that code would be helpful |
Thanks for the quick response. I was under the impression that that parent field is the parent node iri that I use to build a hierarchical list from this flat list. I get it now. Thanks again. |
Describe the bug
The call to fetch the children for a term in the term tree returns 500.
To Reproduce
Examples:
https://www.ebi.ac.uk/ols4/api/ontologies/agro/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FPCO_0000031/jstree/children/3
https://www.ebi.ac.uk/ols4/api/ontologies/ngbo/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000001/jstree/children/0
https://www.ebi.ac.uk/ols4/api/ontologies/agro/properties/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FRO_0000053/jstree/children/3
Expected behavior
Legacy API calls should work.
Screenshots
N/A
Upload minimal complete example
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: