Skip to main content

QuotedTripleSurface

Enum QuotedTripleSurface 

Source
pub enum QuotedTripleSurface {
    RdfStar,
    Rdf12,
}
Expand description

Which surface a << … >> in Turtle/TriG input is read as — the input half of rete export --quoted-triple-syntax, same vocabulary, same two values.

The flag exists because the two standards give one piece of syntax two meanings, and no amount of looking at the bytes can tell them apart:

writtenunder RdfStarunder Rdf12
<< s p o >>a quoted triple, one terma reifier: _:r rdf:reifies <<( s p o )>>, plus a blank node standing where it was
<<( s p o )>>a syntax errora triple term, object position only
{| … |}a syntax erroran annotation on the statement before it

One file, two readings, two different graphs — see the round-trip matrix in crates/rete-cli/tests/quoted_triple_surfaces.rs, which asserts both.

<<( s p o )>> is unambiguous: it is RDF 1.2’s and nothing else’s. That asymmetry is why RdfStar is the default. Reading an RDF-star file as RDF 1.2 silently yields a different graph; reading an RDF 1.2 file as RDF-star is a hard parse error that names the flag. Only one of the two mistakes is survivable, so the default is the one that makes the other mistake loud.

N-Triples and N-Quads ignore this entirely. Their reader is rete’s own (take_term), it has accepted both << s p o >> and <<( s p o )>> since #262, and RDF 1.2 N-Triples has no reifier syntax for << … >> to be — so there is no ambiguity to resolve and nothing to choose. The same goes for RDF/XML.

Whichever surface reads the file, what gets stored is the same canonical token <<s p o>>. rete’s term model is a superset of both: a triple term is a term, and RDF 1.2 reification is ordinary RDF — a blank node, a predicate and a term — which rete already stored before this flag existed.

Variants§

§

RdfStar

<< s p o >> is a quoted triple (RDF-star), in subject or object position — rete’s own storage token. The default, and byte-for-byte the behaviour every rete release before this flag had.

§

Rdf12

<<( s p o )>> is a triple term and << s p o >> is a reifier (RDF 1.2), with {| … |} annotations read too.

Implementations§

Source§

impl QuotedTripleSurface

Source

pub fn parse(s: &str) -> Option<QuotedTripleSurface>

Parse the --quoted-triple-syntax value, None for anything else. Shared by rete build, rete validate and rete export so the flag cannot come to mean two things in two directions.

Source

pub const fn as_str(self) -> &'static str

The flag spelling of this surface — the inverse of Self::parse.

Trait Implementations§

Source§

impl Clone for QuotedTripleSurface

Source§

fn clone(&self) -> QuotedTripleSurface

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for QuotedTripleSurface

Source§

impl Debug for QuotedTripleSurface

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for QuotedTripleSurface

Source§

fn default() -> QuotedTripleSurface

Returns the “default value” for a type. Read more
Source§

impl Eq for QuotedTripleSurface

Source§

impl Hash for QuotedTripleSurface

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for QuotedTripleSurface

Source§

fn eq(&self, other: &QuotedTripleSurface) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for QuotedTripleSurface

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V