From ea8c4ef87976b1f6e8fdf6510ba1f23d65e7a1fa Mon Sep 17 00:00:00 2001 From: Vincent Emonet Date: Sat, 18 Mar 2023 12:04:17 +0100 Subject: [PATCH] add SPARQL processor option --- src/rdflib_endpoint/sparql_endpoint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rdflib_endpoint/sparql_endpoint.py b/src/rdflib_endpoint/sparql_endpoint.py index 92a416c..9dd3341 100644 --- a/src/rdflib_endpoint/sparql_endpoint.py +++ b/src/rdflib_endpoint/sparql_endpoint.py @@ -33,6 +33,7 @@ def __init__( custom_eval: Optional[Callable[..., Any]] = None, enable_update: bool = False, cors_enabled: bool = True, + processor: Any = None, path: str = "/", public_url: str = "https://sparql.openpredict.semanticscience.org/sparql", example_query: str = """PREFIX myfunctions: @@ -213,7 +214,7 @@ async def sparql_endpoint(request: Request, query: Optional[str] = Query(None)) try: # query_results = self.graph.query(query, initNs=graph_ns) - query_results = self.graph.query(query) + query_results = self.graph.query(query, processor=processor) if processor else self.graph.query(query) except Exception as e: logging.error("Error executing the SPARQL query on the RDFLib Graph: " + str(e)) return JSONResponse(