[−][src]Struct oxigraph::model::Literal
An owned RDF literal
The default string formatter is returning an N-Triples, Turtle and SPARQL compatible representation:
use oxigraph::model::Literal; use oxigraph::model::vocab::xsd; assert_eq!( "\"foo\\nbar\"", Literal::new_simple_literal("foo\nbar").to_string() ); assert_eq!( "\"1999-01-01\"^^<http://www.w3.org/2001/XMLSchema#date>", Literal::new_typed_literal("1999-01-01", xsd::DATE).to_string() ); assert_eq!( "\"foo\"@en", Literal::new_language_tagged_literal("foo", "en")?.to_string() );
Implementations
impl Literal
[src]
pub fn new_simple_literal(value: impl Into<String>) -> Self
[src]
Builds an RDF simple literal
pub fn new_typed_literal(
value: impl Into<String>,
datatype: impl Into<NamedNode>
) -> Self
[src]
value: impl Into<String>,
datatype: impl Into<NamedNode>
) -> Self
pub fn new_language_tagged_literal(
value: impl Into<String>,
language: impl Into<String>
) -> Result<Self, LanguageTagParseError>
[src]
value: impl Into<String>,
language: impl Into<String>
) -> Result<Self, LanguageTagParseError>
Builds an RDF language-tagged string
pub fn new_language_tagged_literal_unchecked(
value: impl Into<String>,
language: impl Into<String>
) -> Self
[src]
value: impl Into<String>,
language: impl Into<String>
) -> Self
Builds an RDF language-tagged string
It is the responsibility of the caller to check that language
is valid BCP47 language tag,
and is lowercase.
new_language_tagged_literal
is a safe version of this constructor and should be used for untrusted data.
pub fn value(&self) -> &str
[src]
The literal lexical form
pub fn language(&self) -> Option<&str>
[src]
The literal language tag if it is a language-tagged string.
Language tags are defined by the BCP47. They are normalized to lowercase by this implementation.
pub fn datatype(&self) -> NamedNodeRef<'_>
[src]
The literal datatype.
The datatype of language-tagged string is always rdf:langString. The datatype of simple literals is xsd:string.
pub fn is_plain(&self) -> bool
[src]
Checks if this literal could be seen as an RDF 1.0 plain literal.
It returns true if the literal is a language-tagged string or has the datatype xsd:string.
pub fn as_ref(&self) -> LiteralRef<'_>
[src]
pub fn destruct(self) -> (String, Option<NamedNode>, Option<String>)
[src]
Extract components from this literal
Trait Implementations
impl Clone for Literal
[src]
impl Debug for Literal
[src]
impl Display for Literal
[src]
impl Eq for Literal
[src]
impl<'a> From<&'a Literal> for LiteralRef<'a>
[src]
impl<'a> From<&'a Literal> for TermRef<'a>
[src]
impl<'a> From<&'a str> for Literal
[src]
impl<'a> From<Cow<'a, str>> for Literal
[src]
impl From<Literal> for Term
[src]
impl<'a> From<LiteralRef<'a>> for Literal
[src]
fn from(node: LiteralRef<'a>) -> Self
[src]
impl From<String> for Literal
[src]
impl From<bool> for Literal
[src]
impl From<f32> for Literal
[src]
impl From<f64> for Literal
[src]
impl From<i128> for Literal
[src]
impl From<i16> for Literal
[src]
impl From<i32> for Literal
[src]
impl From<i64> for Literal
[src]
impl From<u16> for Literal
[src]
impl From<u32> for Literal
[src]
impl From<u64> for Literal
[src]
impl Hash for Literal
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Literal> for Literal
[src]
impl<'_> PartialEq<Literal> for LiteralRef<'_>
[src]
impl<'_> PartialEq<LiteralRef<'_>> for Literal
[src]
fn eq(&self, other: &LiteralRef<'_>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Literal
[src]
impl StructuralPartialEq for Literal
[src]
impl TTerm for Literal
[src]
fn kind(&self) -> TermKind
[src]
fn value_raw(&self) -> RawValue<'_>
[src]
fn datatype(&self) -> Option<SimpleIri<'_>>
[src]
fn language(&self) -> Option<&str>
[src]
fn as_dyn(&self) -> &dyn TTerm
[src]
fn value(&self) -> MownStr<'_>
[src]
fn is_absolute(&self) -> bool
[src]
impl TryCopyTerm for Literal
[src]
Auto Trait Implementations
impl RefUnwindSafe for Literal
impl Send for Literal
impl Sync for Literal
impl Unpin for Literal
impl UnwindSafe for Literal
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CopiableTerm for T where
T: TTerm + ?Sized,
[src]
T: TTerm + ?Sized,
fn copied<U>(&self) -> U where
U: CopyTerm,
[src]
U: CopyTerm,
fn try_copied<U>(&self) -> Result<U, <U as TryCopyTerm>::Error> where
U: TryCopyTerm,
[src]
U: TryCopyTerm,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<U> TermMatcher for U where
U: TTerm + ?Sized,
[src]
U: TTerm + ?Sized,
type Term = U
Type of TTerm
used internally by this matcher.
fn constant(&self) -> Option<&U>
[src]
fn matches<T>(&self, t: &T) -> bool where
T: TTerm + ?Sized,
[src]
T: TTerm + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,