Code Generation

Generate equivalent Python code snippets for rdfsolve API calls.

Each function returns a string of ready-to-run Python code that reproduces the same operation using the rdfsolve package directly. The snippets are included in every API response so users can learn how to script their workflows.

compose_snippet(paths: list[dict[str, Any]], prefixes: dict[str, str], options: dict[str, Any] | None = None) str[source]

Return Python code for compose_query_from_paths().

execute_sparql_snippet(query: str, endpoint: str, method: str = 'GET', timeout: int = 30) str[source]

Return Python code for execute_sparql().

resolve_iris_snippet(iris: list[str], endpoints: list[dict[str, Any]], timeout: int = 15) str[source]

Return Python code for resolve_iris().

export_query_snippet(query: str, query_type: str = 'select', prefixes: dict[str, str] | None = None, endpoint: str | None = None) str[source]

Return Python code to export a query as JSON-LD.