A lightweight Flask app that makes http://rdf.wikipathways.org/ IRIs resolvable by proxying requests as SPARQL DESCRIBE queries against the WikiPathways Virtuoso endpoint.
- HTTP content negotiation (HTML for browsers, RDF serializations for clients)
- Syntax-highlighted HTML view with clickable IRIs
- Multiple RDF formats: Turtle, JSON-LD, RDF/XML, N-Triples
- File extension overrides (
.ttl,.jsonld,.rdf,.nt) - In-memory response caching with configurable TTL
- HTTP caching (
ETag,If-None-Match→ 304,Cache-Control,Vary: Accept) - CORS headers (
Access-Control-Allow-Origin: *) - Prometheus metrics endpoint
- Rate limiting per IP
- Health check endpoint
pip install -r requirements.txt
python app.py
# Dev server running on http://localhost:3000docker build -t wpiri . && docker run -p 3000:3000 wpiridocker compose upOpen any IRI path to get a syntax-highlighted HTML view with clickable links:
Pathway/WP4846_r140186— a pathwayPathway/WP4846_r140186/WP/Interaction/a273b— an interactionPathway/WP4846_r140186/Complex/a4fdf— a protein complex
# Turtle via Accept header
curl -H "Accept: text/turtle" http://localhost:3000/Pathway/WP4846_r140186/WP/Interaction/a273b
# Turtle via file extension
curl http://localhost:3000/Pathway/WP4846_r140186/WP/Interaction/a273b.ttl
# JSON-LD
curl http://localhost:3000/Pathway/WP4846_r140186/Complex/a4fdf.jsonld
# RDF/XML
curl http://localhost:3000/Pathway/WP4846_r140186.rdf
# N-Triples
curl http://localhost:3000/Pathway/WP4846_r140186.nt| Format | Accept Header | File Extension |
|---|---|---|
| HTML (default) | text/html |
— |
| Turtle | text/turtle |
.ttl |
| JSON-LD | application/ld+json |
.jsonld |
| RDF/XML | application/rdf+xml |
.rdf |
| N-Triples | application/n-triples |
.nt |
| Variable | Default | Description |
|---|---|---|
SPARQL_ENDPOINT |
https://sparql.wikipathways.org/sparql |
Virtuoso SPARQL endpoint URL |
BASE_IRI |
http://rdf.wikipathways.org |
IRI prefix prepended to request path |
SPARQL_TIMEOUT |
30 |
SPARQL request timeout in seconds |
CACHE_TTL |
300 |
In-memory cache TTL in seconds |
CACHE_MAXSIZE |
1024 |
Maximum number of cached responses |
CACHE_CONTROL_MAX_AGE |
300 |
HTTP Cache-Control max-age in seconds |
RATE_LIMIT |
60/minute |
Rate limit per IP address |
| Endpoint | Description |
|---|---|
/ |
Landing page with documentation and examples |
/<path> |
Resolve an IRI and return RDF data |
/_health |
Health check (returns 200 OK) |
/metrics |
Prometheus metrics |
# Install dev dependencies
pip install -r requirements.txt
pip install pytest responses ruff
# Run tests
pytest -v
# Lint
ruff check .This service was built with the help of Claude Code.