#[non_exhaustive]pub enum RdfFormat {
N3,
NQuads,
NTriples,
RdfXml,
TriG,
Turtle,
JsonLd {
profile: JsonLdProfileSet,
},
}Expand description
RDF serialization formats
This enumeration covers all major RDF serialization formats supported by OxiRS. Based on W3C specifications and community standards.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
N3
NQuads
NTriples
RdfXml
TriG
Turtle
JsonLd
JSON-LD with optional profiles
Fields
profile: JsonLdProfileSetImplementations§
Source§impl RdfFormat
impl RdfFormat
Sourcepub const fn iri(&self) -> &'static str
pub const fn iri(&self) -> &'static str
The format canonical IRI according to the Unique URIs for file formats registry.
use oxirs_core::format::RdfFormat;
assert_eq!(
RdfFormat::NTriples.iri(),
"http://www.w3.org/ns/formats/N-Triples"
)Sourcepub fn media_type(&self) -> &'static str
pub fn media_type(&self) -> &'static str
The format IANA media type.
use oxirs_core::format::RdfFormat;
assert_eq!(RdfFormat::NTriples.media_type(), "application/n-triples")Sourcepub const fn file_extension(&self) -> &'static str
pub const fn file_extension(&self) -> &'static str
The format IANA-registered file extension.
use oxirs_core::format::RdfFormat;
assert_eq!(RdfFormat::NTriples.file_extension(), "nt")Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
The format name.
use oxirs_core::format::RdfFormat;
assert_eq!(RdfFormat::NTriples.name(), "N-Triples")Sourcepub const fn supports_datasets(&self) -> bool
pub const fn supports_datasets(&self) -> bool
Checks if the format supports RDF datasets and not only RDF graphs.
use oxirs_core::format::RdfFormat;
assert_eq!(RdfFormat::NTriples.supports_datasets(), false);
assert_eq!(RdfFormat::NQuads.supports_datasets(), true);Sourcepub const fn supports_rdf_star(&self) -> bool
pub const fn supports_rdf_star(&self) -> bool
Checks if the format supports RDF-star (quoted triples).
use oxirs_core::format::RdfFormat;
assert_eq!(RdfFormat::Turtle.supports_rdf_star(), true);
assert_eq!(RdfFormat::RdfXml.supports_rdf_star(), false);Sourcepub fn from_media_type(media_type: &str) -> Option<Self>
pub fn from_media_type(media_type: &str) -> Option<Self>
Looks for a known format from a media type.
It supports some media type aliases.
For example, “application/xml” is going to return RdfFormat::RdfXml even if it is not its canonical media type.
Example:
use oxirs_core::format::{RdfFormat, JsonLdProfile};
assert_eq!(
RdfFormat::from_media_type("text/turtle; charset=utf-8"),
Some(RdfFormat::Turtle)
);
assert_eq!(
RdfFormat::from_media_type(
"application/ld+json ; profile = http://www.w3.org/ns/json-ld#streaming"
),
Some(RdfFormat::JsonLd {
profile: JsonLdProfile::Streaming.into()
})
)Sourcepub fn from_extension(extension: &str) -> Option<Self>
pub fn from_extension(extension: &str) -> Option<Self>
Looks for a known format from an extension.
It supports some aliases.
Example:
use oxirs_core::format::RdfFormat;
assert_eq!(RdfFormat::from_extension("nt"), Some(RdfFormat::NTriples))Trait Implementations§
Source§impl<'de> Deserialize<'de> for RdfFormat
impl<'de> Deserialize<'de> for RdfFormat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for RdfFormat
impl StructuralPartialEq for RdfFormat
Auto Trait Implementations§
impl Freeze for RdfFormat
impl RefUnwindSafe for RdfFormat
impl Send for RdfFormat
impl Sync for RdfFormat
impl Unpin for RdfFormat
impl UnsafeUnpin for RdfFormat
impl UnwindSafe for RdfFormat
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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