From 20a19c8e947e5b5488a2fe4fc22cb84cbea69b72 Mon Sep 17 00:00:00 2001 From: tokebe <43009413+tokebe@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:33:44 -0500 Subject: [PATCH] fix: filter self-subclass edges --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index cfe26747..aa85e2a4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -178,6 +178,8 @@ export default class TRAPIQueryHandler { subclassCuries.forEach(([original, expanded]) => { const subject = nodeID; const object = primaryIDsByOriginalID[original]; + // Don't keep self-subclass + if (subject === object) return; const subclassEdgeID = `expanded-${subject}-subclass_of-${object}`; if (subclassEdgeID in this.bteGraph.edges) return; const subclassEdge = new KGEdge(subclassEdgeID, {