From 10b1fa68f366d51c6ef7f9df05772e6bdcc812fb Mon Sep 17 00:00:00 2001 From: Tpt Date: Thu, 16 Jan 2020 18:21:06 +0100 Subject: [PATCH] Adds native xsd:duration xsd:dateTime xsd:date and xsd:time structures --- lib/Cargo.toml | 8 +- lib/src/model/literal.rs | 34 +- lib/src/model/xsd/date_time.rs | 1613 ++++++++++++++++++++++++++++++ lib/src/model/xsd/decimal.rs | 232 ++++- lib/src/model/xsd/duration.rs | 382 +++++++ lib/src/model/xsd/mod.rs | 8 +- lib/src/model/xsd/parser.rs | 462 +++++++++ lib/src/sparql/eval.rs | 329 +++--- lib/src/sparql/plan.rs | 1 + lib/src/sparql/plan_builder.rs | 8 + lib/src/store/mod.rs | 1 - lib/src/store/numeric_encoder.rs | 216 ++-- lib/tests/sparql_test_cases.rs | 2 + 13 files changed, 2925 insertions(+), 371 deletions(-) create mode 100644 lib/src/model/xsd/date_time.rs create mode 100644 lib/src/model/xsd/duration.rs create mode 100644 lib/src/model/xsd/parser.rs diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 1ad28f2b..482a210d 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -18,7 +18,6 @@ rocksdb = { version = "0.13", optional = true } byteorder = { version = "1", features = ["i128"] } quick-xml = "0.17" num-traits = "0.2" -chrono = "0.4" rand = "0.7" md-5 = "0.8" sha-1 = "0.8" @@ -26,10 +25,11 @@ sha2 = "0.8" digest = "0.8" failure = "0.1" regex = "1" -rio_api = "0.4" -rio_turtle = "0.4" -rio_xml = "0.4" +rio_api = "0.3" +rio_turtle = "0.3" +rio_xml = "0.3" hex = "0.4" +nom = "5" [dev-dependencies] rayon = "1" diff --git a/lib/src/model/literal.rs b/lib/src/model/literal.rs index bd52cefc..b2c0c4d8 100644 --- a/lib/src/model/literal.rs +++ b/lib/src/model/literal.rs @@ -1,8 +1,7 @@ use crate::model::named_node::NamedNode; use crate::model::vocab::rdf; use crate::model::vocab::xsd; -use crate::model::xsd::Decimal; -use chrono::prelude::*; +use crate::model::xsd::*; use rio_api::model as rio; use std::borrow::Cow; use std::fmt; @@ -237,8 +236,8 @@ impl From for Literal { } } -impl From> for Literal { - fn from(value: Date) -> Self { +impl From for Literal { + fn from(value: Date) -> Self { Literal(LiteralContent::TypedLiteral { value: value.to_string(), datatype: xsd::DATE.clone(), @@ -246,17 +245,8 @@ impl From> for Literal { } } -impl From for Literal { - fn from(value: NaiveDate) -> Self { - Literal(LiteralContent::TypedLiteral { - value: value.to_string(), - datatype: xsd::DATE.clone(), - }) - } -} - -impl From for Literal { - fn from(value: NaiveTime) -> Self { +impl From