From 7cf61195a7e0dac0f6615e2e7f97defbba365e57 Mon Sep 17 00:00:00 2001 From: jiwen xin Date: Mon, 1 Feb 2021 10:12:49 -0800 Subject: [PATCH 1/2] fix: :bug: fix issue regarding missing type information for node attributes https://github.com/biothings/BioThings_Explorer_TRAPI/issues/23 --- src/controllers/QueryGraphHandler/knowledge_graph.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/controllers/QueryGraphHandler/knowledge_graph.js b/src/controllers/QueryGraphHandler/knowledge_graph.js index 44d0bf48..0868e06a 100644 --- a/src/controllers/QueryGraphHandler/knowledge_graph.js +++ b/src/controllers/QueryGraphHandler/knowledge_graph.js @@ -27,7 +27,8 @@ module.exports = class KnowledgeGraph { attributes: [ { name: "equivalent_identifiers", - value: helper._getInputEquivalentIds(record) + value: helper._getInputEquivalentIds(record), + type: "biolink:id" } ] } @@ -42,7 +43,8 @@ module.exports = class KnowledgeGraph { attributes: [ { name: "equivalent_identifiers", - value: helper._getOutputEquivalentIds(record) + value: helper._getOutputEquivalentIds(record), + type: "biolink:id" } ] } From 898c59eb7f5340dcd42d45a4743289e4611bb345 Mon Sep 17 00:00:00 2001 From: jiwen xin Date: Mon, 1 Feb 2021 10:20:54 -0800 Subject: [PATCH 2/2] test: :white_check_mark: add test to check whether type is part of the node attributes https://github.com/biothings/BioThings_Explorer_TRAPI/issues/23 --- __test__/integration/KnowledgeGraph.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/__test__/integration/KnowledgeGraph.test.js b/__test__/integration/KnowledgeGraph.test.js index e2c696da..9e6a83c0 100644 --- a/__test__/integration/KnowledgeGraph.test.js +++ b/__test__/integration/KnowledgeGraph.test.js @@ -29,6 +29,7 @@ describe("Testing KnowledgeGraph Module", () => { expect(res).toHaveProperty("NCBIGene:1017"); expect(res["NCBIGene:1017"]).toHaveProperty("name", "CDK2"); expect(res["NCBIGene:1017"]).toHaveProperty("category", "biolink:Gene"); + expect(res["NCBIGene:1017"].attributes[0]).toHaveProperty("type", "biolink:id"); }) })