Skip to content

Commit 49beaa3

Browse files
committed
pass the format if required
1 parent 236fca8 commit 49beaa3

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

sparql_file/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44
DEFAULT_EXAMPLE_QUERY = "select * { ?s ?p ?o } limit 10"
55

66

7-
def sparql_file(graph_file: str, example_query: str = DEFAULT_EXAMPLE_QUERY):
7+
def sparql_file(
8+
graph_file: str,
9+
example_query: str = DEFAULT_EXAMPLE_QUERY,
10+
graph_format: str | None = None,
11+
):
812
g = Graph()
913

1014
with open(graph_file, "r") as graph_file_io:
11-
g.parse(source=graph_file_io)
15+
g.parse(source=graph_file_io, format=None)
1216

1317
# Return the SPARQL endpoint based on the RDFLib Graph
1418
return SparqlEndpoint(

sparql_file/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ def cli(
1212
host: str = "0.0.0.0",
1313
port: str = "8000",
1414
example_query: str = DEFAULT_EXAMPLE_QUERY,
15+
graph_format: str | None = None,
1516
):
16-
"""Start the sparql file server"""
17+
"""Start a SPARQL 1.1 endpoint based on the given RDF file."""
1718
endpoint = sparql_file(graph_file, example_query)
1819
uvicorn.run(endpoint, host=host, port=port)
1920

0 commit comments

Comments
 (0)