Expand description
This library provides primitive traits to serialize and deserialize
Linked-Data types. It is shipped with derive macros (using the derive
feature) that can automatically implement those primitives for you.
§Example
use iref::IriBuf;
use static_iref::iri;
#[derive(linked_data::Serialize, linked_data::Deserialize)]
#[ld(prefix("ex" = "http://example.org/"))]
struct Foo {
#[ld(id)]
id: IriBuf,
#[ld("ex:name")]
name: String,
#[ld("ex:email")]
email: String
}
let value = Foo {
id: iri!("http://example.org/JohnSmith").to_owned(),
name: "John Smith".to_owned(),
email: "john.smith@example.org".to_owned()
};
let quads = linked_data::to_quads(rdf_types::generator::Blank::new(), &value)
.expect("RDF serialization failed");
for quad in quads {
use rdf_types::RdfDisplay;
println!("{} .", quad.rdf_display())
}
This should print the following:
<http://example.org/JohnSmith> <http://example.org/name> "John Smith" .
<http://example.org/JohnSmith> <http://example.org/email> "john.smith@example.org" .
Macros§
Structs§
- Anonymous
- Anonymous lexical representation.
- Anonymous
Binding - Anonymous
Graph - Ref
Enums§
- Context
- Context
Iris - CowRdf
Literal - CowRdf
Term - CowRef
- From
Linked Data Error - Into
Quads Error - RdfLiteral
- RdfLiteral
Ref - Resource
Interpretation - Resource interpretation.
- Resource
OrIri Ref
Traits§
- AsRdf
Literal - Graph
Visitor - Linked
Data - Linked-Data type.
- Linked
Data Deserialize - Linked
Data Deserialize Predicate Objects - Linked
Data Deserialize Subject - Linked
Data Graph - Serialize a Linked-Data graph.
- Linked
Data Predicate Objects - Type representing the objects of an RDF subject’s predicate binding.
- Linked
Data Resource - Type that can have an interpretation.
- Linked
Data Resource Ref - Type that can have an interpretation bound to the given lifetime.
- Linked
Data Subject - Serialize a Linked-Data node.
- Predicate
Objects Visitor - RdfLiteral
Type - RdfLiteral
Value - Subject
Visitor - Visitor
- RDF dataset visitor.
Functions§
- to_
interpreted_ graph_ quads - to_
interpreted_ quads - to_
interpreted_ subject_ quads - to_
lexical_ quads - to_
lexical_ quads_ with - to_
lexical_ subject_ quads - to_
lexical_ subject_ quads_ with - to_
quads - to_
quads_ with