A templating engine for SPARQL queries with typed, injection-safe placeholders and loops
Project description
Triplate (Python)
A templating engine for RDF query & data languages (SPARQL, Turtle, …) with a
typed --- frontmatter header, injection-safe values, loops and conditionals.
Python reference implementation of the Triplate language.
from triplate import compile
template = """\
---
params {
classes: iri[] min 1
limit: int optional
}
---
SELECT ?s WHERE {
{% for c in classes join "UNION" %}
{ ?s a ${c} }
{% endfor %}
}
{% if limit %}LIMIT ${limit}{% endif %}
"""
tmpl = compile(template)
sparql = tmpl.render(classes=["http://example.org/Person"], limit=10)
Every input is declared in the mandatory --- frontmatter header with its RDF
type; the context is validated and each value escaped accordingly, so rendered
output is injection-safe and an unprocessed template fails fast.
See triplate.dev for the full guide and specification.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file triplate-0.5.2.tar.gz.
File metadata
- Download URL: triplate-0.5.2.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5f74ce6d79952332eb43b02efdb5d6204aba35dee73a57e2e21f010b424382d
|
|
| MD5 |
396a27f58c559e3c624c8cffa0af3201
|
|
| BLAKE2b-256 |
58ed1e49ad9b29af705e0e37a53db897fac238e61ec6924a95707e176effb954
|
Provenance
The following attestation bundles were made for triplate-0.5.2.tar.gz:
Publisher:
release-please.yml on triplate/triplate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
triplate-0.5.2.tar.gz -
Subject digest:
f5f74ce6d79952332eb43b02efdb5d6204aba35dee73a57e2e21f010b424382d - Sigstore transparency entry: 1840017286
- Sigstore integration time:
-
Permalink:
triplate/triplate@1208d01ec8c36dc07dbdc6ad2a4354828ef4a4f2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/triplate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yml@1208d01ec8c36dc07dbdc6ad2a4354828ef4a4f2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file triplate-0.5.2-py3-none-any.whl.
File metadata
- Download URL: triplate-0.5.2-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8b8c4ff901111b2d63b87e1b0870db4e22dbfcf14a48e5ad1239863fd98bbc5
|
|
| MD5 |
d9f3d58dc5c72062ddef10aa0b61e71a
|
|
| BLAKE2b-256 |
8ce3d7fee680ecd35954637ba6136f27d62c48718d1ddf51ed21147b29eba802
|
Provenance
The following attestation bundles were made for triplate-0.5.2-py3-none-any.whl:
Publisher:
release-please.yml on triplate/triplate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
triplate-0.5.2-py3-none-any.whl -
Subject digest:
c8b8c4ff901111b2d63b87e1b0870db4e22dbfcf14a48e5ad1239863fd98bbc5 - Sigstore transparency entry: 1840017447
- Sigstore integration time:
-
Permalink:
triplate/triplate@1208d01ec8c36dc07dbdc6ad2a4354828ef4a4f2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/triplate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yml@1208d01ec8c36dc07dbdc6ad2a4354828ef4a4f2 -
Trigger Event:
push
-
Statement type: