Draft ontology menu

This commit is contained in:
2026-04-08 11:39:57 +02:00
parent 556086117b
commit 12ae63d332
3 changed files with 69 additions and 16 deletions

View File

@@ -2,6 +2,33 @@
* @module Ontology
*/
/**
* @todo Temporarily returns domains and ontology labels only
* Traverse an ontology from its JSON description
* @param {String} jsonPath The path (URI) of the ontology JSON file
* @returns {Object}
*/
export async function traverseOntology(jsonPath) {
const ontology = await loadOntology(jsonPath);
const domains = [];
for (const k of Object.keys(ontology)) {
if (k === 'domains') {
for (const domainKey of Object.keys(ontology[k])) {
domains.push({
label: domainKey,
child: ontology[k][domainKey][0].label,
});
}
}
}
return {
ontology: ontology.ontology,
domains
};
}
/**
* Load an ontology from its JSON description
* @param {String} jsonPath The path (URI) of the ontology JSON file