pub struct TripleRef<'a> {
pub subject: SubjectRef<'a>,
pub predicate: NamedNodeRef<'a>,
pub object: TermRef<'a>,
}
Expand description
A borrowed RDF triple.
The default string formatter is returning an N-Triples, Turtle, and SPARQL compatible representation:
use oxrdf::{TripleRef, NamedNodeRef};
assert_eq!(
"<http://example.com/s> <http://example.com/p> <http://example.com/o>",
TripleRef {
subject: NamedNodeRef::new("http://example.com/s")?.into(),
predicate: NamedNodeRef::new("http://example.com/p")?,
object: NamedNodeRef::new("http://example.com/o")?.into(),
}.to_string()
);
Fields§
§subject: SubjectRef<'a>
The subject of this triple.
predicate: NamedNodeRef<'a>
The predicate of this triple.
object: TermRef<'a>
The object of this triple.
Implementations§
source§impl<'a> TripleRef<'a>
impl<'a> TripleRef<'a>
sourcepub fn new(
subject: impl Into<SubjectRef<'a>>,
predicate: impl Into<NamedNodeRef<'a>>,
object: impl Into<TermRef<'a>>
) -> Self
pub fn new( subject: impl Into<SubjectRef<'a>>, predicate: impl Into<NamedNodeRef<'a>>, object: impl Into<TermRef<'a>> ) -> Self
Builds an RDF triple.
sourcepub fn in_graph(self, graph_name: impl Into<GraphNameRef<'a>>) -> QuadRef<'a>
pub fn in_graph(self, graph_name: impl Into<GraphNameRef<'a>>) -> QuadRef<'a>
Encodes that this triple is in an RDF dataset.