SparqlModel documentation

The SQLModel of SPARQL — version 0.13.1

SparqlModel is a session-first ORM for RDF triple stores: Pydantic v2 SPARQLModel classes, SPARQLSession as the unit of work, and Python filters that compile to SPARQL. Run on in-memory graphs or remote SPARQL 1.1 endpoints.

Mapping (literals, terms, file I/O) is provided by the required dependency TripleModel — also Pydantic-based.

Start here

Installation

Python versions, extras (http, fastapi), dev setup

Getting started

First models, session, and query in minutes

Real-world examples

Nobel, DCAT, Wikidata, Schema.org — runnable examples/realworld/

Guides

Pydantic models, sessions, query DSL, FastAPI

By role

You are…

Start with

Application developer

Getting startedReal-world examplesGuidesSparqlModel ORM guide

API / platform engineer

FastAPI integrationSparqlModel production guide

Contributor / reviewer

SparqlModel Technical SpecificationSparqlModel (ORM) + TripleModel (mapping engine)API reference

Operator

SparqlModel production guideTroubleshooting

Feature overview

Area

Capabilities (0.13.1)

Pydantic

BaseModel subclasses; validation on construct, put, and get; Field constraints; JSON Schema for APIs

Models

SPARQLModel, Field, Relationship, IRI, rdf_type, RDF predicates

Session

Sync SPARQLSession and async AsyncSPARQLSession; identity map, flush queue

Queries

==, !=, &, |, ordering, in_, multi-hop paths, limit (sync and async)

Stores

MemoryStore / AsyncMemoryStore; HttpStore / AsyncHttpStore ([http]; mirror documented)

FastAPI

SessionDep, AsyncSessionDep, lifespan helpers, Turtle / JSON-LD responses

Tip

Production checklist and 0.3–1.0 milestones: SparqlModel Technical Specification and SparqlModel Roadmap.