SparqlModel ecosystem guide (for SparqlModel development)
Copy this file into the SparqlModel repo (e.g. docs/ECOSYSTEM.md). TripleModel-side summary: ECOSYSTEM.md. Strategy: PLAN.md.
Stack
sparqlmodel → triplemodel → pyoxigraph · pydantic
Architecture (Option A): SPARQLModel subclasses TripleModel. One class, one mapping path. Session I/O calls sync_to_graph / from_graph on the same instances.
Rules: SparqlModel may depend on triplemodel (PyPI); triplemodel must never import sparqlmodel. Do not reimplement mapping in graph.py. Do not use dynamic shadow TripleModel classes (exec) after 0.4.
Division of labour
SparqlModel owns |
TripleModel owns |
|---|---|
|
|
Query DSL + compiler |
Terms, literals, subject IRIs |
|
|
Hydration |
Namespaces, Dataset |
FastAPI, HTTP SPARQL |
pyoxigraph matrix (ROADMAP) |
Dependency
Current (shipped):
dependencies = ["triplemodel>=0.9,<2"]
After TripleModel 0.10 (SM-7):
dependencies = ["triplemodel>=0.10,<2"]
Use triplemodel.Store (not rdflib.Graph) for session graph I/O. Tighten to ~=1.0 when TripleModel 1.0 ships.
Stable TripleModel entry points (integrator tier)
Use these from SparqlModel instead of reimplementing mapping:
API |
Role |
|---|---|
|
Core model base |
|
Owned-triple sync (SparqlModel |
|
Load paths |
|
Batch I/O |
|
Field metadata |
|
Explicit IRI |
|
Namespace binding |
|
File and string I/O |
|
Shared policy hooks |
See API_STABILITY.md for semver rules.
Module plan (SparqlModel)
Module |
Action |
|---|---|
|
Remove in 0.4 (interim 0.3 adapter) |
|
|
|
Thin sugar → |
|
Keep cascade/orphan policy only |
|
Wrap TripleModel (0.6) |
|
Keep |
Integration milestones (SparqlModel versions)
SparqlModel |
Theme |
TripleModel |
|---|---|---|
0.3 (shipped) |
Session I/O via interim |
|
0.4 (next) |
Option A — unified model; delete |
Direct calls on |
0.5 |
Async end-to-end |
— |
0.6 |
Delegated file I/O |
|
1.2 |
Production GA |
Stable mapping substrate |
TripleModel SM-6 tracks SparqlModel 0.4 — see ROADMAP.md.
SparqlModel 0.4 exit criteria (Option A)
class SPARQLModel(TripleModel)with merged metaclassField/Relationshipbuild TripleModel metadata (noexec)session.put/getusesync_to_graph/from_graphon app instancesDelete
_triple.py; contract tests updatedPublic API unchanged:
Field,Relationship,session.put
Where to fix bugs
Issue |
Repo |
|---|---|
Wrong |
TripleModel |
Stale triple after |
TripleModel sync + SparqlModel policy |
|
SparqlModel |
Orphan embedded IRI |
SparqlModel |
Metaclass / subclass validation order |
SparqlModel + TripleModel coordination |
Full tables: ECOSYSTEM.md.
PR boundary (quick)
Change |
Open in |
|---|---|
Predicate metadata, literals, subject URI |
TripleModel |
|
SparqlModel |
|
SparqlModel |
|
SparqlModel (0.4) |
Turtle round-trip in unit tests |
TripleModel (or SparqlModel integration test calling TripleModel) |
Cross-package contract tests: SparqlModel put triple set equals TripleModel sync_to_graph + SparqlModel-owned cascade rules.