diff --git a/src/index.ts b/src/index.ts index 00b9c36f..4adb8fed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -211,7 +211,7 @@ export default class TRAPIQueryHandler { suffix += 1; } const supportGraphID = `support${suffix}-${boundEdgeID}`; - auxGraphs[supportGraphID] = { edges: supportGraph }; + auxGraphs[supportGraphID] = { edges: supportGraph, attributes: [] }; if (!edgesIDsByAuxGraphID[supportGraphID]) { edgesIDsByAuxGraphID[supportGraphID] = new Set(); } @@ -254,7 +254,7 @@ export default class TRAPIQueryHandler { boundIDs.add(binding.id); } } else if (!boundIDs.has(nodesToRebind[binding.id].newNode)) { - newBindings.push({ id: nodesToRebind[binding.id].newNode }); + newBindings.push({ id: nodesToRebind[binding.id].newNode, attributes: [] }); boundIDs.add(nodesToRebind[binding.id].newNode); } return { boundIDs, newBindings }; @@ -276,7 +276,7 @@ export default class TRAPIQueryHandler { boundIDs.add(binding.id); } } else if (!boundIDs.has(edgesToRebind[binding.id])) { - newBindings.push({ id: edgesToRebind[binding.id] }); + newBindings.push({ id: edgesToRebind[binding.id], attributes: [] }); boundIDs.add(edgesToRebind[binding.id]); resultBoundEdgesWithAuxGraphs.add(edgesToRebind[binding.id]); } diff --git a/src/inferred_mode/inferred_mode.ts b/src/inferred_mode/inferred_mode.ts index 8a601747..32983259 100644 --- a/src/inferred_mode/inferred_mode.ts +++ b/src/inferred_mode/inferred_mode.ts @@ -288,8 +288,8 @@ export default class InferredQueryHandler { newResponse.message.results.forEach((result) => { const translatedResult: TrapiResult = { node_bindings: { - [qEdge.subject]: [{ id: result.node_bindings.creativeQuerySubject[0].id }], - [qEdge.object]: [{ id: result.node_bindings.creativeQueryObject[0].id }], + [qEdge.subject]: [{ id: result.node_bindings.creativeQuerySubject[0].id, attributes: [] }], + [qEdge.object]: [{ id: result.node_bindings.creativeQueryObject[0].id, attributes: [] }], }, pfocr: result.pfocr?.length ? result.pfocr : undefined, analyses: [ @@ -311,14 +311,14 @@ export default class InferredQueryHandler { // Direct edge answers stand on their own, not as an inferred edge. if (Object.keys(result.node_bindings).length == 2) { const boundEdgeID = Object.values(result.analyses[0].edge_bindings)[0][0].id; - translatedResult.analyses[0].edge_bindings = { [qEdgeID]: [{ id: boundEdgeID }] }; + translatedResult.analyses[0].edge_bindings = { [qEdgeID]: [{ id: boundEdgeID, attributes: [] }] }; } else { // Create an aux graph using the result and associate it with an inferred Edge const inferredEdgeID = `inferred-${resultCreativeSubjectID}-${qEdge.predicates[0].replace( 'biolink:', '', )}-${resultCreativeObjectID}`; - translatedResult.analyses[0].edge_bindings = { [qEdgeID]: [{ id: inferredEdgeID }] }; + translatedResult.analyses[0].edge_bindings = { [qEdgeID]: [{ id: inferredEdgeID, attributes: [] }] }; if (!combinedResponse.message.knowledge_graph.edges[inferredEdgeID]) { combinedResponse.message.knowledge_graph.edges[inferredEdgeID] = { subject: resultCreativeSubjectID, @@ -357,6 +357,7 @@ export default class InferredQueryHandler { }, [] as string[], ), + attributes: [] }; } diff --git a/src/results_assembly/query_results.ts b/src/results_assembly/query_results.ts index 026556fc..d3c104d3 100644 --- a/src/results_assembly/query_results.ts +++ b/src/results_assembly/query_results.ts @@ -452,18 +452,21 @@ export default class TrapiResultsAssembler { result.node_bindings[inputQNodeID] = Array.from(inputPrimaryCuries).map((inputPrimaryCurie) => { return { id: inputPrimaryCurie, + attributes: [], }; }); result.node_bindings[outputQNodeID] = Array.from(outputPrimaryCuries).map((outputPrimaryCurie) => { return { id: outputPrimaryCurie, + attributes: [], }; }); result.analyses[0].edge_bindings[qEdgeID] = Array.from(recordHashes).map((recordHash) => { return { id: recordHash, + attributes: [], }; }); },