This crate provides an implementation of the RDF abstract syntax along with
a Resource
type that provides a builder-like experience for models.
From RDF 1.1 Concepts and Abstract Syntax;
The core structure of the abstract syntax is a set of triples, each consisting of a subject, a predicate and an object. A set of such triples is called an RDF graph. An RDF graph can be visualized as a node and directed-arc diagram, in which each triple is represented as a node-arc-node link.
There can be three kinds of nodes in an RDF graph: IRIs, literals, and blank nodes.
In this library the triple, or statement, as well as subject, predicate, and
object types are in the module statement
. Literal's as objects are supported in
the literal
module. Traits that describe graphs are provided by the graph
module.
Additional features are provided such as support for data sets (module
model.data_set
) as well as support for extensions to the core RDF abstract model
such as RDF-star.
use rdftk_core::{Literal, Statement, StatementList, SubjectNode};
use rdftk_iri::IRI;
use std::rc::Rc;
use std::str::FromStr;
pub fn make_statements() -> StatementList {
let mut statements: StatementList = Default::default();
statements.push(Statement::new(
SubjectNode::named(
IRI::from_str("http://en.wikipedia.org/wiki/Tony_Benn").unwrap()
),
IRI::from_str("http://purl.org/dc/elements/1.1/title").unwrap(),
Literal::new("Tony Benn").into(),
).into());
// ...
statements
}
- Fix: remove spaces from
xsd:hexBinary
string.
- Feature: better implementation of
Display
forLiteral
.
- Feature: add SKOS to PrefixMapping commons.
- Fix: bug in
hex_encode
for binary literals.
- Feature: added more
From
implementations for statement nodes.
This is a radical refactor as the complexity of traits was adding more cost than value.
- Removed all traits and moved implementations from the
simple
module intomodel
. - Removed all factory interfaces to simplify the user experience.
- Added
From
andPartialEq
implementations for the supported literal value types.
- Refactor: Remove all
Ref
wrapper types. - Refactor: Make
SubjectNode
andObjectNode
into concrete enums. - Refactor: Remove
Equiv
trait and rely onPartialEq
instead. - Refactor: Create new
Implementation
trait andsimple::Implementation
to hold the set of factories.
- Refactor: re-wrote
Error
type and removederror_chain
dependency.
- Feature: added
From<&BlankNode>
for bothName
andString
.
- Feature: changed some methods to use
Name
instead of strings - Feature: added new
NamedGraph
trait. - Feature: updated
DataSet
to useNamedGraph
instead of separate name/graph pairs. - Build: updated dependency
rdftk_iri
. - Build: updated dependency
rdftk_names
.
- Build: cargo audit/outdated/udeps
- Feature: moved to new
rdftk_iri
package which uses theurl::Url
and is more efficient. - Feature: moved to new
rdftk_names
package. - Feature: replaced own implementation of
LanguageTag
with that from the packagelanguage_tags
. - Refactor: made the trait
ObjectNode
inherit fromSubjectNode
. - Refactor: move
SimpleSubjectNode
to be a tuple type, and implementFrom<>
for allSubject
variants. - Build: updated Rust edition from 2018 to 2021.
- Docs: added API docs as much as possible.
- Docs: run markuplint on
README.md
.
- The abstract RDF API, described in module 'model', is now entirely trait based.
- An implementation, in module 'simple', provides concrete in-memory types.
- Added a new type LanguageTag to model these values more completely.
- Added notion of features which denote capabilities supported by data sets, graphs, and statements implementations.
- Created new Featured trait implemented by a number of types that allow client query of various optional capabilities. This also subsumes the has_index/has_all_indices capability as all index queries are now feature queries.
- Copied some errors from rdftk_io.
- Renamed the Io variant to ReadWrite.
- Reworked APIs to take Ref types and to be consistent in use of trait objects and types throughout.
- Added factory type for data sets.
- Made PrefixMappings a concrete type in the core::graph::mapping module.
- Added InvalidMatch and Io variants to ErrorKind.
- Added mutators to Statement.
- Changed API, removed mutable traits for Graph and DataSet, moved methods into their base traits.
- Added factory types for graphs.
- Added Skolemization function for graphs.
- A change to the API, all
Statement
, and statement components are now passed asRc
references.- Added additional _ref constructors to allow cleaner client code.
- A change to the API,
Graph
andDataSet
now use type parameters to describe iterators returned by query methods. - A change to the API,
QName
constructors now return errors instead of panic on invalid values. - Added more constructors for literal values.
- Added support for
chrono::Duration
in literals as well as the std version as chrono supports the correct output form. - Added
eq_
methods onSubjectNode
andObjectNode
for simple testing of inner values. - Added documentation and examples throughout.
- Fixed Clippy suggestions.
- Removed Context from statements.
- Added value_factory method to Graph.
- Placed all unit tests in tests folder.
- Removed stand-alone named graph.
- Added DataSet as a way to associate names to graphs.
- Renamed CachingGraph to ValueFactory and made stand-alone.
- Bug: fixed Literal constructors to produce an escape-safe literal form for strings.
- Fixed: cargo fmt error.
- Added: public types
StatementRef
andStatementList
rather than havingRc
obviously in all APIs.
- DEPRECATED Support for Datasets and Quads by adding a context
(type
ContextNode
) toStatement
.
- Support for RDF* in
Statement
. - Added additional constructors to
Statement
. - Renamed Resource method
rdf_type
toinstance_of
for compatibility with RDF schema usage. - Added
is_valid
associated function toQName
.
- Explicit exports over
pub use *
.
- Split
Graph
intoGraph
andMutableGraph
. - Split
NamedGraph
intoNamedGraph
andMutableNamedGraph
. - Added
get_default_namespace
to thePrefixMappings
trait as a helper function. - Altered
PrefixMappings::compress
andPrefixMappings::expand
to take references.
- Explicit version management.
- Updates for rdftk_memgraph to build.
- Made all local dependencies only major/minor valued.
- Moved all
IRI
toIRIRef
on interfaces. - Moved
Graph
and associated types into core and deprecatedrdftk_graph
.
- Clean-up changes.
- Added
From
to allow direct construction of aSubjectNode
from anIRI
. - Fixed a bug in
QName
that dropped the ":" for non-prefixed values.
- First release.