mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-01 17:39:39 +02:00
SPARQL service supports batching/streaming (#755)
This commit is contained in:
parent
d9dc4cbab5
commit
ee65d90fdd
5 changed files with 169 additions and 95 deletions
|
|
@ -16,6 +16,8 @@ class SparqlQueryRequestTranslator(MessageTranslator):
|
|||
collection=data.get("collection", "default"),
|
||||
query=data.get("query", ""),
|
||||
limit=int(data.get("limit", 10000)),
|
||||
streaming=data.get("streaming", False),
|
||||
batch_size=int(data.get("batch-size", 20)),
|
||||
)
|
||||
|
||||
def encode(self, obj: SparqlQueryRequest) -> Dict[str, Any]:
|
||||
|
|
@ -24,6 +26,8 @@ class SparqlQueryRequestTranslator(MessageTranslator):
|
|||
"collection": obj.collection,
|
||||
"query": obj.query,
|
||||
"limit": obj.limit,
|
||||
"streaming": obj.streaming,
|
||||
"batch-size": obj.batch_size,
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -108,4 +112,4 @@ class SparqlQueryResponseTranslator(MessageTranslator):
|
|||
def encode_with_completion(
|
||||
self, obj: SparqlQueryResponse
|
||||
) -> Tuple[Dict[str, Any], bool]:
|
||||
return self.encode(obj), True
|
||||
return self.encode(obj), obj.is_final
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue