pull/745/head
Yuri Astrakhan 11 months ago
parent 4f2213a380
commit b41b90cd6b
  1. 10
      lib/oxrdf/src/literal.rs
  2. 7
      lib/oxsdatatypes/src/geopoint.rs
  3. 1
      lib/oxsdatatypes/src/lib.rs

@ -1,5 +1,5 @@
use crate::named_node::NamedNode;
use crate::vocab::{rdf, xsd};
use crate::vocab::{geosparql, rdf, xsd};
use crate::NamedNodeRef;
use oxilangtag::{LanguageTag, LanguageTagParseError};
#[cfg(feature = "oxsdatatypes")]
@ -422,6 +422,14 @@ impl From<DayTimeDuration> for Literal {
}
}
#[cfg(feature = "oxsdatatypes")]
impl From<GeoPoint> for Literal {
#[inline]
fn from(value: GeoPoint) -> Self {
Self::new_typed_literal(value.to_string(), geosparql::WKT_LITERAL)
}
}
/// A borrowed RDF [literal](https://www.w3.org/TR/rdf11-concepts/#dfn-literal).
///
/// The default string formatter is returning an N-Triples, Turtle, and SPARQL compatible representation:

@ -1,3 +1,5 @@
use std::fmt;
use std::fmt::Formatter;
use std::str::FromStr;
use thiserror::Error;
use wkt::types::Point;
@ -38,6 +40,11 @@ impl FromStr for GeoPoint {
}
}
impl fmt::Display for GeoPoint {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]

@ -25,4 +25,5 @@ pub use self::duration::{
ParseDurationError, YearMonthDuration,
};
pub use self::float::Float;
pub use self::geopoint::{GeoPoint, GeoPointError};
pub use self::integer::{Integer, TooLargeForIntegerError};

Loading…
Cancel
Save