Skip to content

Commit

Permalink
Merge branch 'batch-limit' of https://github.com/biothings/bte_trapi_…
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Dec 12, 2023
2 parents cfeb7a7 + 077dfa0 commit fcd12ce
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/query_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ export default class QueryGraph {
}
}

_validateBatchSize(queryGraph: TrapiQueryGraph): void {
Object.entries(queryGraph.nodes).forEach(([nodeID, node]) => {
if (node.ids.length > 150) {
throw new InvalidQueryGraphError(`Query node ${nodeID} exceeds batch size limit.`);
}
});
}

_validateDuplicateEdges(queryGraph: TrapiQueryGraph): void {
const edgeSet = new Set();
for (const edgeID in queryGraph.edges) {
Expand Down Expand Up @@ -182,6 +190,7 @@ export default class QueryGraph {
this._validateDuplicateEdges(queryGraph);
this._validateNodeProperties(queryGraph);
this._validateEdgeProperties(queryGraph);
this._validateBatchSize(queryGraph);
this._validateCycles(queryGraph);
this._validateNoDuplicateQualifierTypes(queryGraph);
}
Expand Down

0 comments on commit fcd12ce

Please sign in to comment.