Skip to content

Commit

Permalink
Add remote sparql endpoint example
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleysommer committed Dec 9, 2024
1 parent 9713f2b commit e5a5df0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/remote_sparql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pyshacl import validate
from rdflib import Dataset, Graph
from rdflib.plugins.stores.sparqlstore import SPARQLStore

# Remote sparql endpoint:
my_sparql_endpoint = "https://my.service.com/repo/data/sparql"
store = SPARQLStore(my_sparql_endpoint, auth=('username', 'password'))
data_dataset = Dataset(store, default_union=True)

# Shapes graph:
shapes_graph = Graph().parse("my_shapes.ttl", format="turtle")

# Validate:
result_tuple = validate(data_dataset, shacl_graph=shapes_graph, sparql_mode=True)
conforms, results_graph, results_text = result_tuple

0 comments on commit e5a5df0

Please sign in to comment.