oxirs_core/assembler/mod.rs
1//! Jena Assembler vocabulary support.
2//!
3//! This module allows users migrating from Apache Jena to use their existing
4//! `fuseki-config.ttl` assembler files with OxiRS. A Jena assembler document
5//! uses the `ja:` namespace (`http://jena.hpl.hp.com/2005/11/Assembler#`) to
6//! describe datasets, named graphs, and storage backends in RDF/Turtle format.
7//!
8//! # Quick start
9//!
10//! ```rust
11//! use oxirs_core::assembler;
12//!
13//! let ttl = r#"
14//! @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
15//! <http://example.org/ds> a ja:RDFDataset .
16//! "#;
17//! let config = assembler::from_turtle(ttl).unwrap();
18//! assert_eq!(config.len(), 1);
19//! ```
20//!
21//! # Supported vocabulary
22//!
23//! | Term | Description |
24//! |------|-------------|
25//! | `ja:RDFDataset` | Generic RDF dataset |
26//! | `ja:MemoryDataset` | In-memory dataset |
27//! | `ja:MemoryModel` | In-memory RDF model |
28//! | `tdb2:DatasetTDB2` | TDB2 disk-backed dataset |
29//! | `ja:namedGraph` | Named-graph description |
30//! | `ja:graphName` | IRI of a named graph |
31//! | `ja:graph` | Model resource for a named graph |
32//! | `ja:defaultGraph` | Default-graph model resource |
33//! | `ja:contentURL` | URL to load initial RDF content |
34//! | `tdb2:location` | Filesystem path for TDB2 storage |
35
36pub mod builder;
37pub mod config;
38pub mod vocab;
39
40pub use builder::{AssemblerBuilder, AssemblerError};
41pub use config::{AssemblerConfig, DatasetConfig, GraphConfig, StoreBackend};
42
43/// Parse a Turtle-format Jena Assembler document into an [`AssemblerConfig`].
44///
45/// This is a convenience wrapper around [`AssemblerBuilder::from_turtle`].
46///
47/// # Example
48///
49/// ```rust
50/// let ttl = r#"
51/// @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
52/// <http://example.org/ds> a ja:RDFDataset .
53/// "#;
54/// let config = oxirs_core::assembler::from_turtle(ttl).unwrap();
55/// assert_eq!(config.len(), 1);
56/// ```
57pub fn from_turtle(ttl: &str) -> Result<AssemblerConfig, AssemblerError> {
58 AssemblerBuilder::from_turtle(ttl)
59}