| Crates.io | rdftk_core |
| lib.rs | rdftk_core |
| version | 0.5.6 |
| created_at | 2020-07-28 17:38:11.046846+00 |
| updated_at | 2024-11-25 18:50:48.503518+00 |
| description | This crate provides the core RDF data model; concrete implementations for Statements and Literals, along with a Resource type that provides a builder-like experience for models. |
| homepage | |
| repository | https://github.com/johnstonskj/rust-rdftk.git |
| max_upload_size | |
| id | 270557 |
| size | 199,298 |
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
}
Feature: this release adds the variant Collection to ObjectNode as well as a
corresponding Collection type. This models the RDF 1.1 collection concept as per
RDF 1.1 Semantics D.3 RDF collections. Currently collections are not supported
for subject nodes.
reify method to convert to a set of collection triples.FEATURE_STMT_OBJECT_COLLECTIONS that is now
supported by both ObjectNode and Statement.xsd:hexBinary string.Display for Literal.hex_encode for binary literals.From implementations for statement nodes.This is a radical refactor as the complexity of traits was adding more cost than value.
simple module into
model.From and PartialEq implementations for the supported literal value
types.Ref wrapper types.SubjectNode and ObjectNode into concrete enums.Equiv trait and rely on PartialEq instead.Implementation trait and simple::Implementation to hold
the set of factories.Error type and removed error_chain dependency.From<&BlankNode> for both Name and String.Name instead of stringsNamedGraph trait.DataSet to use NamedGraph instead of separate name/graph
pairs.rdftk_iri.rdftk_names.rdftk_iri package which uses the url::Url and is more
efficient.rdftk_names package.LanguageTag with that from the package
language_tags.ObjectNode inherit from SubjectNode.SimpleSubjectNode to be a tuple type, and implement From<> for
all Subject variants.README.md.Statement, and statement components are now passed as
Rc references.
Graph and DataSet now use type parameters to describe
iterators returned by query methods.QName constructors now return errors instead of panic on
invalid values.chrono::Duration in literals as well as the std version as
chrono supports the correct output form.eq_ methods on SubjectNode and ObjectNode for simple testing of inner
values.StatementRef and StatementList rather than having Rc
obviously in all APIs.ContextNode) to Statement.Statement.Statement.rdf_type to instance_of for compatibility with RDF
schema usage.is_valid associated function to QName.pub use *.Graph into Graph and MutableGraph.NamedGraph into NamedGraph and MutableNamedGraph.get_default_namespace to the PrefixMappings trait as a helper function.PrefixMappings::compress and PrefixMappings::expand to take
references.IRI to IRIRef on interfaces.Graph and associated types into core and deprecated rdftk_graph.From to allow direct construction of a SubjectNode from an IRI.QName that dropped the ":" for non-prefixed values.