Comments (6)
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 aHR0cDovL3B1cmwub2JvbGlicmFyeS5vcmcvb2JvL1BDT18wMDAwMDMx
. So the correct URL for the children 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).
from ols4.
@jamesamcl
Many thanks for the clarification.
But it would be nice to return an empty result set when a wrong id is given rather than raise a 500 server issue response code.
from ols4.
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.
from ols4.
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:
(frontend view: https://www.ebi.ac.uk/ols4/ontologies/agro/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000031)
Now if you decode the base64 "parent" field:
aHR0cDovL3B1cmwub2JvbGlicmFyeS5vcmcvb2JvL0JGT18wMDAwMDAxO2h0dHA6Ly9wdXJsLm9ib2xpYnJhcnkub3JnL29iby9CRk9fMDAwMDAwMg==
you get two Iris:
http://purl.obolibrary.org/obo/BFO_0000001;http://purl.obolibrary.org/obo/BFO_0000002
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:
https://service.tib.eu/ts4tib/api/ontologies/agro/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000031/jstree?viewMode=All&siblings=false
from ols4.
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
from ols4.
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.
from ols4.
Related Issues (20)
- Deprecated term message not showing any information, only `Object` HOT 1
- List of OLS instances? HOT 2
- value of type is set to class for V1SearchController + V1SelectController HOT 1
- OLS search is intermittently slow HOT 3
- Chemical Analysis Ontology short_form codes are incorrectly formatted HOT 10
- Missing EFO ontology entirely HOT 3
- Loading STATO v1.5 to OLS HOT 9
- Some disjointness information between classes is missing from OLS. HOT 1
- Search on ontologies tab not always working HOT 1
- API documentation issues
- slim option HOT 2
- Property Information broken for certain properties
- Links in custom properties dont work as expected HOT 1
- Errors generated during API testing.
- Incorrect CURIEs when the name includes an underscore
- OLS data dumps not updated since March 2024 HOT 3
- OLS4 don't load ontologies HOT 2
- OLS4 dev is very slow HOT 1
- inconsistency between ols4 dev and prod HOT 1
- OIO Terms API Endpoint is Broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ols4.