Skip to main content

Crate rdf_syntax

Crate rdf_syntax 

Source
Expand description

The Resource Description Framework (RDF) is a very simple graph data model defined by the World Wide Web Consortium (W3C) to represent arbitrary pieces of information, primarily intended for the web. Nodes of the graph are called resources, and resources are connected together using relations, which are resources themselves.

This crate is built on top of rdf-types to provide the lexical (syntactic) representation of resources (IRIs, blank node identifiers and literals) as defined by the RDF 1.1 Concepts and Abstract Syntax recommendation, along with the term definitions from RDF Schema (RDFS):

  • Id and BlankId represent, respectively, a resource identifier (an IRI or a blank node identifier) and a blank node identifier alone;
  • Literal and LiteralType represent RDF literals and their datatype (either an arbitrary IRI or the rdf:langString type paired with a LangTag);
  • Term and GroundTerm represent, respectively, a lexical RDF term (an Id or a Literal) and a ground term, which excludes blank node identifiers (an IRI or a Literal);
  • RdfTriple and RdfQuad are triples/quads built from those lexical terms, with Grdf-prefixed variants (GrdfTriple, GrdfQuad) allowing a blank node identifier anywhere in the triple/quad, for generalized RDF;
  • the Interpretation trait family maps lexical terms to the semantic resources of an rdf_types::Domain, turning lexical RDF data into the purely semantic representation manipulated by the rdf-types crate.

Every lexical type above comes in three flavors: an owned version (e.g. Term), a borrowed version (e.g. TermRef), and a copy-on-write version (e.g. CowTerm).

Re-exports§

pub use iref;
pub use rdf_types;
pub use langtag;

Modules§

btree_dataset
btree_graph
diff
Diff between two RDF datasets.
fallible
generator
indexed_btree_dataset
indexed_btree_graph
iri
pattern
Triple/quad patterns, used to describe a set of triples/quads by leaving some of their components unspecified (variables).
util
Small iterator adapters shared by the fallible/owned trait implementations of this crate.

Macros§

blankid
grdf_quad
Creates a gRDF quad.
grdf_quad_pattern
Creates a gRDF quad pattern.
grdf_quads
Creates an array of quads.
grdf_triple
Creates a gRDF triple.
grdf_triples
Creates an array of triples.
iri
Parses an Iri at compile time.
iri_ref
Parses an IriRef at compile time.

Structs§

BTreeBijection
Blank node identifier bijection between two (isomorphic) datasets.
BTreeDataset
BTree-based RDF dataset.
BTreeGraph
BTree-based RDF graph.
BlankId
Blank node identifier.
BlankIdBuf
Owned blankid.
CowLiteral
Copy-on-write RDF literal.
GenInterpretation
Lexical interpretation based on a term generator.
GroundTermsOf
Iterator over the ground terms of a resource.
IndexedBTreeDataset
Indexed BTree-based RDF dataset, optimized for pattern matching operations.
IndexedBTreeGraph
Indexed BTree-based RDF graph, optimized for pattern matching operations.
InvalidBlankId
Invalid blankid error.
InvalidIri
Invalid IRI error.
Iri
Uniform Resource Identifier (IRI).
IriBuf
Owned IRI.
IriRef
IRI reference.
IriRefBuf
Owned IRI reference.
LangTag
Any language tag (normal, private use or grandfathered).
LangTagBuf
Owned langtag.
Literal
RDF Literal.
LiteralRef
RDF Literal reference.
Quad
RDF quad.
QuadObjects
Iterator over the objects of a dataset matching a given graph, subject and predicate.
QuadPredicatesObjects
Iterator over the predicates of a dataset matching a given graph and subject, along with, for each predicate, the objects matching it.
RdfDisplayed
Value ready to be formatted as an RDF syntax element.
StaticDomain
Trivial domain implementation that just fixes the resource type R, without tracking any actual resource.
TermsOf
Iterator over the terms of a resource.
Triple
RDF triple.
TripleObjects
Iterator over the objects of a graph matching a given subject and predicate.
TriplePredicatesObjects
Iterator over the predicates of a graph matching a given subject, along with, for each predicate, the objects matching it.
TryGroundTermsOf
Iterator over the ground terms of a resource.
TryTermsOf
Iterator over the terms of a resource.
WithGenerator
Combines any RDF interpretation with a node id generator.

