pub struct Quad {
pub subject: NamedOrBlankNode,
pub predicate: NamedNode,
pub object: Term,
pub graph_name: GraphName,
}Expand description
An owned triple in an RDF dataset.
The default string formatter is returning an N-Quads compatible representation:
use oxrdf::{Quad, NamedNode};
assert_eq!(
"<http://example.com/s> <http://example.com/p> <http://example.com/o> <http://example.com/g>",
Quad {
subject: NamedNode::new("http://example.com/s")?.into(),
predicate: NamedNode::new("http://example.com/p")?,
object: NamedNode::new("http://example.com/o")?.into(),
graph_name: NamedNode::new("http://example.com/g")?.into(),
}.to_string()
);Fields§
§subject: NamedOrBlankNodeThe subject of this triple.
predicate: NamedNodeThe predicate of this triple.
object: TermThe object of this triple.
graph_name: GraphNameThe name of the RDF graph in which the triple is.
Implementations§
Trait Implementations§
Source§impl Extend<Quad> for Dataset
impl Extend<Quad> for Dataset
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Quad>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Quad>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<Quad> for Dataset
impl FromIterator<Quad> for Dataset
Source§impl FromStr for Quad
impl FromStr for Quad
Source§fn from_str(s: &str) -> Result<Quad, <Quad as FromStr>::Err>
fn from_str(s: &str) -> Result<Quad, <Quad as FromStr>::Err>
Parses a triple from its NQuads serialization
use oxrdf::{BlankNode, GraphName, Literal, NamedNode, Quad};
use std::str::FromStr;
assert_eq!(
Quad::from_str("_:a <http://example.com/p> \"o\" .")?,
Quad::new(
BlankNode::new("a")?,
NamedNode::new("http://example.com/p")?,
Literal::new_simple_literal("o"),
GraphName::DefaultGraph
)
);
assert_eq!(
Quad::from_str("_:a <http://example.com/p> \"o\" <http://example.com/g> .")?,
Quad::new(
BlankNode::new("a")?,
NamedNode::new("http://example.com/p")?,
Literal::new_simple_literal("o"),
NamedNode::new("http://example.com/g")?
)
);Source§type Err = TermParseError
type Err = TermParseError
The associated error which can be returned from parsing.
impl Eq for Quad
impl StructuralPartialEq for Quad
Auto Trait Implementations§
impl Freeze for Quad
impl RefUnwindSafe for Quad
impl Send for Quad
impl Sync for Quad
impl Unpin for Quad
impl UnwindSafe for Quad
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more