Open Source RDF Stack · Open Source · Open Source
Kastor
Domain-first RDF 1.2, SHACL 1.2, and SPARQL 1.2 for modern Kotlin.
An open-source, provider-agnostic Kotlin framework for RDF and semantic web development—bridging pure Kotlin domain interfaces with Apache Jena, Eclipse RDF4J, in-memory stores, and SPARQL endpoints.
Key Highlights
- Domain-first, RDF second: pure Kotlin domain interfaces with zero RDF library dependencies and side-channel RDF access
- Natural-language Kotlin DSL (person has FOAF.name with "Alice") and compile-time type-safe SPARQL builders
- Full RDF 1.2, SPARQL 1.2, and SHACL 1.2 support plus optional RDF-H 0.8 holon scopes
- Works seamlessly atop existing Apache Jena (TDB2) and Eclipse RDF4J (NativeStore) infrastructure
Kotlin RDF 1.2 SHACL 1.2 SPARQL 1.2 Apache Jena RDF4J
Overview
Kastor is a modern, comprehensive open-source Kotlin framework for RDF and semantic web development. Named in tribute to the pioneering Java XML data-binding framework Castor, Kastor brings idiomatic Kotlin ergonomics—extension functions, sealed classes, null safety, and coroutines—to knowledge graph engineering.
Works With Your Existing RDF Infrastructure
Kastor is a compatibility layer, not a lock-in replacement:
- Keep existing Apache Jena (
TDB2) or Eclipse RDF4J (NativeStore) repositories with zero migration required. - Adopt gradually in new Kotlin code while preserving direct access to underlying Jena/RDF4J APIs whenever needed.
- Trim classpaths with
kastor-bomand modular store/reasoning artifacts (rdf-core,rdf-jena,rdf-rdf4j,rdf-reasoning).
val graph = jenaModel.toKastorGraph()
graph.add {
val person = iri("http://example.org/alice")
person has FOAF.name with "Alice"
person has FOAF.age with 30
}
Standards Supported
- Data & Query: RDF 1.2 (triple terms,
rdf:reifies,rdf:dirLangString), RDF 1.1, SPARQL 1.1 & 1.2. - Validation & Reasoning: Native SHACL 1.2 (Core, SHACL-SPARQL, Node Expressions), RDFS, and OWL (EL / RL / DL via providers).
- Formats: Turtle 1.2, TriG 1.2, N-Triples 1.2, N-Quads 1.2, plus
rdf-holon(RDF-H 0.8) holon scopes.