Enums§

Cow
A clone-on-write smart pointer.
CowGroundTerm
Copy-on-write ground term.
CowId
Copy-on-write resource identifier.
CowLiteralType
Owned or referenced RDF literal type.
CowTerm
Copy-on-write term.
GroundTerm
Term excluding blank node identifiers.
GroundTermRef
Ground term reference.
Id
Resource identifier.
IdRef
Resource identifier reference.
IriError
LiteralType
RDF literal type.
LiteralTypeRef
RDF literal type reference.
Term
Term.
TermRef
Term reference.

Constants§

RDFS_CLASS
http://www.w3.org/2000/01/rdf-schema#Class class IRI.
RDFS_COMMENT
http://www.w3.org/2000/01/rdf-schema#comment property IRI.
RDFS_CONTAINER
http://www.w3.org/2000/01/rdf-schema#Container class IRI.
RDFS_CONTAINER_MEMBERSHIP_PROPERTY
http://www.w3.org/2000/01/rdf-schema#ContainerMembershipProperty class IRI.
RDFS_DATATYPE
http://www.w3.org/2000/01/rdf-schema#Datatype class IRI.
RDFS_DOMAIN
http://www.w3.org/2000/01/rdf-schema#domain property IRI.
RDFS_IS_DEFINED_BY
http://www.w3.org/2000/01/rdf-schema#isDefinedBy property IRI.
RDFS_LABEL
http://www.w3.org/2000/01/rdf-schema#label property IRI.
RDFS_LITERAL
http://www.w3.org/2000/01/rdf-schema#Literal class IRI.
RDFS_MEMBER
http://www.w3.org/2000/01/rdf-schema#member property IRI.
RDFS_RANGE
http://www.w3.org/2000/01/rdf-schema#range property IRI.
RDFS_RESOURCE
http://www.w3.org/2000/01/rdf-schema#Resource class IRI.
RDFS_SEE_ALSO
http://www.w3.org/2000/01/rdf-schema#seeAlso property IRI.
RDFS_SUB_CLASS_OF
http://www.w3.org/2000/01/rdf-schema#subClassOf property IRI.
RDFS_SUB_PROPERTY_OF
http://www.w3.org/2000/01/rdf-schema#subPropertyOf property IRI.
RDF_ALT
http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt class IRI.
RDF_BAG
http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag class IRI.
RDF_FIRST
http://www.w3.org/1999/02/22-rdf-syntax-ns#first property IRI.
RDF_HTML
http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML datatype IRI.
RDF_JSON
http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON datatype IRI.
RDF_LANG_STRING
http://www.w3.org/1999/02/22-rdf-syntax-ns#langString datatype IRI.
RDF_LIST
http://www.w3.org/1999/02/22-rdf-syntax-ns#List class IRI.
RDF_NIL
http://www.w3.org/1999/02/22-rdf-syntax-ns#nil individual IRI.
RDF_OBJECT
http://www.w3.org/1999/02/22-rdf-syntax-ns#object property IRI.
RDF_PREDICATE
http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate property IRI.
RDF_PROPERTY
http://www.w3.org/1999/02/22-rdf-syntax-ns#Property class IRI.
RDF_REST
http://www.w3.org/1999/02/22-rdf-syntax-ns#rest property IRI.
RDF_SEQ
http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq class IRI.
RDF_STATEMENT
http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement class IRI.
RDF_SUBJECT
http://www.w3.org/1999/02/22-rdf-syntax-ns#subject property IRI.
RDF_TYPE
http://www.w3.org/1999/02/22-rdf-syntax-ns#type property IRI.
RDF_VALUE
http://www.w3.org/1999/02/22-rdf-syntax-ns#value property IRI.
RDF_XML_LITERAL
http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral datatype IRI.
XSD_STRING
http://www.w3.org/2001/XMLSchema#string datatype IRI.

Traits§

