LeanRDF

Packages and installation

LeanRDF is split into packages so that you build only what you use. A Lake require brings in a package's whole dependency tree, so the core has no dependencies at all, and the Elpi engine is required only by the package that searches.

PackageDirectoryRequiresContents
leanrdf.nothingRDF terms, triples, graphs and datasets; N-Triples, N-Quads, Turtle and TriG; XSD values; the RDF 1.2 model theory; the 80 RDFS rules with soundness proofs; triple terms and reification; RDFC-1.0 canonicalization and graph digests; certificates, their envelopes and the verified checker; SHA-256 and a regex engine
leanrdf-sparqlsparql/leanrdfthe SPARQL 1.1 algebra, its semantics, an evaluator proven to compute it, the parser, result formats and leanrdf-sparql
leanrdf-owlowl/leanrdfthe OWL 2 RDF-Based conditions the rules need, 60 OWL 2 RL rules and 10 EL rules with soundness proofs
leanrdf-shaclshacl/leanrdfthe SHACL Core semantics, a validator proven to compute it, the shapes reader, the report and leanrdf-shacl
leanrdf-statementsstatements/leanrdftiramemsu's bitemporal statement records, their exact RDF 1.2 export and decoder, the Statement Graph criterion, the export kernel, history closure, the quoting view and leanrdf-sg
leanrdf-checkcheck/leanrdf, leanrdf-owlthe regimes simple, rdf, rdfs, owl and el under checkRegime_sound, the verdict vocabulary, envelope verification and leanrdf-check; no search
leanrdf-elpielpi/leanrdf, leanrdf-owl, lean-elpi v0.3.3Elpi saturation from the proven rules, certificates from closures, leanrdf-demo, leanrdf-oxilite and leanrdf-classify

All packages use Lean 4.35.0, are version 0.4.0 and are licensed MIT OR Apache-2.0.

Depending on LeanRDF

Add a require to your lakefile.lean. For the core, the repository root is the package:

require leanrdf from git "https://github.com/Volland/rdf-lean" @ "main"

For any other package, name its directory after the revision. Its own require leanrdf from ".." resolves inside the same checkout:

require «leanrdf-sparql» from git "https://github.com/Volland/rdf-lean" @ "main" / "sparql"
require «leanrdf-owl» from git "https://github.com/Volland/rdf-lean" @ "main" / "owl"
require «leanrdf-shacl» from git "https://github.com/Volland/rdf-lean" @ "main" / "shacl"
require «leanrdf-statements» from git "https://github.com/Volland/rdf-lean" @ "main" / "statements"
require «leanrdf-elpi» from git "https://github.com/Volland/rdf-lean" @ "main" / "elpi"

Use the same lean-toolchain as LeanRDF (leanprover/lean4:v4.35.0), then run lake update and lake build. Pin a commit hash instead of main for reproducible builds. The tag v0.1.0 marks the first release, which had the core and Elpi packages only; v0.2.0 moved every package to RDF 1.2, v0.3.0 added leanrdf-statements, v0.3.1 aligned it with tiramemsu, and v0.4.0 added leanrdf-check and certificate envelopes.

Imports

Each package has one umbrella module that imports everything:

PackageImportNamespace
leanrdfimport LeanRDFLeanRDF, with LeanRDF.RDFS, LeanRDF.Cert, LeanRDF.NTriples, LeanRDF.Turtle, LeanRDF.Xsd, LeanRDF.Vocab
leanrdf-sparqlimport LeanRDFSparqlLeanRDF.Sparql
leanrdf-owlimport LeanRDFOwlLeanRDF.Owl
leanrdf-shaclimport LeanRDFShaclLeanRDF.Shacl
leanrdf-statementsimport LeanRDFStatementsLeanRDF.Statements, with the vendored StatementExport
leanrdf-elpiimport LeanRDFElpiLeanRDF.Bridge, LeanRDF.Oxilite, LeanRDF.Classify

Smaller imports work too, for example import LeanRDF.Parse.Turtle.Parser alone. The module list is on the Reference page.

Executables

CommandPackagePurpose
leanrdf-demoleanrdf-elpiRDFS entailment of a query graph, with a checked certificate
leanrdf-oxiliteleanrdf-elpicertify oxilite's answers or its materialized OWL closure
leanrdf-classifyleanrdf-elpicertified class hierarchy of an OWL 2 EL ontology
leanrdf-sparqlleanrdf-sparqlrun a SPARQL 1.1 query with the proven evaluator
leanrdf-shaclleanrdf-shaclvalidate data against SHACL Core shapes
leanrdf-sgleanrdf-statementscheck, export, decode, peel and quote statement records

Run them with lake exe NAME ARGS in their package directory, or from .lake/build/bin/NAME after lake build. See Command-line tools.