ekglib

sparql

Simple helpers for talking to SPARQL endpoints and working with query results.

This package underpins SPARQL-based integrations used by other parts of ekglib.

Main Classes

Main Functions

Query Execution

Response Processing

Utility Functions

The CLI parameters include:

Usage

from ekglib.sparql import SPARQLEndpoint

# Create endpoint
endpoint = SPARQLEndpoint(
    endpoint_url="https://sparql.example.com/query",
    user_id="user",
    password="pass"
)

# Execute CONSTRUCT query
query = """
    PREFIX ex: <http://example.org/>
    CONSTRUCT { ?s ?p ?o }
    WHERE { ?s ?p ?o }
"""
response = endpoint.execute_construct(query)
if response:
    graph = response.convert()  # Convert to rdflib.Graph