diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index be981cc7..73f11a59 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -379,3 +379,9 @@ jobs: - uses: actions/checkout@v3 - run: sudo apt install -y shellcheck - run: git grep -l '^#\( *shellcheck \|!\(/bin/\|/usr/bin/env \)\(sh\|bash\|dash\|ksh\)\)' | xargs shellcheck + + spec_links: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: python test_spec_links.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 58ff2b6a..2fb2e353 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,7 +83,7 @@ - SPARQL: If written explicitly in the SPARQL query, the regular expressions are now compiled once and not for each row. - SPARQL: Property path evaluation with both start and end variables bound has been optimized. - SPARQL: Casts to `xsd:decimal` from `xsd:float` and `xsd:double` now properly fails on overflow instead of overflowing the internal 128-bits representation. - This follows [XPath casting rules](https://www.w3.org/TR/xpath-functions/#casting-to-decimal). + This follows [XPath casting rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-decimal). - Rust: The minimal supported Rust version is set at 1.60 and enforced using the CI. - Python: Local builds will now target the specific Python version instead of [abi3](https://docs.python.org/3/c-api/stable.html). abi3 wheels are still released on Pypi alongside new Python-version specific builds for Linux+GNU. @@ -254,7 +254,7 @@ ## [0.3.0-beta.1] - 2022-01-29 ### Added -- [RDF-star](https://w3c.github.io/rdf-star/cg-spec) support. `Triple` is now a possible `Term`. Serialization formats and SPARQL support have been updated to match the [latest version of the specification draft](https://w3c.github.io/rdf-star/cg-spec/2021-07-01.html). +- [RDF-star](https://w3c.github.io/rdf-star/cg-spec/2021-12-17.html) support. `Triple` is now a possible `Term`. Serialization formats and SPARQL support have been updated to match the [latest version of the specification draft](https://w3c.github.io/rdf-star/cg-spec/2021-12-17.html). - Fast data bulk load with the `Store` `bulk_load_dataset` and `bulk_load_graph` methods and a special command line option of the server. - It is now possible to quickly backup the database using the `backup` method. - Rust: `*Syntax::from_extension` to easy guess a graph/dataset/sparql result format from a file extension. @@ -264,7 +264,7 @@ - `Store` operations are now transactional using the "repeatable read" isolation level: the store only exposes changes that have been "committed" (i.e. no partial writes) and the exposed state does not change for the complete duration of a read operation (e.g. a SPARQL query) or a read/write operation (e.g. a SPARQL update). the `Store` `transaction` method now allows to do read/write transactions. --`RDF-star `_ is now supported (including serialization formats and SPARQL-star). :py:class:`.Triple` can now be used in :py:attr:`.Triple.object`, :py:attr:`.Triple.object`, :py:attr:`.Quad.subject` and :py:attr:`.Quad.object`. +-`RDF-star `_ is now supported (including serialization formats and SPARQL-star). :py:class:`.Triple` can now be used in :py:attr:`.Triple.object`, :py:attr:`.Triple.object`, :py:attr:`.Quad.subject` and :py:attr:`.Quad.object`. ### Changed - SPARQL: It is now possible to compare `rdf:langString` literals with the same language tag. @@ -300,7 +300,7 @@ Many thanks to [Thad Guidry](https://github.com/thadguidry), [James Overton](htt ## [0.2.5] - 2021-07-11 ### Added -- [SPARQL 1.1 Query Results JSON Format](http://www.w3.org/TR/sparql11-results-json/) parser. +- [SPARQL 1.1 Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) parser. - Python wheels for macOS are now universal2 binaries. ### Changed diff --git a/README.md b/README.md index 06fa4ac1..8f7ed68e 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Oxigraph implements the following specifications: - [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/), [SPARQL 1.1 Update](https://www.w3.org/TR/sparql11-update/), and [SPARQL 1.1 Federated Query](https://www.w3.org/TR/sparql11-federated-query/). - [Turtle](https://www.w3.org/TR/turtle/), [TriG](https://www.w3.org/TR/trig/), [N-Triples](https://www.w3.org/TR/n-triples/), [N-Quads](https://www.w3.org/TR/n-quads/), and [RDF XML](https://www.w3.org/TR/rdf-syntax-grammar/) RDF serialization formats for both data ingestion and retrieval using the [Rio library](https://github.com/oxigraph/rio). -- [SPARQL Query Results XML Format](http://www.w3.org/TR/rdf-sparql-XMLres/), [SPARQL 1.1 Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) and [SPARQL 1.1 Query Results CSV and TSV Formats](https://www.w3.org/TR/sparql11-results-csv-tsv/). +- [SPARQL Query Results XML Format](https://www.w3.org/TR/rdf-sparql-XMLres/), [SPARQL 1.1 Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) and [SPARQL 1.1 Query Results CSV and TSV Formats](https://www.w3.org/TR/sparql11-results-csv-tsv/). A preliminary benchmark [is provided](bench/README.md). There is also [a document describing Oxigraph technical architecture](https://github.com/oxigraph/oxigraph/wiki/Architecture). diff --git a/js/README.md b/js/README.md index e9e81bfb..576c9739 100644 --- a/js/README.md +++ b/js/README.md @@ -242,7 +242,7 @@ store.dump("text/turtle", oxigraph.namedNode("http://example.com/graph")); ### From 0.2 to 0.3 * The `MemoryStore` class is now called `Store` (there is no other kind of stores...). * RDF/JS datamodel functions (`namedNode`...) are now available at the root of the `oxigraph` package. You now need to call `oxigraph.namedNode` instead of `store.dataFactory.namedNode`. -* [RDF-star](https://w3c.github.io/rdf-star/cg-spec) is now implemented. `Quad` is now a valid value for the `Ωuad` `subject` and `object` properties. +* [RDF-star](https://w3c.github.io/rdf-star/cg-spec/2021-12-17.html) is now implemented. `Quad` is now a valid value for the `Ωuad` `subject` and `object` properties. ## How to contribute diff --git a/lib/README.md b/lib/README.md index 3b06e005..80d071ff 100644 --- a/lib/README.md +++ b/lib/README.md @@ -20,7 +20,7 @@ Oxigraph also provides [a standalone HTTP server](https://crates.io/crates/oxigr Oxigraph implements the following specifications: * [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/), [SPARQL 1.1 Update](https://www.w3.org/TR/sparql11-update/), and [SPARQL 1.1 Federated Query](https://www.w3.org/TR/sparql11-federated-query/). * [Turtle](https://www.w3.org/TR/turtle/), [TriG](https://www.w3.org/TR/trig/), [N-Triples](https://www.w3.org/TR/n-triples/), [N-Quads](https://www.w3.org/TR/n-quads/), and [RDF XML](https://www.w3.org/TR/rdf-syntax-grammar/) RDF serialization formats for both data ingestion and retrieval using the [Rio library](https://github.com/oxigraph/rio). -* [SPARQL Query Results XML Format](http://www.w3.org/TR/rdf-sparql-XMLres/), [SPARQL 1.1 Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) and [SPARQL 1.1 Query Results CSV and TSV Formats](https://www.w3.org/TR/sparql11-results-csv-tsv/). +* [SPARQL Query Results XML Format](https://www.w3.org/TR/rdf-sparql-XMLres/), [SPARQL 1.1 Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) and [SPARQL 1.1 Query Results CSV and TSV Formats](https://www.w3.org/TR/sparql11-results-csv-tsv/). A preliminary benchmark [is provided](../bench/README.md). Oxigraph internal design [is described on the wiki](https://github.com/oxigraph/oxigraph/wiki/Architecture). diff --git a/lib/oxrdf/README.md b/lib/oxrdf/README.md index ee9dc3ec..5993a746 100644 --- a/lib/oxrdf/README.md +++ b/lib/oxrdf/README.md @@ -11,7 +11,7 @@ OxRDF is a simple library providing datastructures encoding [RDF 1.1 concepts](h This crate is intended to be a basic building block of other crates like [Oxigraph](https://crates.io/crates/oxigraph) or [Spargebra](https://crates.io/crates/spargebra). -Support for [RDF-star](https://w3c.github.io/rdf-star/cg-spec/) is available behind the `rdf-star` feature. +Support for [RDF-star](https://w3c.github.io/rdf-star/cg-spec/2021-12-17.html) is available behind the `rdf-star` feature. OxRDF is inspired by [RDF/JS](https://rdf.js.org/data-model-spec/) and [Apache Commons RDF](http://commons.apache.org/proper/commons-rdf/). diff --git a/lib/oxrdf/src/dataset.rs b/lib/oxrdf/src/dataset.rs index 9925f7ca..72a06cc6 100644 --- a/lib/oxrdf/src/dataset.rs +++ b/lib/oxrdf/src/dataset.rs @@ -108,7 +108,7 @@ impl Dataset { Self::default() } - /// Provides a read-only view on an [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-graph) contained in this dataset. + /// Provides a read-only view on an [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-graph) contained in this dataset. /// /// ``` /// use oxrdf::*; @@ -131,7 +131,7 @@ impl Dataset { } } - /// Provides a read/write view on an [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-graph) contained in this dataset. + /// Provides a read/write view on an [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-graph) contained in this dataset. /// /// ``` /// use oxrdf::*; @@ -908,7 +908,7 @@ impl fmt::Display for Dataset { } } -/// A read-only view on an [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-graph) contained in a [`Dataset`]. +/// A read-only view on an [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-graph) contained in a [`Dataset`]. /// /// It is built using the [`Dataset::graph`] method. /// @@ -1243,7 +1243,7 @@ impl<'a> fmt::Display for GraphView<'a> { } } -/// A read/write view on an [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-graph) contained in a [`Dataset`]. +/// A read/write view on an [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-graph) contained in a [`Dataset`]. /// /// It is built using the [`Dataset::graph_mut`] method. /// diff --git a/lib/oxrdf/src/graph.rs b/lib/oxrdf/src/graph.rs index 804bedf6..195b75a1 100644 --- a/lib/oxrdf/src/graph.rs +++ b/lib/oxrdf/src/graph.rs @@ -1,4 +1,4 @@ -//! [In-memory implementation](super::Graph) of [RDF graphs](https://www.w3.org/TR/rdf11-concepts/#dfn-graph). +//! [In-memory implementation](super::Graph) of [RDF graphs](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-graph). //! //! Usage example: //! ``` @@ -26,7 +26,7 @@ use crate::dataset::*; use crate::*; use std::fmt; -/// An in-memory [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-graph). +/// An in-memory [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-graph). /// /// It can accommodate a fairly large number of triples (in the few millions). /// Beware: it interns the string and does not do any garbage collection yet: diff --git a/lib/oxrdf/src/literal.rs b/lib/oxrdf/src/literal.rs index 438fef9c..6891ba15 100644 --- a/lib/oxrdf/src/literal.rs +++ b/lib/oxrdf/src/literal.rs @@ -112,17 +112,17 @@ impl Literal { /// The literal [datatype](https://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri). /// - /// The datatype of [language-tagged string](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string) is always [rdf:langString](http://www.w3.org/1999/02/22-rdf-syntax-ns#langString). - /// The datatype of [simple literals](https://www.w3.org/TR/rdf11-concepts/#dfn-simple-literal) is [xsd:string](http://www.w3.org/2001/XMLSchema#string). + /// The datatype of [language-tagged string](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string) is always [rdf:langString](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string). + /// The datatype of [simple literals](https://www.w3.org/TR/rdf11-concepts/#dfn-simple-literal) is [xsd:string](https://www.w3.org/TR/xmlschema11-2/#string). #[inline] pub fn datatype(&self) -> NamedNodeRef<'_> { self.as_ref().datatype() } - /// Checks if this literal could be seen as an RDF 1.0 [plain literal](https://www.w3.org/TR/rdf-concepts/#dfn-plain-literal). + /// Checks if this literal could be seen as an RDF 1.0 [plain literal](https://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-plain-literal). /// /// It returns true if the literal is a [language-tagged string](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string) - /// or has the datatype [xsd:string](http://www.w3.org/2001/XMLSchema#string). + /// or has the datatype [xsd:string](https://www.w3.org/TR/xmlschema11-2/#string). #[inline] pub fn is_plain(&self) -> bool { self.as_ref().is_plain() @@ -510,8 +510,8 @@ impl<'a> LiteralRef<'a> { /// The literal [datatype](https://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri). /// - /// The datatype of [language-tagged string](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string) is always [rdf:langString](http://www.w3.org/1999/02/22-rdf-syntax-ns#langString). - /// The datatype of [simple literals](https://www.w3.org/TR/rdf11-concepts/#dfn-simple-literal) is [xsd:string](http://www.w3.org/2001/XMLSchema#string). + /// The datatype of [language-tagged string](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string) is always [rdf:langString](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string). + /// The datatype of [simple literals](https://www.w3.org/TR/rdf11-concepts/#dfn-simple-literal) is [xsd:string](https://www.w3.org/TR/xmlschema11-2/#string). #[inline] pub fn datatype(self) -> NamedNodeRef<'a> { match self.0 { @@ -521,10 +521,10 @@ impl<'a> LiteralRef<'a> { } } - /// Checks if this literal could be seen as an RDF 1.0 [plain literal](https://www.w3.org/TR/rdf-concepts/#dfn-plain-literal). + /// Checks if this literal could be seen as an RDF 1.0 [plain literal](https://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-plain-literal). /// /// It returns true if the literal is a [language-tagged string](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string) - /// or has the datatype [xsd:string](http://www.w3.org/2001/XMLSchema#string). + /// or has the datatype [xsd:string](https://www.w3.org/TR/xmlschema11-2/#string). #[inline] pub fn is_plain(self) -> bool { matches!( diff --git a/lib/oxsdatatypes/README.md b/lib/oxsdatatypes/README.md index 213a53f1..1f0b419a 100644 --- a/lib/oxsdatatypes/README.md +++ b/lib/oxsdatatypes/README.md @@ -28,7 +28,7 @@ Each datatype provides: * `PartialEq`, and `Eq` if possible, implementations following its [equality relation](https://www.w3.org/TR/xmlschema11-2/#equality). * `PartialOrd`, and `Ord` if possible, implementations following its [order relation](https://www.w3.org/TR/xmlschema11-2/#order). * `From` and `TryFrom` implementations to implement [XPath casting](https://www.w3.org/TR/xpath-functions-31/#casting). -* Various methods implementing [XPath functions](https://www.w3.org/TR/xpath-functions/). +* Various methods implementing [XPath functions](https://www.w3.org/TR/xpath-functions-31/). * `from_be_bytes` and `to_be_bytes` methods for serialization. diff --git a/lib/oxsdatatypes/src/date_time.rs b/lib/oxsdatatypes/src/date_time.rs index 734ebab5..caaa00b9 100644 --- a/lib/oxsdatatypes/src/date_time.rs +++ b/lib/oxsdatatypes/src/date_time.rs @@ -43,7 +43,7 @@ impl DateTime { }) } - /// [fn:current-dateTime](https://www.w3.org/TR/xpath-functions/#func-current-dateTime) + /// [fn:current-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-current-dateTime) #[inline] pub fn now() -> Result { Ok(Self { @@ -58,43 +58,43 @@ impl DateTime { } } - /// [fn:year-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-year-from-dateTime) + /// [fn:year-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-year-from-dateTime) #[inline] pub fn year(&self) -> i64 { self.timestamp.year() } - /// [fn:month-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-month-from-dateTime) + /// [fn:month-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-month-from-dateTime) #[inline] pub fn month(&self) -> u8 { self.timestamp.month() } - /// [fn:day-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-day-from-dateTime) + /// [fn:day-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-day-from-dateTime) #[inline] pub fn day(&self) -> u8 { self.timestamp.day() } - /// [fn:hour-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-hour-from-dateTime) + /// [fn:hour-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-hours-from-dateTime) #[inline] pub fn hour(&self) -> u8 { self.timestamp.hour() } - /// [fn:minute-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-minute-from-dateTime) + /// [fn:minute-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-minutes-from-dateTime) #[inline] pub fn minute(&self) -> u8 { self.timestamp.minute() } - /// [fn:second-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-second-from-dateTime) + /// [fn:second-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-seconds-from-dateTime) #[inline] pub fn second(&self) -> Decimal { self.timestamp.second() } - /// [fn:timezone-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-timezone-from-dateTime) + /// [fn:timezone-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-timezone-from-dateTime) #[inline] pub fn timezone(&self) -> Option { Some(self.timezone_offset()?.into()) @@ -123,13 +123,13 @@ impl DateTime { self.timestamp.to_be_bytes() } - /// [op:subtract-dateTimes](https://www.w3.org/TR/xpath-functions/#func-subtract-dateTimes) + /// [op:subtract-dateTimes](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dateTimes) #[inline] pub fn checked_sub(&self, rhs: impl Into) -> Option { self.timestamp.checked_sub(rhs.into().timestamp) } - /// [op:add-yearMonthDuration-to-dateTime](https://www.w3.org/TR/xpath-functions/#func-add-yearMonthDuration-to-dateTime) + /// [op:add-yearMonthDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-dateTime) #[inline] pub fn checked_add_year_month_duration( &self, @@ -138,7 +138,7 @@ impl DateTime { self.checked_add_duration(Duration::from(rhs.into())) } - /// [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions/#func-add-dayTimeDuration-to-dateTime) + /// [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-dateTime) #[inline] pub fn checked_add_day_time_duration(&self, rhs: impl Into) -> Option { let rhs = rhs.into(); @@ -147,7 +147,7 @@ impl DateTime { }) } - /// [op:add-yearMonthDuration-to-dateTime](https://www.w3.org/TR/xpath-functions/#func-add-yearMonthDuration-to-dateTime) and [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions/#func-add-dayTimeDuration-to-dateTime) + /// [op:add-yearMonthDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-dateTime) and [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-dateTime) #[inline] pub fn checked_add_duration(&self, rhs: impl Into) -> Option { let rhs = rhs.into(); @@ -161,7 +161,7 @@ impl DateTime { } } - /// [op:subtract-yearMonthDuration-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-subtract-yearMonthDuration-from-dateTime) + /// [op:subtract-yearMonthDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-dateTime) #[inline] pub fn checked_sub_year_month_duration( &self, @@ -170,7 +170,7 @@ impl DateTime { self.checked_sub_duration(Duration::from(rhs.into())) } - /// [op:subtract-dayTimeDuration-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-subtract-dayTimeDuration-from-dateTime) + /// [op:subtract-dayTimeDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-dateTime) #[inline] pub fn checked_sub_day_time_duration(&self, rhs: impl Into) -> Option { let rhs = rhs.into(); @@ -179,7 +179,7 @@ impl DateTime { }) } - /// [op:subtract-yearMonthDuration-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-subtract-yearMonthDuration-from-dateTime) and [op:subtract-dayTimeDuration-from-dateTime](https://www.w3.org/TR/xpath-functions/#func-subtract-dayTimeDuration-from-dateTime) + /// [op:subtract-yearMonthDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-dateTime) and [op:subtract-dayTimeDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-dateTime) #[inline] pub fn checked_sub_duration(&self, rhs: impl Into) -> Option { let rhs = rhs.into(); @@ -196,7 +196,7 @@ impl DateTime { } } - /// [fn:adjust-dateTime-to-timezone](https://www.w3.org/TR/xpath-functions/#func-adjust-dateTime-to-timezone) + /// [fn:adjust-dateTime-to-timezone](https://www.w3.org/TR/xpath-functions-31/#func-adjust-dateTime-to-timezone) #[inline] pub fn adjust(&self, timezone_offset: Option) -> Option { Some(Self { @@ -211,7 +211,7 @@ impl DateTime { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for DateTime { type Error = DateTimeError; @@ -306,31 +306,31 @@ impl Time { } } - /// [fn:current-time](https://www.w3.org/TR/xpath-functions/#func-current-time) + /// [fn:current-time](https://www.w3.org/TR/xpath-functions-31/#func-current-time) #[inline] pub fn now() -> Result { DateTime::now()?.try_into() } - /// [fn:hour-from-time](https://www.w3.org/TR/xpath-functions/#func-hour-from-time) + /// [fn:hour-from-time](https://www.w3.org/TR/xpath-functions-31/#func-hours-from-time) #[inline] pub fn hour(&self) -> u8 { self.timestamp.hour() } - /// [fn:minute-from-time](https://www.w3.org/TR/xpath-functions/#func-minute-from-time) + /// [fn:minute-from-time](https://www.w3.org/TR/xpath-functions-31/#func-minutes-from-time) #[inline] pub fn minute(&self) -> u8 { self.timestamp.minute() } - /// [fn:second-from-time](https://www.w3.org/TR/xpath-functions/#func-second-from-time) + /// [fn:second-from-time](https://www.w3.org/TR/xpath-functions-31/#func-seconds-from-time) #[inline] pub fn second(&self) -> Decimal { self.timestamp.second() } - /// [fn:timezone-from-time](https://www.w3.org/TR/xpath-functions/#func-timezone-from-time) + /// [fn:timezone-from-time](https://www.w3.org/TR/xpath-functions-31/#func-timezone-from-time) #[inline] pub fn timezone(&self) -> Option { Some(self.timezone_offset()?.into()) @@ -346,19 +346,19 @@ impl Time { self.timestamp.to_be_bytes() } - /// [op:subtract-times](https://www.w3.org/TR/xpath-functions/#func-subtract-times) + /// [op:subtract-times](https://www.w3.org/TR/xpath-functions-31/#func-subtract-times) #[inline] pub fn checked_sub(&self, rhs: impl Into) -> Option { self.timestamp.checked_sub(rhs.into().timestamp) } - /// [op:add-dayTimeDuration-to-time](https://www.w3.org/TR/xpath-functions/#func-add-dayTimeDuration-to-time) + /// [op:add-dayTimeDuration-to-time](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-time) #[inline] pub fn checked_add_day_time_duration(&self, rhs: impl Into) -> Option { self.checked_add_duration(Duration::from(rhs.into())) } - /// [op:add-dayTimeDuration-to-time](https://www.w3.org/TR/xpath-functions/#func-add-dayTimeDuration-to-time) + /// [op:add-dayTimeDuration-to-time](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-time) #[inline] pub fn checked_add_duration(&self, rhs: impl Into) -> Option { DateTime::new( @@ -376,13 +376,13 @@ impl Time { .ok() } - /// [op:subtract-dayTimeDuration-from-time](https://www.w3.org/TR/xpath-functions/#func-subtract-dayTimeDuration-from-time) + /// [op:subtract-dayTimeDuration-from-time](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-time) #[inline] pub fn checked_sub_day_time_duration(&self, rhs: impl Into) -> Option { self.checked_sub_duration(Duration::from(rhs.into())) } - /// [op:subtract-dayTimeDuration-from-time](https://www.w3.org/TR/xpath-functions/#func-subtract-dayTimeDuration-from-time) + /// [op:subtract-dayTimeDuration-from-time](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-time) #[inline] pub fn checked_sub_duration(&self, rhs: impl Into) -> Option { DateTime::new( @@ -400,7 +400,7 @@ impl Time { .ok() } - // [fn:adjust-time-to-timezone](https://www.w3.org/TR/xpath-functions/#func-adjust-time-to-timezone) + // [fn:adjust-time-to-timezone](https://www.w3.org/TR/xpath-functions-31/#func-adjust-time-to-timezone) #[inline] pub fn adjust(&self, timezone_offset: Option) -> Option { DateTime::new( @@ -425,7 +425,7 @@ impl Time { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for Time { type Error = DateTimeError; @@ -507,31 +507,31 @@ impl Date { } } - /// [fn:current-date](https://www.w3.org/TR/xpath-functions/#func-current-date) + /// [fn:current-date](https://www.w3.org/TR/xpath-functions-31/#func-current-date) #[inline] pub fn now() -> Result { DateTime::now()?.try_into() } - /// [fn:year-from-date](https://www.w3.org/TR/xpath-functions/#func-year-from-date) + /// [fn:year-from-date](https://www.w3.org/TR/xpath-functions-31/#func-year-from-date) #[inline] pub fn year(&self) -> i64 { self.timestamp.year() } - /// [fn:month-from-date](https://www.w3.org/TR/xpath-functions/#func-month-from-date) + /// [fn:month-from-date](https://www.w3.org/TR/xpath-functions-31/#func-month-from-date) #[inline] pub fn month(&self) -> u8 { self.timestamp.month() } - /// [fn:day-from-date](https://www.w3.org/TR/xpath-functions/#func-day-from-date) + /// [fn:day-from-date](https://www.w3.org/TR/xpath-functions-31/#func-day-from-date) #[inline] pub fn day(&self) -> u8 { self.timestamp.day() } - /// [fn:timezone-from-date](https://www.w3.org/TR/xpath-functions/#func-timezone-from-date) + /// [fn:timezone-from-date](https://www.w3.org/TR/xpath-functions-31/#func-timezone-from-date) #[inline] pub fn timezone(&self) -> Option { Some(self.timezone_offset()?.into()) @@ -547,13 +547,13 @@ impl Date { self.timestamp.to_be_bytes() } - /// [op:subtract-dates](https://www.w3.org/TR/xpath-functions/#func-subtract-dates) + /// [op:subtract-dates](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dates) #[inline] pub fn checked_sub(&self, rhs: impl Into) -> Option { self.timestamp.checked_sub(rhs.into().timestamp) } - /// [op:add-yearMonthDuration-to-date](https://www.w3.org/TR/xpath-functions/#func-add-yearMonthDuration-to-date) + /// [op:add-yearMonthDuration-to-date](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-date) #[inline] pub fn checked_add_year_month_duration( &self, @@ -562,13 +562,13 @@ impl Date { self.checked_add_duration(Duration::from(rhs.into())) } - /// [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions/#func-add-dayTimeDuration-to-date) + /// [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-date) #[inline] pub fn checked_add_day_time_duration(&self, rhs: impl Into) -> Option { self.checked_add_duration(Duration::from(rhs.into())) } - /// [op:add-yearMonthDuration-to-date](https://www.w3.org/TR/xpath-functions/#func-add-yearMonthDuration-to-date) and [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions/#func-add-dayTimeDuration-to-date) + /// [op:add-yearMonthDuration-to-date](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-date) and [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-date) #[inline] pub fn checked_add_duration(&self, rhs: impl Into) -> Option { DateTime::try_from(*self) @@ -578,7 +578,7 @@ impl Date { .ok() } - /// [op:subtract-yearMonthDuration-from-date](https://www.w3.org/TR/xpath-functions/#func-subtract-yearMonthDuration-from-date) + /// [op:subtract-yearMonthDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-date) #[inline] pub fn checked_sub_year_month_duration( &self, @@ -587,13 +587,13 @@ impl Date { self.checked_sub_duration(Duration::from(rhs.into())) } - /// [op:subtract-dayTimeDuration-from-date](https://www.w3.org/TR/xpath-functions/#func-subtract-dayTimeDuration-from-date) + /// [op:subtract-dayTimeDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-date) #[inline] pub fn checked_sub_day_time_duration(&self, rhs: impl Into) -> Option { self.checked_sub_duration(Duration::from(rhs.into())) } - /// [op:subtract-yearMonthDuration-from-date](https://www.w3.org/TR/xpath-functions/#func-subtract-yearMonthDuration-from-date) and [op:subtract-dayTimeDuration-from-date](https://www.w3.org/TR/xpath-functions/#func-subtract-dayTimeDuration-from-date) + /// [op:subtract-yearMonthDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-date) and [op:subtract-dayTimeDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-date) #[inline] pub fn checked_sub_duration(&self, rhs: impl Into) -> Option { DateTime::try_from(*self) @@ -603,7 +603,7 @@ impl Date { .ok() } - // [fn:adjust-date-to-timezone](https://www.w3.org/TR/xpath-functions/#func-adjust-date-to-timezone) + // [fn:adjust-date-to-timezone](https://www.w3.org/TR/xpath-functions-31/#func-adjust-date-to-timezone) #[inline] pub fn adjust(&self, timezone_offset: Option) -> Option { DateTime::new( @@ -628,7 +628,7 @@ impl Date { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for Date { type Error = DateTimeError; @@ -741,7 +741,7 @@ impl GYearMonth { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for GYearMonth { type Error = DateTimeError; @@ -755,7 +755,7 @@ impl TryFrom for GYearMonth { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for GYearMonth { type Error = DateTimeError; @@ -857,7 +857,7 @@ impl GYear { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for GYear { type Error = DateTimeError; @@ -867,7 +867,7 @@ impl TryFrom for GYear { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for GYear { type Error = DateTimeError; @@ -984,7 +984,7 @@ impl GMonthDay { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for GMonthDay { type Error = DateTimeError; @@ -998,7 +998,7 @@ impl TryFrom for GMonthDay { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for GMonthDay { type Error = DateTimeError; @@ -1096,7 +1096,7 @@ impl GMonth { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for GMonth { type Error = DateTimeError; @@ -1106,7 +1106,7 @@ impl TryFrom for GMonth { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for GMonth { type Error = DateTimeError; @@ -1222,7 +1222,7 @@ impl GDay { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for GDay { type Error = DateTimeError; @@ -1232,7 +1232,7 @@ impl TryFrom for GDay { } } -/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions/#casting-to-datetimes). +/// Conversion according to [XPath cast rules](https://www.w3.org/TR/xpath-functions-31/#casting-to-datetimes). impl TryFrom for GDay { type Error = DateTimeError; diff --git a/lib/oxsdatatypes/src/decimal.rs b/lib/oxsdatatypes/src/decimal.rs index 11065901..19d93fed 100644 --- a/lib/oxsdatatypes/src/decimal.rs +++ b/lib/oxsdatatypes/src/decimal.rs @@ -45,7 +45,7 @@ impl Decimal { self.value.to_be_bytes() } - /// [op:numeric-add](https://www.w3.org/TR/xpath-functions/#func-numeric-add) + /// [op:numeric-add](https://www.w3.org/TR/xpath-functions-31/#func-numeric-add) #[inline] pub fn checked_add(&self, rhs: impl Into) -> Option { Some(Self { @@ -53,7 +53,7 @@ impl Decimal { }) } - /// [op:numeric-subtract](https://www.w3.org/TR/xpath-functions/#func-numeric-subtract) + /// [op:numeric-subtract](https://www.w3.org/TR/xpath-functions-31/#func-numeric-subtract) #[inline] pub fn checked_sub(&self, rhs: impl Into) -> Option { Some(Self { @@ -61,7 +61,7 @@ impl Decimal { }) } - /// [op:numeric-multiply](https://www.w3.org/TR/xpath-functions/#func-numeric-multiply) + /// [op:numeric-multiply](https://www.w3.org/TR/xpath-functions-31/#func-numeric-multiply) #[inline] pub fn checked_mul(&self, rhs: impl Into) -> Option { // Idea: we shift right as much as possible to keep as much precision as possible @@ -93,7 +93,7 @@ impl Decimal { }) } - /// [op:numeric-divide](https://www.w3.org/TR/xpath-functions/#func-numeric-divide) + /// [op:numeric-divide](https://www.w3.org/TR/xpath-functions-31/#func-numeric-divide) #[inline] pub fn checked_div(&self, rhs: impl Into) -> Option { // Idea: we shift the dividend left as much as possible to keep as much precision as possible @@ -126,7 +126,7 @@ impl Decimal { }) } - /// [op:numeric-mod](https://www.w3.org/TR/xpath-functions/#func-numeric-mod) + /// [op:numeric-mod](https://www.w3.org/TR/xpath-functions-31/#func-numeric-mod) #[inline] pub fn checked_rem(&self, rhs: impl Into) -> Option { Some(Self { @@ -141,7 +141,7 @@ impl Decimal { }) } - /// [op:numeric-unary-minus](https://www.w3.org/TR/xpath-functions/#func-numeric-unary-minus) + /// [op:numeric-unary-minus](https://www.w3.org/TR/xpath-functions-31/#func-numeric-unary-minus) #[inline] pub fn checked_neg(&self) -> Option { Some(Self { @@ -149,7 +149,7 @@ impl Decimal { }) } - /// [fn:abs](https://www.w3.org/TR/xpath-functions/#func-abs) + /// [fn:abs](https://www.w3.org/TR/xpath-functions-31/#func-abs) #[inline] pub const fn abs(&self) -> Self { Self { @@ -157,7 +157,7 @@ impl Decimal { } } - /// [fn:round](https://www.w3.org/TR/xpath-functions/#func-round) + /// [fn:round](https://www.w3.org/TR/xpath-functions-31/#func-round) #[inline] pub fn round(&self) -> Self { let value = self.value / DECIMAL_PART_POW_MINUS_ONE; @@ -170,7 +170,7 @@ impl Decimal { } } - /// [fn:ceiling](https://www.w3.org/TR/xpath-functions/#func-ceiling) + /// [fn:ceiling](https://www.w3.org/TR/xpath-functions-31/#func-ceiling) #[inline] pub fn ceil(&self) -> Self { Self { @@ -182,7 +182,7 @@ impl Decimal { } } - /// [fn:floor](https://www.w3.org/TR/xpath-functions/#func-floor) + /// [fn:floor](https://www.w3.org/TR/xpath-functions-31/#func-floor) #[inline] pub fn floor(&self) -> Self { Self { diff --git a/lib/oxsdatatypes/src/double.rs b/lib/oxsdatatypes/src/double.rs index e9b26ba5..b1465c9e 100644 --- a/lib/oxsdatatypes/src/double.rs +++ b/lib/oxsdatatypes/src/double.rs @@ -29,25 +29,25 @@ impl Double { self.value.to_be_bytes() } - /// [fn:abs](https://www.w3.org/TR/xpath-functions/#func-abs) + /// [fn:abs](https://www.w3.org/TR/xpath-functions-31/#func-abs) #[inline] pub fn abs(self) -> Self { self.value.abs().into() } - /// [fn:ceiling](https://www.w3.org/TR/xpath-functions/#func-ceiling) + /// [fn:ceiling](https://www.w3.org/TR/xpath-functions-31/#func-ceiling) #[inline] pub fn ceil(self) -> Self { self.value.ceil().into() } - /// [fn:floor](https://www.w3.org/TR/xpath-functions/#func-floor) + /// [fn:floor](https://www.w3.org/TR/xpath-functions-31/#func-floor) #[inline] pub fn floor(self) -> Self { self.value.floor().into() } - /// [fn:round](https://www.w3.org/TR/xpath-functions/#func-round) + /// [fn:round](https://www.w3.org/TR/xpath-functions-31/#func-round) #[inline] pub fn round(self) -> Self { self.value.round().into() diff --git a/lib/oxsdatatypes/src/duration.rs b/lib/oxsdatatypes/src/duration.rs index a2d6ac47..11ed0c1d 100644 --- a/lib/oxsdatatypes/src/duration.rs +++ b/lib/oxsdatatypes/src/duration.rs @@ -33,37 +33,37 @@ impl Duration { } } - /// [fn:years-from-duration](https://www.w3.org/TR/xpath-functions/#func-years-from-duration) + /// [fn:years-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-years-from-duration) #[inline] pub fn years(&self) -> i64 { self.year_month.years() } - /// [fn:months-from-duration](https://www.w3.org/TR/xpath-functions/#func-months-from-duration) + /// [fn:months-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-months-from-duration) #[inline] pub fn months(&self) -> i64 { self.year_month.months() } - /// [fn:days-from-duration](https://www.w3.org/TR/xpath-functions/#func-days-from-duration) + /// [fn:days-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-days-from-duration) #[inline] pub fn days(&self) -> i64 { self.day_time.days() } - /// [fn:hours-from-duration](https://www.w3.org/TR/xpath-functions/#func-hours-from-duration) + /// [fn:hours-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-hours-from-duration) #[inline] pub fn hours(&self) -> i64 { self.day_time.hours() } - /// [fn:minutes-from-duration](https://www.w3.org/TR/xpath-functions/#func-minutes-from-duration) + /// [fn:minutes-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-minutes-from-duration) #[inline] pub fn minutes(&self) -> i64 { self.day_time.minutes() } - /// [fn:seconds-from-duration](https://www.w3.org/TR/xpath-functions/#func-seconds-from-duration) + /// [fn:seconds-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-seconds-from-duration) #[inline] pub fn seconds(&self) -> Decimal { self.day_time.seconds() @@ -87,7 +87,7 @@ impl Duration { bytes } - /// [op:add-yearMonthDurations](https://www.w3.org/TR/xpath-functions/#func-add-yearMonthDurations) and [op:add-dayTimeDurations](https://www.w3.org/TR/xpath-functions/#func-add-dayTimeDurations) + /// [op:add-yearMonthDurations](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDurations) and [op:add-dayTimeDurations](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDurations) #[inline] pub fn checked_add(&self, rhs: impl Into) -> Option { let rhs = rhs.into(); @@ -97,7 +97,7 @@ impl Duration { }) } - /// [op:subtract-yearMonthDurations](https://www.w3.org/TR/xpath-functions/#func-subtract-yearMonthDurations) and [op:subtract-dayTimeDurations](https://www.w3.org/TR/xpath-functions/#func-subtract-dayTimeDurations) + /// [op:subtract-yearMonthDurations](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDurations) and [op:subtract-dayTimeDurations](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDurations) #[inline] pub fn checked_sub(&self, rhs: impl Into) -> Option { let rhs = rhs.into(); @@ -269,13 +269,13 @@ impl YearMonthDuration { } } - /// [fn:years-from-duration](https://www.w3.org/TR/xpath-functions/#func-years-from-duration) + /// [fn:years-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-years-from-duration) #[inline] pub fn years(self) -> i64 { self.months / 12 } - /// [fn:months-from-duration](https://www.w3.org/TR/xpath-functions/#func-months-from-duration) + /// [fn:months-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-months-from-duration) #[inline] pub fn months(self) -> i64 { self.months % 12 @@ -291,7 +291,7 @@ impl YearMonthDuration { self.months.to_be_bytes() } - /// [op:add-yearMonthDurations](https://www.w3.org/TR/xpath-functions/#func-add-yearMonthDurations) + /// [op:add-yearMonthDurations](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDurations) #[inline] pub fn checked_add(self, rhs: impl Into) -> Option { let rhs = rhs.into(); @@ -300,7 +300,7 @@ impl YearMonthDuration { }) } - /// [op:subtract-yearMonthDurations](https://www.w3.org/TR/xpath-functions/#func-subtract-yearMonthDurations) + /// [op:subtract-yearMonthDurations](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDurations) #[inline] pub fn checked_sub(self, rhs: impl Into) -> Option { let rhs = rhs.into(); @@ -427,28 +427,28 @@ impl DayTimeDuration { } } - /// [fn:days-from-duration](https://www.w3.org/TR/xpath-functions/#func-days-from-duration) + /// [fn:days-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-days-from-duration) #[allow(clippy::cast_possible_truncation)] #[inline] pub fn days(&self) -> i64 { (self.seconds.as_i128() / 86400) as i64 } - /// [fn:hours-from-duration](https://www.w3.org/TR/xpath-functions/#func-hours-from-duration) + /// [fn:hours-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-hours-from-duration) #[allow(clippy::cast_possible_truncation)] #[inline] pub fn hours(&self) -> i64 { ((self.seconds.as_i128() % 86400) / 3600) as i64 } - /// [fn:minutes-from-duration](https://www.w3.org/TR/xpath-functions/#func-minutes-from-duration) + /// [fn:minutes-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-minutes-from-duration) #[allow(clippy::cast_possible_truncation)] #[inline] pub fn minutes(&self) -> i64 { ((self.seconds.as_i128() % 3600) / 60) as i64 } - /// [fn:seconds-from-duration](https://www.w3.org/TR/xpath-functions/#func-seconds-from-duration) + /// [fn:seconds-from-duration](https://www.w3.org/TR/xpath-functions-31/#func-seconds-from-duration) #[inline] pub fn seconds(&self) -> Decimal { self.seconds.checked_rem(60).unwrap() @@ -464,7 +464,7 @@ impl DayTimeDuration { self.seconds.to_be_bytes() } - /// [op:add-dayTimeDurations](https://www.w3.org/TR/xpath-functions/#func-add-dayTimeDurations) + /// [op:add-dayTimeDurations](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDurations) #[inline] pub fn checked_add(&self, rhs: impl Into) -> Option { let rhs = rhs.into(); @@ -473,7 +473,7 @@ impl DayTimeDuration { }) } - /// [op:subtract-dayTimeDurations](https://www.w3.org/TR/xpath-functions/#func-subtract-dayTimeDurations) + /// [op:subtract-dayTimeDurations](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDurations) #[inline] pub fn checked_sub(&self, rhs: impl Into) -> Option { let rhs = rhs.into(); diff --git a/lib/oxsdatatypes/src/float.rs b/lib/oxsdatatypes/src/float.rs index 29ebde30..7f7b979b 100644 --- a/lib/oxsdatatypes/src/float.rs +++ b/lib/oxsdatatypes/src/float.rs @@ -29,25 +29,25 @@ impl Float { self.value.to_be_bytes() } - /// [fn:abs](https://www.w3.org/TR/xpath-functions/#func-abs) + /// [fn:abs](https://www.w3.org/TR/xpath-functions-31/#func-abs) #[inline] pub fn abs(self) -> Self { self.value.abs().into() } - /// [fn:ceiling](https://www.w3.org/TR/xpath-functions/#func-ceiling) + /// [fn:ceiling](https://www.w3.org/TR/xpath-functions-31/#func-ceiling) #[inline] pub fn ceil(self) -> Self { self.value.ceil().into() } - /// [fn:floor](https://www.w3.org/TR/xpath-functions/#func-floor) + /// [fn:floor](https://www.w3.org/TR/xpath-functions-31/#func-floor) #[inline] pub fn floor(self) -> Self { self.value.floor().into() } - /// [fn:round](https://www.w3.org/TR/xpath-functions/#func-round) + /// [fn:round](https://www.w3.org/TR/xpath-functions-31/#func-round) #[inline] pub fn round(self) -> Self { self.value.round().into() diff --git a/lib/oxsdatatypes/src/integer.rs b/lib/oxsdatatypes/src/integer.rs index 0c9d90e5..d3b5fbc9 100644 --- a/lib/oxsdatatypes/src/integer.rs +++ b/lib/oxsdatatypes/src/integer.rs @@ -26,7 +26,7 @@ impl Integer { self.value.to_be_bytes() } - /// [op:numeric-add](https://www.w3.org/TR/xpath-functions/#func-numeric-add) + /// [op:numeric-add](https://www.w3.org/TR/xpath-functions-31/#func-numeric-add) #[inline] pub fn checked_add(&self, rhs: impl Into) -> Option { Some(Self { @@ -34,7 +34,7 @@ impl Integer { }) } - /// [op:numeric-subtract](https://www.w3.org/TR/xpath-functions/#func-numeric-subtract) + /// [op:numeric-subtract](https://www.w3.org/TR/xpath-functions-31/#func-numeric-subtract) #[inline] pub fn checked_sub(&self, rhs: impl Into) -> Option { Some(Self { @@ -42,7 +42,7 @@ impl Integer { }) } - /// [op:numeric-multiply](https://www.w3.org/TR/xpath-functions/#func-numeric-multiply) + /// [op:numeric-multiply](https://www.w3.org/TR/xpath-functions-31/#func-numeric-multiply) #[inline] pub fn checked_mul(&self, rhs: impl Into) -> Option { Some(Self { @@ -50,7 +50,7 @@ impl Integer { }) } - /// [op:numeric-divide](https://www.w3.org/TR/xpath-functions/#func-numeric-divide) + /// [op:numeric-divide](https://www.w3.org/TR/xpath-functions-31/#func-numeric-divide) #[inline] pub fn checked_div(&self, rhs: impl Into) -> Option { Some(Self { @@ -58,7 +58,7 @@ impl Integer { }) } - /// [op:numeric-mod](https://www.w3.org/TR/xpath-functions/#func-numeric-mod) + /// [op:numeric-mod](https://www.w3.org/TR/xpath-functions-31/#func-numeric-mod) #[inline] pub fn checked_rem(&self, rhs: impl Into) -> Option { Some(Self { @@ -73,7 +73,7 @@ impl Integer { }) } - /// [op:numeric-unary-minus](https://www.w3.org/TR/xpath-functions/#func-numeric-unary-minus) + /// [op:numeric-unary-minus](https://www.w3.org/TR/xpath-functions-31/#func-numeric-unary-minus) #[inline] pub fn checked_neg(&self) -> Option { Some(Self { @@ -81,7 +81,7 @@ impl Integer { }) } - /// [fn:abs](https://www.w3.org/TR/xpath-functions/#func-abs) + /// [fn:abs](https://www.w3.org/TR/xpath-functions-31/#func-abs) #[inline] pub const fn abs(&self) -> Self { Self { diff --git a/lib/sparesults/README.md b/lib/sparesults/README.md index 8cf6c3c7..73ccea36 100644 --- a/lib/sparesults/README.md +++ b/lib/sparesults/README.md @@ -9,9 +9,9 @@ Sparesults Sparesults is a set of parsers and serializers for [SPARQL](https://www.w3.org/TR/sparql11-overview/) query results formats. -It supports [SPARQL Query Results XML Format (Second Edition)](http://www.w3.org/TR/rdf-sparql-XMLres/), [SPARQL 1.1 Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) and [SPARQL 1.1 Query Results CSV and TSV Formats](https://www.w3.org/TR/2013/REC-sparql11-results-csv-tsv-20130321/). +It supports [SPARQL Query Results XML Format (Second Edition)](https://www.w3.org/TR/rdf-sparql-XMLres/), [SPARQL 1.1 Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) and [SPARQL 1.1 Query Results CSV and TSV Formats](https://www.w3.org/TR/sparql11-results-csv-tsv/). -Support for [SPARQL-star](https://w3c.github.io/rdf-star/cg-spec/#query-result-formats) is also available behind the `rdf-star` feature. +Support for [SPARQL-star](https://w3c.github.io/rdf-star/cg-spec/2021-12-17.html#query-result-formats) is also available behind the `rdf-star` feature. This crate is intended to be a building piece for SPARQL client and server implementations in Rust like [Oxigraph](https://oxigraph.org). diff --git a/lib/sparesults/src/lib.rs b/lib/sparesults/src/lib.rs index b30c17f0..6229072e 100644 --- a/lib/sparesults/src/lib.rs +++ b/lib/sparesults/src/lib.rs @@ -23,7 +23,7 @@ use std::rc::Rc; #[derive(Eq, PartialEq, Debug, Clone, Copy, Hash)] #[non_exhaustive] pub enum QueryResultsFormat { - /// [SPARQL Query Results XML Format](http://www.w3.org/TR/rdf-sparql-XMLres/) + /// [SPARQL Query Results XML Format](https://www.w3.org/TR/rdf-sparql-XMLres/) Xml, /// [SPARQL Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) Json, @@ -133,7 +133,7 @@ impl QueryResultsFormat { /// Parsers for [SPARQL query](https://www.w3.org/TR/sparql11-query/) results serialization formats. /// /// It currently supports the following formats: -/// * [SPARQL Query Results XML Format](http://www.w3.org/TR/rdf-sparql-XMLres/) ([`QueryResultsFormat::Xml`](QueryResultsFormat::Xml)). +/// * [SPARQL Query Results XML Format](https://www.w3.org/TR/rdf-sparql-XMLres/) ([`QueryResultsFormat::Xml`](QueryResultsFormat::Xml)). /// * [SPARQL Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) ([`QueryResultsFormat::Json`](QueryResultsFormat::Json)). /// * [SPARQL Query Results TSV Format](https://www.w3.org/TR/sparql11-results-csv-tsv/) ([`QueryResultsFormat::Tsv`](QueryResultsFormat::Tsv)). /// @@ -326,7 +326,7 @@ impl Iterator for SolutionsReader { /// A serializer for [SPARQL query](https://www.w3.org/TR/sparql11-query/) results serialization formats. /// /// It currently supports the following formats: -/// * [SPARQL Query Results XML Format](http://www.w3.org/TR/rdf-sparql-XMLres/) ([`QueryResultsFormat::Xml`](QueryResultsFormat::Xml)) +/// * [SPARQL Query Results XML Format](https://www.w3.org/TR/rdf-sparql-XMLres/) ([`QueryResultsFormat::Xml`](QueryResultsFormat::Xml)) /// * [SPARQL Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) ([`QueryResultsFormat::Json`](QueryResultsFormat::Json)) /// * [SPARQL Query Results CSV Format](https://www.w3.org/TR/sparql11-results-csv-tsv/) ([`QueryResultsFormat::Csv`](QueryResultsFormat::Csv)) /// * [SPARQL Query Results TSV Format](https://www.w3.org/TR/sparql11-results-csv-tsv/) ([`QueryResultsFormat::Tsv`](QueryResultsFormat::Tsv)) diff --git a/lib/sparesults/src/xml.rs b/lib/sparesults/src/xml.rs index d4973fdf..dbc17242 100644 --- a/lib/sparesults/src/xml.rs +++ b/lib/sparesults/src/xml.rs @@ -1,4 +1,4 @@ -//! Implementation of [SPARQL Query Results XML Format](http://www.w3.org/TR/rdf-sparql-XMLres/) +//! Implementation of [SPARQL Query Results XML Format](https://www.w3.org/TR/rdf-sparql-XMLres/) use crate::error::{ParseError, SyntaxError}; use oxrdf::vocab::rdf; diff --git a/lib/spargebra/README.md b/lib/spargebra/README.md index b2783605..275fb5f0 100644 --- a/lib/spargebra/README.md +++ b/lib/spargebra/README.md @@ -15,7 +15,7 @@ The emitted tree is based on [SPARQL 1.1 Query Algebra](https://www.w3.org/TR/sp The API entry point for SPARQL queries is the [`Query`] struct and the API entry point for SPARQL updates is the [`Update`] struct. -Support for [SPARQL-star](https://w3c.github.io/rdf-star/cg-spec/#sparql-star) is also available behind the `rdf-star` feature. +Support for [SPARQL-star](https://w3c.github.io/rdf-star/cg-spec/2021-12-17.html#sparql-star) is also available behind the `rdf-star` feature. This crate is intended to be a building piece for SPARQL implementations in Rust like [Oxigraph](https://oxigraph.org). diff --git a/lib/spargebra/src/algebra.rs b/lib/spargebra/src/algebra.rs index e3dcbeb3..d694ba53 100644 --- a/lib/spargebra/src/algebra.rs +++ b/lib/spargebra/src/algebra.rs @@ -111,27 +111,27 @@ pub enum Expression { Equal(Box, Box), /// [sameTerm](https://www.w3.org/TR/sparql11-query/#func-sameTerm). SameTerm(Box, Box), - /// [op:numeric-greater-than](https://www.w3.org/TR/xpath-functions/#func-numeric-greater-than) and other XSD greater than operators. + /// [op:numeric-greater-than](https://www.w3.org/TR/xpath-functions-31/#func-numeric-greater-than) and other XSD greater than operators. Greater(Box, Box), GreaterOrEqual(Box, Box), - /// [op:numeric-less-than](https://www.w3.org/TR/xpath-functions/#func-numeric-less-than) and other XSD greater than operators. + /// [op:numeric-less-than](https://www.w3.org/TR/xpath-functions-31/#func-numeric-less-than) and other XSD greater than operators. Less(Box, Box), LessOrEqual(Box, Box), /// [IN](https://www.w3.org/TR/sparql11-query/#func-in) In(Box, Vec), - /// [op:numeric-add](https://www.w3.org/TR/xpath-functions/#func-numeric-add) and other XSD additions. + /// [op:numeric-add](https://www.w3.org/TR/xpath-functions-31/#func-numeric-add) and other XSD additions. Add(Box, Box), - /// [op:numeric-subtract](https://www.w3.org/TR/xpath-functions/#func-numeric-subtract) and other XSD subtractions. + /// [op:numeric-subtract](https://www.w3.org/TR/xpath-functions-31/#func-numeric-subtract) and other XSD subtractions. Subtract(Box, Box), - /// [op:numeric-multiply](https://www.w3.org/TR/xpath-functions/#func-numeric-multiply) and other XSD multiplications. + /// [op:numeric-multiply](https://www.w3.org/TR/xpath-functions-31/#func-numeric-multiply) and other XSD multiplications. Multiply(Box, Box), - /// [op:numeric-divide](https://www.w3.org/TR/xpath-functions/#func-numeric-divide) and other XSD divides. + /// [op:numeric-divide](https://www.w3.org/TR/xpath-functions-31/#func-numeric-divide) and other XSD divides. Divide(Box, Box), - /// [op:numeric-unary-plus](https://www.w3.org/TR/xpath-functions/#func-numeric-unary-plus) and other XSD unary plus. + /// [op:numeric-unary-plus](https://www.w3.org/TR/xpath-functions-31/#func-numeric-unary-plus) and other XSD unary plus. UnaryPlus(Box), - /// [op:numeric-unary-minus](https://www.w3.org/TR/xpath-functions/#func-numeric-unary-minus) and other XSD unary minus. + /// [op:numeric-unary-minus](https://www.w3.org/TR/xpath-functions-31/#func-numeric-unary-minus) and other XSD unary minus. UnaryMinus(Box), - /// [fn:not](https://www.w3.org/TR/xpath-functions/#func-not). + /// [fn:not](https://www.w3.org/TR/xpath-functions-31/#func-not). Not(Box), /// [EXISTS](https://www.w3.org/TR/sparql11-query/#func-filter-exists). Exists(Box), @@ -577,7 +577,7 @@ pub enum GraphPattern { start: usize, length: Option, }, - /// [Group](https://www.w3.org/TR/sparql11-federated-query/#aggregateAlgebra). + /// [Group](https://www.w3.org/TR/sparql11-query/#aggregateAlgebra). Group { inner: Box, variables: Vec, diff --git a/lib/src/io/format.rs b/lib/src/io/format.rs index 67d7b8d5..7c95ddcb 100644 --- a/lib/src/io/format.rs +++ b/lib/src/io/format.rs @@ -1,4 +1,4 @@ -/// [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-graph) serialization formats. +/// [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-graph) serialization formats. /// /// This enumeration is non exhaustive. New formats like JSON-LD will be added in the future. #[derive(Eq, PartialEq, Debug, Clone, Copy, Hash)] diff --git a/server/README.md b/server/README.md index 6bcf92b4..851d7521 100644 --- a/server/README.md +++ b/server/README.md @@ -27,7 +27,7 @@ It is also usable as [a Rust library](https://crates.io/crates/oxigraph) and as Oxigraph implements the following specifications: * [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/), [SPARQL 1.1 Update](https://www.w3.org/TR/sparql11-update/), and [SPARQL 1.1 Federated Query](https://www.w3.org/TR/sparql11-federated-query/). * [Turtle](https://www.w3.org/TR/turtle/), [TriG](https://www.w3.org/TR/trig/), [N-Triples](https://www.w3.org/TR/n-triples/), [N-Quads](https://www.w3.org/TR/n-quads/), and [RDF XML](https://www.w3.org/TR/rdf-syntax-grammar/) RDF serialization formats for both data ingestion and retrieval using the [Rio library](https://github.com/oxigraph/rio). -* [SPARQL Query Results XML Format](http://www.w3.org/TR/rdf-sparql-XMLres/), [SPARQL 1.1 Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) and [SPARQL 1.1 Query Results CSV and TSV Formats](https://www.w3.org/TR/sparql11-results-csv-tsv/). +* [SPARQL Query Results XML Format](https://www.w3.org/TR/rdf-sparql-XMLres/), [SPARQL 1.1 Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/) and [SPARQL 1.1 Query Results CSV and TSV Formats](https://www.w3.org/TR/sparql11-results-csv-tsv/). * [SPARQL 1.1 Protocol](https://www.w3.org/TR/sparql11-protocol/#query-operation) and [SPARQL 1.1 Graph Store HTTP Protocol](https://www.w3.org/TR/sparql11-http-rdf-update/). A preliminary benchmark [is provided](../bench/README.md). @@ -55,7 +55,7 @@ It provides the following REST actions: curl -X POST -H 'Content-Type:application/sparql-query' \ --data 'SELECT * WHERE { ?s ?p ?o } LIMIT 10' http://localhost:7878/query ``` - This action supports content negotiation and could return [Turtle](https://www.w3.org/TR/turtle/), [N-Triples](https://www.w3.org/TR/n-triples/), [RDF XML](https://www.w3.org/TR/rdf-syntax-grammar/), [SPARQL Query Results XML Format](http://www.w3.org/TR/rdf-sparql-XMLres/) and [SPARQL Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/). + This action supports content negotiation and could return [Turtle](https://www.w3.org/TR/turtle/), [N-Triples](https://www.w3.org/TR/n-triples/), [RDF XML](https://www.w3.org/TR/rdf-syntax-grammar/), [SPARQL Query Results XML Format](https://www.w3.org/TR/rdf-sparql-XMLres/) and [SPARQL Query Results JSON Format](https://www.w3.org/TR/sparql11-results-json/). * `/update` allows to execute SPARQL updates against the server repository following the [SPARQL 1.1 Protocol](https://www.w3.org/TR/sparql11-protocol/#update-operation). For example: ```sh @@ -244,7 +244,7 @@ WantedBy=multi-user.target ### From 0.2 to 0.3 * The cli API has been completely rewritten. To start the server run `oxigraph_server serve --location MY_STORAGE` instead of `oxigraph_server --file MY_STORAGE`. * Fast data bulk loading is not supported using `oxigraph_server load --location MY_STORAGE --file MY_FILE`. The file format is guessed from the extension (`.nt`, `.ttl`, `.nq`...). -* [RDF-star](https://w3c.github.io/rdf-star/cg-spec) is now implemented. +* [RDF-star](https://w3c.github.io/rdf-star/cg-spec/2021-12-17.html) is now implemented. * All operations are now transactional using the "repeatable read" isolation level: the store only exposes changes that have been "committed" (i.e. no partial writes) and the exposed state does not change for the complete duration of a read operation (e.g. a SPARQL query) or a read/write operation (e.g. a SPARQL update). diff --git a/test_spec_links.py b/test_spec_links.py new file mode 100644 index 00000000..bfc156e0 --- /dev/null +++ b/test_spec_links.py @@ -0,0 +1,57 @@ +import re +import sys +from pathlib import Path +from urllib.error import HTTPError +from urllib.parse import urlsplit, urlunsplit +from urllib.request import urlopen + +LINK_REGEXES = { + r"\[[^]]+]\((https?://(w3c.github.io|www.w3.org)/[^)]+)\)", # Markdown + r"<(https?://(w3c.github.io|www.w3.org)/[^>]+)>`_", # reStructuredText +} + +base_path = Path(__file__).parent +spec_cache = {} +errors = set() + +for ext in ("md", "rs"): + for file in Path(__file__).parent.rglob(f"*.{ext}"): + content = file.read_text() + for link_regex in LINK_REGEXES: + for m in re.finditer(link_regex, content): + url = m.group(1) + (scheme, host, path, query, fragment) = urlsplit(url) + if scheme != "https": + errors.add(f"HTTP URL used by {url} in {file}") + if query != "": + errors.add(f"URL query used by {url} in {file}") + if path.endswith(".html/"): + errors.add(f".html/ used by {url} in {file}") + base_url = urlunsplit(("https", host, path.rstrip("/"), "", "")) + if base_url not in spec_cache: + try: + with urlopen(base_url) as response: + spec_cache[base_url] = response.read().decode() + except HTTPError as e: + errors.add( + f"Fetching {url} used in {file} return HTTP error: {e}" + ) + spec_content = spec_cache.get(base_url, "") + if ( + fragment != "" + and re.search(rf"[iI][dD]\s*=\s*['\"]{fragment}['\"]", spec_content) + is None + ): + errors.add( + f"Fragment {fragment} of {url} used in {file} does not exist" + ) + +print("Used specs:") +for url in sorted(spec_cache.keys()): + print(url) + +if errors: + print() + for error in sorted(errors): + print(error, file=sys.stderr) + exit(1)