AsyncConstGenDomain
Domain that can spawn fresh new resources from a shared reference.
AsyncDatasetMut
Async mutable dataset.
AsyncFiniteDataset
Async finite dataset.
AsyncFiniteDomain
Asynchronous finite domain.
AsyncFiniteGraph
Async finite graph.
AsyncGenDomain
Domain that can spawn fresh new resources.
AsyncGraphMut
Async mutable graph.
AsyncPatternMatchingDataset
Async pattern-matching-capable dataset.
AsyncPatternMatchingGraph
Async pattern-matching-capable graph.
ConstGenDomain
Domain that can spawn fresh new resources from a shared reference.
Dataset
RDF dataset.
DatasetMut
Mutable dataset.
Domain
RDF resource domain.
FiniteDataset
Dataset that can be traversed using a provided quad iterator.
FiniteDomain
Finite domain.
FiniteGraph
Graph that can be traversed using a provided triple iterator.
GenDomain
Domain that can spawn fresh new resources.
Generator
Lexical identifier generator.
Graph
RDF graph.
GraphMut
Mutable graph.
GroundInterpretation
RDF ground resource interpretation.
GroundInterpretationMut
Mutable ground interpretation, able to create new interpreted resources on demand.
Interpretation
RDF resource interpretation.
InterpretationMut
Mutable resource interpretation, able to create new interpreted resources on demand.
MultiPatternMatchingDataset
Multi-pattern-matching-capable dataset.
MultiPatternMatchingGraph
Multi-pattern-matching-capable graph.
NamedGraphFiniteDataset
Dataset that can enumerate the distinct resources it uses to name a graph.
ObjectFiniteDataset
Dataset that can enumerate the distinct resources it uses as an object.
ObjectFiniteGraph
Graph that can enumerate the distinct resources it uses as an object.
PatternMatchingDataset
Pattern-matching-capable dataset.
PatternMatchingDatasetMut
Pattern-matching-capable mutable dataset.
PatternMatchingGraph
Pattern-matching-capable graph.
PatternMatchingGraphMut
Pattern-matching-capable mutable graph.
PredicateFiniteDataset
Dataset that can enumerate the distinct resources it uses as a predicate.
PredicateFiniteGraph
Graph that can enumerate the distinct resources it uses as a predicate.
RdfDisplay
Display method for RDF syntax elements.
ResourceFiniteDataset
Dataset that can enumerate the distinct resources it mentions (in any position of any quad).
ResourceFiniteGraph
Graph that can enumerate the distinct resources it mentions (in any position of any triple).
ReverseGroundInterpretation
Reverse ground interpretation, listing the ground lexical terms of a given resource.
ReverseInterpretation
Reverse resource interpretation, listing the lexical terms of a given resource.
SubjectFiniteDataset
Dataset that can enumerate the distinct resources it uses as a subject.
SubjectFiniteGraph
Graph that can enumerate the distinct resources it uses as a subject.
TryConstGenDomain
Fallible domain that can spawn fresh new resources from a shared reference.
TryDataset
Fallible dataset.
TryDatasetMut
Fallible mutable dataset.
TryDomain
Fallible domain.
TryFiniteDataset
Fallible dataset that can be traversed using a provided quad iterator.
TryFiniteDomain
Fallible finite domain.
TryFiniteGraph
Fallible graph that can be traversed using a provided triple iterator.
TryGenDomain
Fallible domain that can spawn fresh new resources.
TryGraph
Fallible graph.
TryGraphMut
Fallible mutable graph.
TryGroundInterpretation
Fallible ground interpretation.
TryGroundInterpretationMut
Mutable fallible ground interpretation.
TryInterpretation
Fallible interpretation.
TryInterpretationMut
Mutable fallible interpretation.
TryPatternMatchingDataset
Pattern-matching-capable fallible dataset.
TryPatternMatchingGraph
Pattern-matching-capable fallible graph.
TryReverseGroundInterpretation
Fallible reverse ground interpretation.
TryReverseInterpretation
Fallible reverse interpretation.

Functions§

are_isomorphic
Checks that there is an isomorphism between the datasets a and b.
find_bijection
Finds a blank node identifier bijection from a to b. If such bijection exists, there is an isomorphism between a and b.

Type Aliases§

GrdfQuad
gRDF quad.
GrdfQuadRef
gRDF quad reference.
GrdfTriple
gRDF triple.
GrdfTripleRef
gRDF triple reference.
RdfQuad
Lexical RDF quad.
RdfQuadRef
Lexical RDF quad reference.
RdfTriple
RDF triple.
RdfTripleRef
RDF triple reference.