Skip to content

Commit

Permalink
fix: simpler method using equivalentIDs semanticType
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Dec 2, 2022
1 parent fbc95d5 commit 606e8b1
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/query_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,20 +194,23 @@ module.exports = class QNode {
});
return utils.getUnique(expanded_categories);
}
let ancestors = new Set(
utils
.toArray(this.category)
.map((category) => utils.removeBioLinkPrefix(category))
.reduce((arr, category) => [...arr, ...biolink.getAncestorClasses(category)], [])
.filter((category) => !utils.toArray(this.category).includes(`biolink:${category}`)),
);
let categories = [];
// let ancestors = new Set(
// utils
// .toArray(this.category)
// .map((category) => utils.removeBioLinkPrefix(category))
// .reduce((arr, category) => [...arr, ...biolink.getAncestorClasses(category)], [])
// .filter((category) => !utils.toArray(this.category).includes(`biolink:${category}`)),
// );
let categories = utils.toArray(this.category).map((category) => utils.removeBioLinkPrefix(category));
Object.values(this.equivalentIDs).map((entities) => {
entities.map((entity) => {
categories = [...categories, ...entity.semanticTypes.map((semantic) => utils.removeBioLinkPrefix(semantic))];
categories = [...categories, entity.semanticType];
});
});
return utils.getUnique(categories).filter(category => !ancestors.has(category));
return utils.getUnique(
utils.getUnique(categories).reduce((arr, category) => [...arr, ...biolink.getDescendantClasses(category)], []),
);
// .filter(category => !ancestors.has(category));
}

getEntities() {
Expand Down

0 comments on commit 606e8b1

Please sign in to comment.