From b5de88d72585932bd1dc7f8f03a9f6712de3d2d0 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Mon, 8 Jan 2024 10:34:43 +0100 Subject: [PATCH] bump versions --- CHANGELOG.txt | 11 ++ Cargo.toml | 24 ++-- book/src/ch01_getting_started.md | 2 +- book/src/ch02_rdf_terms.md | 54 ++++---- book/src/ch03_rdf_statements.md | 30 ++--- book/src/ch04_rdf_graphs.md | 52 ++++---- book/src/ch90_changes_since_07.md | 10 +- indexed/Cargo.toml | 19 --- indexed/src/dataset.rs | 165 ------------------------- indexed/src/graph.rs | 196 ------------------------------ indexed/src/lib.rs | 11 -- jsonld/Cargo.toml | 10 +- sophia_doap.ttl | 6 +- 13 files changed, 107 insertions(+), 483 deletions(-) delete mode 100644 indexed/Cargo.toml delete mode 100644 indexed/src/dataset.rs delete mode 100644 indexed/src/graph.rs delete mode 100644 indexed/src/lib.rs diff --git a/CHANGELOG.txt b/CHANGELOG.txt index fd35e9bb..f5ea39cf 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,14 @@ +0.8.0 + New features + - long awaited "big refactoring": + new traits use GATs (Generic Associated Types) + - JSON-LD parser and serializer + - RDF-canon implementation + - experimental resource centric API + Documentation + - more content in the book + (although there is still much to add) + 0.7.2 Bug fixes - update dependency on oxiri to fix build issue diff --git a/Cargo.toml b/Cargo.toml index 7fd02e55..5f02f1ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ members = [ resolver = "2" [workspace.package] -version = "0.8.0-alpha.3" +version = "0.8.0" authors = ["Pierre-Antoine Champin "] edition = "2021" repository = "https://github.com/pchampin/sophia_rs" @@ -27,17 +27,17 @@ keywords = ["rdf", "linked-data", "semantic-web", "w3c"] # no more than 5 [workspace.dependencies] -sophia_api = { version = "0.8.0-alpha.3", path = "./api" } -sophia_c14n = { version = "0.8.0-alpha.3", path = "./c14n" } -sophia_inmem = { version = "0.8.0-alpha.3", path = "./inmem" } -sophia_iri = { version = "0.8.0-alpha.3", path = "./iri" } -sophia_isomorphism = { version = "0.8.0-alpha.3", path = "./isomorphism" } -sophia_jsonld = { version = "0.8.0-alpha.3", path = "./jsonld" } -sophia_resource = { version = "0.8.0-alpha.3", path = "./resource" } -sophia_rio = { version = "0.8.0-alpha.3", path = "./rio" } -sophia_term = { version = "0.8.0-alpha.3", path = "./term" } -sophia_turtle = { version = "0.8.0-alpha.3", path = "./turtle" } -sophia_xml = { version = "0.8.0-alpha.3", path = "./xml" } +sophia_api = { version = "0.8.0", path = "./api" } +sophia_c14n = { version = "0.8.0", path = "./c14n" } +sophia_inmem = { version = "0.8.0", path = "./inmem" } +sophia_iri = { version = "0.8.0", path = "./iri" } +sophia_isomorphism = { version = "0.8.0", path = "./isomorphism" } +sophia_jsonld = { version = "0.8.0", path = "./jsonld" } +sophia_resource = { version = "0.8.0", path = "./resource" } +sophia_rio = { version = "0.8.0", path = "./rio" } +sophia_term = { version = "0.8.0", path = "./term" } +sophia_turtle = { version = "0.8.0", path = "./turtle" } +sophia_xml = { version = "0.8.0", path = "./xml" } criterion = "0.5" futures-util = "0.3.28" diff --git a/book/src/ch01_getting_started.md b/book/src/ch01_getting_started.md index d780753d..67669eee 100644 --- a/book/src/ch01_getting_started.md +++ b/book/src/ch01_getting_started.md @@ -6,7 +6,7 @@ Below is a short example demonstrating how to build a graph, mutate it and seria Add the sophia crate to your dependencies in `Cargo.toml` ```bash [dependencies] -sophia = "0.8.0-alpha.3" +sophia = "0.8.0" ``` diff --git a/book/src/ch02_rdf_terms.md b/book/src/ch02_rdf_terms.md index 1a05f5ce..fd6da5cb 100644 --- a/book/src/ch02_rdf_terms.md +++ b/book/src/ch02_rdf_terms.md @@ -149,31 +149,31 @@ IRIs can be *relative* IRI reference. [^variables]: Note that this kind only exist in Sophia's [generalized RDF] model. -[`Term`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html +[`Term`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html [RDF terms]: https://www.w3.org/TR/rdf-concepts/#dfn-rdf-term [generalized RDF]: ch00_introduction.html#generalized -[`TermKind`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/enum.TermKind.html -[`Term::kind`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#tymethod.kind -[`Term::is_iri`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.is_iri -[`Term::is_blank_node`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.is_blank_node -[`Term::is_literal`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.is_literal -[`Term::iri`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.iri -[`Term::bnode_id`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.bnode_id -[`Term::bnode_id`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.bnode_id -[`Term::bnode_id`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.bnode_id -[`Term::lexical_form`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.lexical_form -[`Term::datatype`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.datatype -[`Term::language_tag`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.language_tag -[`Term::triple`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.triple -[`Term::constituents`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.constituents -[`Term::atoms`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.atoms -[`Term::variable`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.variable -[`Term::eq`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.eq -[`Term::as_simple`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.as_simple -[`Term::into_term`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.into_term -[`Term::borrow_term`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#tymethod.borrow_term -[`t.borrow_term()`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#tymethod.borrow_term -[`Term::BorrowTerm`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#associatedtype.BorrowTerm +[`TermKind`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/enum.TermKind.html +[`Term::kind`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#tymethod.kind +[`Term::is_iri`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.is_iri +[`Term::is_blank_node`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.is_blank_node +[`Term::is_literal`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.is_literal +[`Term::iri`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.iri +[`Term::bnode_id`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.bnode_id +[`Term::bnode_id`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.bnode_id +[`Term::bnode_id`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.bnode_id +[`Term::lexical_form`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.lexical_form +[`Term::datatype`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.datatype +[`Term::language_tag`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.language_tag +[`Term::triple`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.triple +[`Term::constituents`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.constituents +[`Term::atoms`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.atoms +[`Term::variable`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.variable +[`Term::eq`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.eq +[`Term::as_simple`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.as_simple +[`Term::into_term`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.into_term +[`Term::borrow_term`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#tymethod.borrow_term +[`t.borrow_term()`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#tymethod.borrow_term +[`Term::BorrowTerm`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#associatedtype.BorrowTerm [blank node identifier]: https://www.w3.org/TR/rdf-concepts/#dfn-blank-node-identifier [lexical form]: https://www.w3.org/TR/rdf-concepts/#dfn-lexical-form @@ -182,7 +182,7 @@ IRIs can be *relative* IRI reference. [quoted triple]: https://www.w3.org/2021/12/rdf-star.html#dfn-quoted [constituents]: https://www.w3.org/2021/12/rdf-star.html#dfn-constituent -[`Iri`]: https://docs.rs/sophia_iri/0.8.0-alpha.3/sophia_iri/struct.Iri.html -[`IriRef`]: https://docs.rs/sophia_iri/0.8.0-alpha.3/sophia_iri/struct.IriRef.html -[`BnodeId`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/bnode_id/struct.BnodeId.html -[`SimpleTerm`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/enum.SimpleTerm.html +[`Iri`]: https://docs.rs/sophia_iri/0.8.0/sophia_iri/struct.Iri.html +[`IriRef`]: https://docs.rs/sophia_iri/0.8.0/sophia_iri/struct.IriRef.html +[`BnodeId`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/bnode_id/struct.BnodeId.html +[`SimpleTerm`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/enum.SimpleTerm.html diff --git a/book/src/ch03_rdf_statements.md b/book/src/ch03_rdf_statements.md index c1d29eb6..aaf92027 100644 --- a/book/src/ch03_rdf_statements.md +++ b/book/src/ch03_rdf_statements.md @@ -74,19 +74,19 @@ in most situations the following types will be used: [RDF statements]: https://www.w3.org/TR/rdf-concepts/#dfn-rdf-statement [generalized RDF]: ch00_introduction.html#generalized -[`Triple`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/triple/trait.Triple.html -[`Quad`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/quad/trait.Quad.html -[`Triple::s`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/triple/trait.Triple.html#tymethod.s -[`Triple::p`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/triple/trait.Triple.html#tymethod.p -[`Triple::o`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/triple/trait.Triple.html#tymethod.o -[`Triple::spo`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/triple/trait.Triple.html#method.spo +[`Triple`]: https://docs.rs/sophia_api/0.8.0/sophia_api/triple/trait.Triple.html +[`Quad`]: https://docs.rs/sophia_api/0.8.0/sophia_api/quad/trait.Quad.html +[`Triple::s`]: https://docs.rs/sophia_api/0.8.0/sophia_api/triple/trait.Triple.html#tymethod.s +[`Triple::p`]: https://docs.rs/sophia_api/0.8.0/sophia_api/triple/trait.Triple.html#tymethod.p +[`Triple::o`]: https://docs.rs/sophia_api/0.8.0/sophia_api/triple/trait.Triple.html#tymethod.o +[`Triple::spo`]: https://docs.rs/sophia_api/0.8.0/sophia_api/triple/trait.Triple.html#method.spo [named graph]: https://www.w3.org/TR/rdf-concepts/#dfn-named-graph -[`Quad::s`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/quad/trait.Quad.html#tymethod.s -[`Quad::p`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/quad/trait.Quad.html#tymethod.p -[`Quad::o`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/quad/trait.Quad.html#tymethod.o -[`Quad::g`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/quad/trait.Quad.html#tymethod.g -[`Quad::spog`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/quad/trait.Quad.html#method.spog -[`Term::eq`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html#method.eq -[`Triple::eq`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/triple/trait.Triple.html#method.eq -[`Quad::eq`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/quad/trait.Quad.html#method.eq -[`Term`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/trait.Term.html +[`Quad::s`]: https://docs.rs/sophia_api/0.8.0/sophia_api/quad/trait.Quad.html#tymethod.s +[`Quad::p`]: https://docs.rs/sophia_api/0.8.0/sophia_api/quad/trait.Quad.html#tymethod.p +[`Quad::o`]: https://docs.rs/sophia_api/0.8.0/sophia_api/quad/trait.Quad.html#tymethod.o +[`Quad::g`]: https://docs.rs/sophia_api/0.8.0/sophia_api/quad/trait.Quad.html#tymethod.g +[`Quad::spog`]: https://docs.rs/sophia_api/0.8.0/sophia_api/quad/trait.Quad.html#method.spog +[`Term::eq`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html#method.eq +[`Triple::eq`]: https://docs.rs/sophia_api/0.8.0/sophia_api/triple/trait.Triple.html#method.eq +[`Quad::eq`]: https://docs.rs/sophia_api/0.8.0/sophia_api/quad/trait.Quad.html#method.eq +[`Term`]: https://docs.rs/sophia_api/0.8.0/sophia_api/term/trait.Term.html diff --git a/book/src/ch04_rdf_graphs.md b/book/src/ch04_rdf_graphs.md index ed32d50f..0078c8a4 100644 --- a/book/src/ch04_rdf_graphs.md +++ b/book/src/ch04_rdf_graphs.md @@ -48,9 +48,9 @@ graph [`Graph::triples_matching`] accepts a large variety of parameters, which will be described in more detail [in the next chapter](./ch05_term_matchers.md). -[`Graph`] also provide methods to iterate over all unique [subjects](https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html#method.subjects), -[predicate](https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html#method.predicates) -and [object](https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html#method.objects) +[`Graph`] also provide methods to iterate over all unique [subjects](https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html#method.subjects), +[predicate](https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html#method.predicates) +and [object](https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html#method.objects) in the graph, as well as over all unique terms of a certain kind ([`Graph::iris`], [`Graph::blank_nodes`], [`Graph::literals`], etc.). @@ -83,13 +83,13 @@ g.insert(s, rdf::value, old_value + 1)?; Batch modifications can also be performed on mutable graphs: -* [`MutableGraph::insert_all`](https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.MutableGraph.html#method.insert_all) +* [`MutableGraph::insert_all`](https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.MutableGraph.html#method.insert_all) inserts all the triples from a triple source[^triple_source]; -* [`MutableGraph::remove_all`](https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.MutableGraph.html#method.remove_all) +* [`MutableGraph::remove_all`](https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.MutableGraph.html#method.remove_all) removes all the triples from a triple source[^triple_source]; -* [`MutableGraph::remove_matching`](https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.MutableGraph.html#method.remove_matching) +* [`MutableGraph::remove_matching`](https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.MutableGraph.html#method.remove_matching) removes all the triples matching the parameters; -* [`MutableGraph::retain_matching`](https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.MutableGraphremove.html#method.retain_matching) +* [`MutableGraph::retain_matching`](https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.MutableGraphremove.html#method.retain_matching) removes all the triples *except* those matching the parameters. The parameters of `remove_matching` and `retain_matching` are similar to those of [`Graph::triples_matching`] @@ -168,28 +168,28 @@ or those returned by [parsers]. In particular, any iterator of `Result` where `T: `[`Triple`] is a [`TripleSource`]. -[`Graph`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html -[`MutableGraph`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.MutableGraph.html +[`Graph`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html +[`MutableGraph`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.MutableGraph.html [RDF graphs]: https://www.w3.org/TR/rdf-concepts/#dfn-rdf-graph -[`Graph::triples`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html#tymethod.triples +[`Graph::triples`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html#tymethod.triples [`Result`]: https://doc.rust-lang.org/std/result/enum.Result.html -[`Graph::triples_matching`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html#method.triples_matching -[`Graph::iris`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html#method.iris -[`Graph::literals`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html#method.literals -[`Graph::blank_nodes`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html#method.blank_nodes -[`Graph::contains`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html#method.contains -[`MutableGraph::insert`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.MutableGraph.html#tymethod.insert -[`MutableGraph::remove`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.MutableGraph.html#tymethod.remove -[`MutableGraph::insert_triple`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.MutableGraph.html#method.insert_triple -[`MutableGraph::remove_triple`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.MutableGraph.html#method.remove_triple -[`Triple`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/triple/trait.Triple.html -[triple source]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/source/trait.TripleSource.html -[triples]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/triple/trait.Triple.html +[`Graph::triples_matching`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html#method.triples_matching +[`Graph::iris`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html#method.iris +[`Graph::literals`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html#method.literals +[`Graph::blank_nodes`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html#method.blank_nodes +[`Graph::contains`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html#method.contains +[`MutableGraph::insert`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.MutableGraph.html#tymethod.insert +[`MutableGraph::remove`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.MutableGraph.html#tymethod.remove +[`MutableGraph::insert_triple`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.MutableGraph.html#method.insert_triple +[`MutableGraph::remove_triple`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.MutableGraph.html#method.remove_triple +[`Triple`]: https://docs.rs/sophia_api/0.8.0/sophia_api/triple/trait.Triple.html +[triple source]: https://docs.rs/sophia_api/0.8.0/sophia_api/source/trait.TripleSource.html +[triples]: https://docs.rs/sophia_api/0.8.0/sophia_api/triple/trait.Triple.html [`Vec`]: https://doc.rust-lang.org/std/vec/struct.Vec.html [`HashSet`]: https://doc.rust-lang.org/std/collections/struct.HashSet.html [`BTreeSet`]: https://doc.rust-lang.org/std/collections/struct.BTreeSet.html -[`sophia::inmem::LightGraph`]: https://docs.rs/sophia_inmem/0.8.0-alpha.3/sophia_inmem/graph/type.LightGraph.html -[`sophia::inmem::FastGraph`]: https://docs.rs/sophia_inmem/0.8.0-alpha.3/sophia_inmem/graph/type.FastGraph.html -[`TripleSource`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/source/trait.TripleSource.html +[`sophia::inmem::LightGraph`]: https://docs.rs/sophia_inmem/0.8.0/sophia_inmem/graph/type.LightGraph.html +[`sophia::inmem::FastGraph`]: https://docs.rs/sophia_inmem/0.8.0/sophia_inmem/graph/type.FastGraph.html +[`TripleSource`]: https://docs.rs/sophia_api/0.8.0/sophia_api/source/trait.TripleSource.html [parsers]: ./ch07_parsing_and_serializing.md -[`CollectibeGraph`]: https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.CollectibleGraph.html +[`CollectibeGraph`]: https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.CollectibleGraph.html diff --git a/book/src/ch90_changes_since_07.md b/book/src/ch90_changes_since_07.md index 3f9b38a8..1efe74e3 100644 --- a/book/src/ch90_changes_since_07.md +++ b/book/src/ch90_changes_since_07.md @@ -54,12 +54,12 @@ Most of them have now disappeared, in favor of the types defined in [`sophia_iri The [`sophia_term`](https://docs.rs/sophia_term/latest/sophia_term/) crate, from which most term implementations came in 0.7, has been significantly reduced. The most general types that it provided ([`BoxTerm`](https://docs.rs/sophia_term/0.7.2/sophia_term/type.BoxTerm.html), [`RefTerm`](https://docs.rs/sophia_term/0.7.2/sophia_term/type.RefTerm.html)) -are now subsumed by [`SimpleTerm`](https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/term/enum.SimpleTerm.html), +are now subsumed by [`SimpleTerm`](https://docs.rs/sophia_api/0.8.0/sophia_api/term/enum.SimpleTerm.html), a straightforward implementation of the `Term` trait, provided by -[`sophia_api`](https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/index.html). +[`sophia_api`](https://docs.rs/sophia_api/0.8.0/sophia_api/index.html). More specific types (such as -[`RcTerm`](https://docs.rs/sophia_term/0.8.0-alpha.3/sophia_term/type.RcTerm.html) or -[`ArcTerm`](https://docs.rs/sophia_term/0.8.0-alpha.3/sophia_term/type.ArcTerm.html)) +[`RcTerm`](https://docs.rs/sophia_term/0.8.0/sophia_term/type.RcTerm.html) or +[`ArcTerm`](https://docs.rs/sophia_term/0.8.0/sophia_term/type.ArcTerm.html)) are still provided by `sophia_term`. ## Simplification of the `Graph` and `Dataset` traits @@ -69,7 +69,7 @@ such as [`triples_with_s`](https://docs.rs/sophia_api/0.7.2/sophia_api/graph/tra or [`triples_with_po`](https://docs.rs/sophia_api/0.7.2/sophia_api/graph/trait.Graph.html#method.triples_with_po) (and similarly for `Dataset`: `quads_with_s`, etc.). -All these methods have disappeared in favor of [`triples_matching`](https://docs.rs/sophia_api/0.8.0-alpha.3/sophia_api/graph/trait.Graph.html#method.triples_matching), +All these methods have disappeared in favor of [`triples_matching`](https://docs.rs/sophia_api/0.8.0/sophia_api/graph/trait.Graph.html#method.triples_matching), so that instead of: ```rust,noplayground,ignore for t in g.triples_with_s(mys) { diff --git a/indexed/Cargo.toml b/indexed/Cargo.toml deleted file mode 100644 index cd957af1..00000000 --- a/indexed/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "sophia_indexed" -version = "0.7.2" -authors = ["Pierre-Antoine Champin "] -edition = "2021" -description = "A Rust toolkit for RDF and Linked Data - Utility traits and functions for index-based implementations of graphs and datasets" -repository = "https://github.com/pchampin/sophia_rs" -documentation = "https://docs.rs/sophia_indexed" -readme = "../README.md" -license = "CECILL-B" -keywords = ["rdf", "linked-data", "semantic-web"] - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -sophia_api = { version = "0.7.2", path = "../api" } -sophia_term = { version = "0.7.2", path = "../term" } - -[dev-dependencies] diff --git a/indexed/src/dataset.rs b/indexed/src/dataset.rs deleted file mode 100644 index 7ade76cb..00000000 --- a/indexed/src/dataset.rs +++ /dev/null @@ -1,165 +0,0 @@ -//! A utility trait for building datasets using indexed terms. - -use std::hash::Hash; - -use sophia_api::term::TTerm; -use sophia_term::*; - -/// Symbols from other crates, re-exported for the sake of macros -pub mod reexport { - pub use sophia_api::dataset::MdResult; - pub use sophia_api::quad::stream::{QuadSource, StreamResult}; - pub use sophia_api::quad::Quad; -} - -/// A utility trait for implementing [`Dataset`](sophia_api::dataset::Dataset) -/// and [`MutableDataset`](sophia_api::dataset::MutableDataset) -/// based on an internal [`TermIndexMap`](sophia_term::index_map::TermIndexMap) -/// for efficient storage. -/// -/// The [`impl_mutable_dataset_for_indexed_dataset!`] macro -/// can be used to derive the `MutableDataset` implementation -/// for any implementation of `IndexedDataset`. -pub trait IndexedDataset { - /// The type used to represent terms internally. - type Index: Copy + Eq + Hash; - - /// The type used to hold the term data. - type TermData: TermData + 'static; - - /// Construct a new empty dataset, provisioning for storing `capacity` quads. - fn with_capacity(capacity: usize) -> Self; - - /// Shrink the memory consumption of the dataset as much as possible. - fn shrink_to_fit(&mut self); - - /// Return the index for the given term, if it exists. - fn get_index(&self, t: &T) -> Option - where - T: TTerm + ?Sized; - - /// Return the index for the given graph name, if it exists. - fn get_index_for_graph_name(&self, g: Option<&T>) -> Option - where - T: TTerm + ?Sized; - - /// Return the term for the given index, if it exists. - fn get_term(&self, i: Self::Index) -> Option<&Term>; - - /// Return the graph name for the given index, if it exists - /// - /// NB: a graph name is already an `Option`, `None` meaning the (unnamed) default graph. - /// As a consequence, this methods returns *an option of option* : - /// * `None` means that given index is *not* associated to any graph name, - /// * `Some(None)` means that the given index is associated to the default graph, - /// * `Some(Some(term))` means that given index is associated to a proper graph name. - #[allow(clippy::option_option)] - fn get_graph_name(&self, i: Self::Index) -> Option>>; - - /// Insert a triple in this Dataset, - /// and return the corresponding tuple of indices. - fn insert_indexed( - &mut self, - s: &TS, - p: &TP, - o: &TO, - g: Option<&TG>, - ) -> Option<[Self::Index; 4]> - where - TS: TTerm + ?Sized, - TP: TTerm + ?Sized, - TO: TTerm + ?Sized, - TG: TTerm + ?Sized; - - /// Remove a triple from this Dataset, - /// and return the corresponding tuple of indices. - fn remove_indexed( - &mut self, - s: &TS, - p: &TP, - o: &TO, - g: Option<&TG>, - ) -> Option<[Self::Index; 4]> - where - TS: TTerm + ?Sized, - TP: TTerm + ?Sized, - TO: TTerm + ?Sized, - TG: TTerm + ?Sized; -} - -/// Defines the implementation of [`CollectibleDataset`](sophia_api::dataset::CollectibleDataset) -/// for [`IndexedDataset`]. -#[macro_export] -macro_rules! impl_collectible_dataset_for_indexed_dataset { - ($indexed_mutable_dataset: ty) => { - impl CollectibleDataset for $indexed_mutable_dataset { - impl_collectible_dataset_for_indexed_dataset!(); - } - }; - () => { - fn from_quad_source( - mut quads: QS, - ) -> $crate::dataset::reexport::StreamResult { - use $crate::dataset::reexport::Quad; - let (tmin, tmax) = quads.size_hint_quads(); - let cap = tmax.unwrap_or(tmin); - let mut g = Self::with_capacity(cap); - quads - .try_for_each_quad(|q| -> Result<(), Self::Error> { - g.insert_indexed(q.s(), q.p(), q.o(), q.g()); - Ok(()) - }) - .map(|_| g) - } - }; -} - -/// Defines the implementation of [`MutableDataset`](sophia_api::dataset::MutableDataset) -/// for [`IndexedDataset`]. -#[macro_export] -macro_rules! impl_mutable_dataset_for_indexed_dataset { - ($indexed_mutable_dataset: ty) => { - impl MutableDataset for $indexed_mutable_dataset { - impl_mutable_dataset_for_indexed_dataset!(); - } - }; - () => { - type MutationError = std::convert::Infallible; - - fn insert( - &mut self, - s: &TS_, - p: &TP_, - o: &TO_, - g: Option<&TG_>, - ) -> $crate::dataset::reexport::MdResult - where - TS_: sophia_api::term::TTerm + ?Sized, - TP_: sophia_api::term::TTerm + ?Sized, - TO_: sophia_api::term::TTerm + ?Sized, - TG_: sophia_api::term::TTerm + ?Sized, - { - Ok(self.insert_indexed(s, p, o, g).is_some()) - } - fn remove( - &mut self, - s: &TS_, - p: &TP_, - o: &TO_, - g: Option<&TG_>, - ) -> $crate::dataset::reexport::MdResult - where - TS_: sophia_api::term::TTerm + ?Sized, - TP_: sophia_api::term::TTerm + ?Sized, - TO_: sophia_api::term::TTerm + ?Sized, - TG_: sophia_api::term::TTerm + ?Sized, - { - Ok(self.remove_indexed(s, p, o, g).is_some()) - } - }; -} - -#[cfg(test)] -mod test { - // Nothing really worth testing here -} diff --git a/indexed/src/graph.rs b/indexed/src/graph.rs deleted file mode 100644 index e8d9a914..00000000 --- a/indexed/src/graph.rs +++ /dev/null @@ -1,196 +0,0 @@ -//! A utility trait for building graphs using indexed terms. - -use std::collections::hash_map::Entry; -use std::collections::HashMap; -use std::hash::Hash; - -use sophia_api::term::TTerm; -use sophia_term::*; - -/// Symbols from other crates, re-exported for the sake of macros -pub mod reexport { - pub use sophia_api::graph::MgResult; - pub use sophia_api::triple::stream::{StreamResult, TripleSource}; - pub use sophia_api::triple::Triple; -} - -/// A utility trait for implementing [`Graph`](sophia_api::graph::Graph) -/// and [`MutableGraph`](sophia_api::dataset::Dataset) -/// based on an internal [`TermIndexMap`](sophia_term::index_map::TermIndexMap) -/// for efficient storage. -/// -/// The [`impl_mutable_graph_for_indexed_graph!`] macro -/// can be used to derive the `MutableGraph` implementation -/// for any implementation of `IndexedGraph`. -pub trait IndexedGraph { - /// The type used to represent terms internally. - type Index: Copy + Eq + Hash; - - /// The type used to hold the term data. - type TermData: TermData + 'static; - - /// Construct a new empty graph, provisioning for storing `capacity` triples. - fn with_capacity(capacity: usize) -> Self; - - /// Shrink the memory consumption of the graph as much as possible. - fn shrink_to_fit(&mut self); - - /// Return the index for the given term, if it exists. - fn get_index(&self, t: &T) -> Option - where - T: TTerm + ?Sized; - - /// Return the term for the given index, if it exists. - fn get_term(&self, i: Self::Index) -> Option<&Term>; - - /// Insert a triple in this Graph, - /// and return the corresponding tuple of indices. - fn insert_indexed(&mut self, s: &TS, p: &TP, o: &TO) -> Option<[Self::Index; 3]> - where - TS: TTerm + ?Sized, - TP: TTerm + ?Sized, - TO: TTerm + ?Sized; - /// Remove a triple from this Graph, - /// and return the corresponding tuple of indices. - fn remove_indexed(&mut self, s: &TS, p: &TP, o: &TO) -> Option<[Self::Index; 3]> - where - TS: TTerm + ?Sized, - TP: TTerm + ?Sized, - TO: TTerm + ?Sized; -} - -/// Defines the implementation of [`CollectibleGraph`](sophia_api::graph::CollectibleGraph) -/// for [`IndexedGraph`]. -#[macro_export] -macro_rules! impl_collectible_graph_for_indexed_graph { - ($indexed_mutable_graph: ty) => { - impl CollectibleGraph for $indexed_mutable_graph { - impl_collectible_graph_for_indexed_graph!(); - } - }; - () => { - fn from_triple_source( - mut triples: TS, - ) -> $crate::graph::reexport::StreamResult { - use $crate::graph::reexport::Triple; - let (tmin, tmax) = triples.size_hint_triples(); - let cap = tmax.unwrap_or(tmin); - let mut g = Self::with_capacity(cap); - triples - .try_for_each_triple(|t| -> Result<(), Self::Error> { - g.insert_indexed(t.s(), t.p(), t.o()); - Ok(()) - }) - .map(|_| g) - } - }; -} - -/// Defines the implementation of [`MutableGraph`](sophia_api::graph::MutableGraph) -/// for [`IndexedGraph`]. -#[macro_export] -macro_rules! impl_mutable_graph_for_indexed_graph { - ($indexed_mutable_graph: ty) => { - impl MutableGraph for $indexed_mutable_graph { - impl_mutable_graph_for_indexed_graph!(); - } - }; - () => { - type MutationError = std::convert::Infallible; - - fn insert( - &mut self, - s: &TS_, - p: &TP_, - o: &TO_, - ) -> $crate::graph::reexport::MgResult - where - TS_: sophia_api::term::TTerm + ?Sized, - TP_: sophia_api::term::TTerm + ?Sized, - TO_: sophia_api::term::TTerm + ?Sized, - { - Ok(self.insert_indexed(s, p, o).is_some()) - } - fn remove( - &mut self, - s: &TS_, - p: &TP_, - o: &TO_, - ) -> $crate::graph::reexport::MgResult - where - TS_: sophia_api::term::TTerm + ?Sized, - TP_: sophia_api::term::TTerm + ?Sized, - TO_: sophia_api::term::TTerm + ?Sized, - { - Ok(self.remove_indexed(s, p, o).is_some()) - } - }; -} - -/// Insert an absent value in the Vec value of a HashMap, -/// creating the Vec if it does not exist. -/// -/// # Returns -/// -/// `true` if the Vec was created, -/// meaning that "parent" indexes need to be updated. -/// -pub fn insert_in_index(hm: &mut HashMap>, k: K, w: W) -> bool -where - K: Eq + Hash, - W: Copy + Eq, -{ - let mut ret = false; - hm.entry(k) - .or_insert_with(|| { - ret = true; - Vec::new() - }) - .push(w); - ret -} - -/// Remove an existing value in the Vec value of a HashMap, -/// removing the entry completely if the Vec ends up empty. -/// -/// # Returns -/// -/// `true` if the entry was removed, -/// meaning that "parent" indexes need to be updated. -/// -/// # Panics -/// -/// This function will panic if either -/// * `k` is not a key of `hm`, or -/// * `w` is not contained in the value associated to `k`. -pub fn remove_from_index(hm: &mut HashMap>, k: K, w: W) -> bool -where - K: Eq + Hash, - W: Copy + Eq, -{ - match hm.entry(k) { - Entry::Occupied(mut e) => { - { - let ws = e.get_mut(); - if ws.len() > 1 { - let wi = ws - .iter() - .enumerate() - .filter_map(|(i, w2)| if *w2 == w { Some(i) } else { None }) - .next() - .unwrap(); - ws.swap_remove(wi); - return false; - } - } - e.remove_entry(); - true - } - Entry::Vacant(_) => unreachable!(), - } -} - -#[cfg(test)] -mod test { - // Nothing really worth testing here -} diff --git a/indexed/src/lib.rs b/indexed/src/lib.rs deleted file mode 100644 index de9d7a0b..00000000 --- a/indexed/src/lib.rs +++ /dev/null @@ -1,11 +0,0 @@ -//! This crate is part of [Sophia], -//! an [RDF] and [Linked Data] toolkit in Rust. -//! -//! It provides utility traits and functions for implementing graph and datasets with indexed terms. -//! -//! [Sophia]: https://docs.rs/sophia/latest/sophia/ -//! [RDF]: https://www.w3.org/TR/rdf-primer/ -//! [Linked Data]: http://linkeddata.org/ - -pub mod dataset; -pub mod graph; diff --git a/jsonld/Cargo.toml b/jsonld/Cargo.toml index 2068a304..5098004f 100644 --- a/jsonld/Cargo.toml +++ b/jsonld/Cargo.toml @@ -20,12 +20,12 @@ file_url = ["dep:url"] http_client = ["json-ld/reqwest"] [dependencies] -iref = "2.2" -json-ld = { version = "0.15.1" } -json-syntax = "0.9" +iref = "^2.2" +json-ld = "0.15.1" +json-syntax = "^0.9" langtag = "0.3.4" -locspan = "0.7.12" -rdf-types = "0.15.4" +locspan = "^0.7.13" +rdf-types = "^0.15.2" sophia_api.workspace = true sophia_iri.workspace = true sophia_term.workspace = true diff --git a/sophia_doap.ttl b/sophia_doap.ttl index 03b17e86..12fdada8 100644 --- a/sophia_doap.ttl +++ b/sophia_doap.ttl @@ -37,10 +37,14 @@ a foaf:Person; rdfs:isDefinedBy ; foaf:made ; - foaf:mbox ; + foaf:mbox ; foaf:name "Pierre-Antoine Champin". doap:release [ + doap:name "sophia-0.8.0"; + doap:revision "0.8.0"; + doap:created "2024-01-08"^^xsd:date; +],[ doap:name "sophia-0.8.0-alpha.3"; doap:revision "0.8.0-alpha.3"; doap:created "2023-10-24"^^xsd:date;