diff --git a/src/controllers/QueryGraphHandler/knowledge_graph.js b/src/controllers/QueryGraphHandler/knowledge_graph.js index ff3f0f70..8023197e 100644 --- a/src/controllers/QueryGraphHandler/knowledge_graph.js +++ b/src/controllers/QueryGraphHandler/knowledge_graph.js @@ -80,7 +80,7 @@ module.exports = class KnowledgeGraph { _createEdge(record) { return { [helper._createUniqueEdgeID(record)]: { - predicate: "biolink:" + record["$reasoner_edge"].getQueryPredicate(), + predicate: "biolink:" + ((typeof record["$reasoner_edge"].getQueryPredicate() === "undefined") ? record["$association"].predicate : record["$reasoner_edge"].getQueryPredicate()), subject: helper._getInputID(record), object: helper._getOutputID(record), attributes: this._createAttributes(record) diff --git a/src/controllers/QueryGraphHandler/reverse.js b/src/controllers/QueryGraphHandler/reverse.js index 9abb2ef9..6cbbaef8 100644 --- a/src/controllers/QueryGraphHandler/reverse.js +++ b/src/controllers/QueryGraphHandler/reverse.js @@ -8,12 +8,15 @@ module.exports = class EdgeReverse { } reverse(predicate) { - let modifiedPredicate = predicate.replace('_', ' '); - if (modifiedPredicate in this.data.slots) { - if ('inverse' in this.data.slots[modifiedPredicate]) { - return this.data.slots[modifiedPredicate].inverse.replace(' ', '_'); + if (typeof predicate === "string") { + let modifiedPredicate = predicate.replace('_', ' '); + if (modifiedPredicate in this.data.slots) { + if ('inverse' in this.data.slots[modifiedPredicate]) { + return this.data.slots[modifiedPredicate].inverse.replace(' ', '_'); + } } } + return undefined; } } \ No newline at end of file