diff --git a/CHANGELOG.md b/CHANGELOG.md index f51ee4e6..27451c39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,48 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.1.6](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v1.1.5...v1.1.6) (2021-03-25) + +### [1.1.5](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v1.1.4...v1.1.5) (2021-03-25) + + +### Bug Fixes + +* :bug: fix getCategories of undefined error ([8d19f74](https://github.com/kevinxin90/bte_trapi_query_graph_handler/commit/8d19f74f371d8a04dd78de18b95c7b40623e647c)) + +### [1.1.4](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v1.1.3...v1.1.4) (2021-03-24) + + +### Bug Fixes + +* :bug: fix wrong edge id in results section ([a31c7eb](https://github.com/kevinxin90/bte_trapi_query_graph_handler/commit/a31c7eb62005663940558d3be2d854f7debc8f67)) + +### [1.1.3](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v1.1.2...v1.1.3) (2021-03-24) + + +### Bug Fixes + +* :bug: fix missing biolink prefix ([0700e71](https://github.com/kevinxin90/bte_trapi_query_graph_handler/commit/0700e7149f1c9d3a25b7db67dd46d8c9e7d66f2c)) + +### [1.1.2](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v1.1.1...v1.1.2) (2021-03-24) + + +### Bug Fixes + +* :bug: fix publications not display ([560f3fd](https://github.com/kevinxin90/bte_trapi_query_graph_handler/commit/560f3fd5cd9759418de3b06b8b6a728c85984cb7)) +* :bug: fix tyypo ([e630909](https://github.com/kevinxin90/bte_trapi_query_graph_handler/commit/e6309090c6ec432b0af537d8b3471daa21512698)) + +### [1.0.1](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v0.8.0...v1.0.1) (2021-03-24) + +## [0.8.0](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v1.0.0...v0.8.0) (2021-03-23) + + +### Features + +* :sparkles: add chemicalsubstance node when user specify drug as output ([ffb81b3](https://github.com/kevinxin90/bte_trapi_query_graph_handler/commit/ffb81b3f9397bd325ca38f3242f5cd110c03b288)) + +## [1.0.0](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v0.7.0...v1.0.0) (2021-03-23) + ### [1.1.1](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v0.7.0...v1.1.1) (2021-03-24) diff --git a/__test__/integration/graph/graph.test.js b/__test__/integration/graph/graph.test.js index fc0ed3e2..62ab7f29 100644 --- a/__test__/integration/graph/graph.test.js +++ b/__test__/integration/graph/graph.test.js @@ -16,9 +16,9 @@ describe("Test graph class", () => { }, api_name: "API1", source: "source1", - publications: ["PMID:1", "PMID:2"], predicate: "predicate1" }, + publications: ["PMID:1", "PMID:2"], $output: { obj: [ { @@ -45,9 +45,9 @@ describe("Test graph class", () => { }, api_name: "API2", source: "source2", - publications: ["PMC:1", "PMC:2"], predicate: "predicate1" }, + publications: ["PMC:1", "PMC:2"], $output: { obj: [ { @@ -74,9 +74,9 @@ describe("Test graph class", () => { }, api_name: "API3", source: "source3", - publications: ["PMC:3", "PMC:4"], predicate: "predicate2" }, + publications: ["PMC:3", "PMC:4"], $output: { obj: [ { diff --git a/package-lock.json b/package-lock.json index 38a9de5d..7aa4db9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@biothings-explorer/query_graph_handler", - "version": "1.1.1", + "version": "1.1.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -449,13 +449,13 @@ } }, "@biothings-explorer/call-apis": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/@biothings-explorer/call-apis/-/call-apis-1.15.0.tgz", - "integrity": "sha512-r92rwKNKt4EuDV9cZAT6b15Z/3ZGvbZlV0cfwDxVBZEF/VMWwjntKJVzfY+oQUdAhz7YC5wT9d1rvMy7Dp2CXQ==", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@biothings-explorer/call-apis/-/call-apis-1.15.1.tgz", + "integrity": "sha512-iG0pefAwUd0miXywM+QExYCROZg6Y0vTi9uN51jY9v0L6fOt81JVbZsC6jr6yLc+rIp/umueg9nIlC1iXX0yUQ==", "requires": { "@biothings-explorer/api-response-transform": "^1.8.0", "axios": "^0.21.1", - "biomedical_id_resolver": "^3.4.1", + "biomedical_id_resolver": "^3.4.2", "debug": "^4.3.1", "husky": "^4.3.8" }, @@ -477,9 +477,9 @@ } }, "biomedical_id_resolver": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/biomedical_id_resolver/-/biomedical_id_resolver-3.4.1.tgz", - "integrity": "sha512-qijulyQyV+E2nDoAAB96g+jn6mWWficmQYFiPJxYcwhYi0HFkAaH1xkz7lZdeQYBK+HdzqJOX5EvGYxyl9oLog==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/biomedical_id_resolver/-/biomedical_id_resolver-3.4.2.tgz", + "integrity": "sha512-n121Pi8xss/e0vG8dysBkNZVc+718zH+oPt/VXd4TpE2ZvWEjlhZozNv9EIK80XIH6wLeDR3NvDFKZVqyGUpCA==", "requires": { "@commitlint/cli": "^11.0.0", "@commitlint/config-conventional": "^11.0.0", @@ -1527,9 +1527,9 @@ } }, "biomedical_id_resolver": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/biomedical_id_resolver/-/biomedical_id_resolver-3.4.1.tgz", - "integrity": "sha512-qijulyQyV+E2nDoAAB96g+jn6mWWficmQYFiPJxYcwhYi0HFkAaH1xkz7lZdeQYBK+HdzqJOX5EvGYxyl9oLog==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/biomedical_id_resolver/-/biomedical_id_resolver-3.4.2.tgz", + "integrity": "sha512-n121Pi8xss/e0vG8dysBkNZVc+718zH+oPt/VXd4TpE2ZvWEjlhZozNv9EIK80XIH6wLeDR3NvDFKZVqyGUpCA==", "requires": { "@commitlint/cli": "^11.0.0", "@commitlint/config-conventional": "^11.0.0", diff --git a/package.json b/package.json index c4f71e0c..97c110e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@biothings-explorer/query_graph_handler", - "version": "1.1.1", + "version": "1.1.6", "description": "A nodejs module to query TRAPI Query Graph", "main": "built/index.js", "scripts": { @@ -50,10 +50,10 @@ "typescript": "^4.2.3" }, "dependencies": { - "@biothings-explorer/call-apis": "^1.15.0", + "@biothings-explorer/call-apis": "^1.15.1", "@biothings-explorer/smartapi-kg": "^3.1.1", "biolink-model": "^0.3.0", - "biomedical_id_resolver": "^3.4.1", + "biomedical_id_resolver": "^3.4.2", "debug": "^4.3.1", "lodash": "^4.17.21", "ms": "^2.1.3", diff --git a/src/graph/knowledge_graph.js b/src/graph/knowledge_graph.js index d9ae7ec5..6d4cb9b7 100644 --- a/src/graph/knowledge_graph.js +++ b/src/graph/knowledge_graph.js @@ -22,7 +22,7 @@ module.exports = class KnowledgeGraph { _createNode(kgNode) { const res = { - category: kgNode._semanticType, + category: 'biolink:' + kgNode._semanticType, name: kgNode._label, attributes: [ { @@ -75,7 +75,7 @@ module.exports = class KnowledgeGraph { type: 'bts:api', }, { - name: 'publicatiions', + name: 'publications', value: Array.from(kgEdge.publications), type: 'biolink:publication', }, diff --git a/src/helper.js b/src/helper.js index dac50cd1..97e07601 100644 --- a/src/helper.js +++ b/src/helper.js @@ -45,7 +45,7 @@ module.exports = class QueryGraphHelper { } _getPublication(record) { - return record.$edge_metadata.publications || undefined; + return record.publications || undefined; } _getKGEdgeID(record) { diff --git a/src/query_execution_edge.js b/src/query_execution_edge.js index 9f82e107..03f33b1d 100644 --- a/src/query_execution_edge.js +++ b/src/query_execution_edge.js @@ -23,7 +23,7 @@ module.exports = class QExeEdge { getHashedEdgeRepresentation() { const toBeHashed = - this.subject.getCategories() + this.predicate + this.object.getCategories() + this.getInputCurie(); + this.getSubject().getCategories() + this.getPredicate() + this.getObject().getCategories() + this.getInputCurie(); return new helper()._generateHash(toBeHashed); } diff --git a/src/query_results.js b/src/query_results.js index c9245624..64dcbbdc 100644 --- a/src/query_results.js +++ b/src/query_results.js @@ -29,7 +29,7 @@ module.exports = class QueryResult { return { [record.$edge_metadata.trapi_qEdge_obj.getID()]: [ { - id: helper._createUniqueEdgeID(record), + id: helper._getKGEdgeID(record), }, ], };