diff --git a/lib/README.md b/lib/README.md index 8bda2949..7f1c7b90 100644 --- a/lib/README.md +++ b/lib/README.md @@ -26,39 +26,38 @@ Oxigraph implements the following specifications: A preliminary benchmark [is provided](../bench/README.md). -Usage example: - +The main entry point of Oxigraph is the [`Store`](store::Store) struct: ```rust use oxigraph::store::Store; -use oxigraph::sparql::QueryResults; use oxigraph::model::*; +use oxigraph::sparql::QueryResults; -let store = Store::open("example.db")?; +let store = Store::new().unwrap(); // insertion -let ex = NamedNode::new("http://example.com")?; +let ex = NamedNode::new("http://example.com").unwrap(); let quad = Quad::new(ex.clone(), ex.clone(), ex.clone(), GraphName::DefaultGraph); store.insert(&quad)?; // quad filter -let results: Result,_> = store.quads_for_pattern(None, None, None, None).collect(); -assert_eq!(vec![quad], results?); +let results = store.quads_for_pattern(Some(ex.as_ref().into()), None, None, None).collect::,_>>().unwrap(); +assert_eq!(vec![quad], results); // SPARQL query -if let QueryResults::Solutions(mut solutions) = store.query("SELECT ?s WHERE { ?s ?p ?o }")? { -assert_eq!(solutions.next().unwrap()?.get("s"), Some(&ex.into())); -}; +if let QueryResults::Solutions(mut solutions) = store.query("SELECT ?s WHERE { ?s ?p ?o }").unwrap() { + assert_eq!(solutions.next().unwrap().unwrap().get("s"), Some(&ex.into())); +} ``` ## License This project is licensed under either of - * Apache License, Version 2.0, ([LICENSE-APACHE](../LICENSE-APACHE) or - http://www.apache.org/licenses/LICENSE-2.0) - * MIT license ([LICENSE-MIT](../LICENSE-MIT) or - http://opensource.org/licenses/MIT) - +* Apache License, Version 2.0, ([LICENSE-APACHE](../LICENSE-APACHE) or + ``) +* MIT license ([LICENSE-MIT](../LICENSE-MIT) or + ``) + at your option. diff --git a/lib/oxrdf/README.md b/lib/oxrdf/README.md index 46065a85..628c7581 100644 --- a/lib/oxrdf/README.md +++ b/lib/oxrdf/README.md @@ -23,7 +23,7 @@ use oxrdf::*; let mut graph = Graph::default(); // insertion -let ex = NamedNodeRef::new("http://example.com")?; +let ex = NamedNodeRef::new("http://example.com").unwrap(); let triple = TripleRef::new(ex, ex, ex); graph.insert(triple); @@ -37,9 +37,9 @@ assert_eq!(vec![triple], results); This project is licensed under either of * Apache License, Version 2.0, ([LICENSE-APACHE](../LICENSE-APACHE) or - http://www.apache.org/licenses/LICENSE-2.0) + ``) * MIT license ([LICENSE-MIT](../LICENSE-MIT) or - http://opensource.org/licenses/MIT) + ``) at your option. diff --git a/lib/oxrdf/src/lib.rs b/lib/oxrdf/src/lib.rs index 11933965..b598cc03 100644 --- a/lib/oxrdf/src/lib.rs +++ b/lib/oxrdf/src/lib.rs @@ -1,29 +1,15 @@ -//! OxRDF is a simple library providing datastructures encoding [RDF 1.1 concepts](https://www.w3.org/TR/rdf11-concepts/). -//! -//! 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. -//! -//! Inspired by [RDF/JS](https://rdf.js.org/data-model-spec/) and [Apache Commons RDF](http://commons.apache.org/proper/commons-rdf/). -//! -//! Usage example: -//! -//! Usage example: -//! ``` -//! use oxrdf::*; -//! -//! let mut graph = Graph::default(); -//! -//! // insertion -//! let ex = NamedNodeRef::new("http://example.com")?; -//! let triple = TripleRef::new(ex, ex, ex); -//! graph.insert(triple); -//! -//! // simple filter -//! let results: Vec<_> = graph.triples_for_subject(ex).collect(); -//! assert_eq!(vec![triple], results); -//! # Result::<_,Box>::Ok(()) -//! ``` +#![doc = include_str!("../README.md")] +#![deny( + future_incompatible, + nonstandard_style, + rust_2018_idioms, + missing_copy_implementations, + trivial_casts, + trivial_numeric_casts, + unsafe_code, + unused_qualifications +)] +#![doc(test(attr(deny(warnings))))] mod blank_node; pub mod dataset; diff --git a/lib/spargebra/README.md b/lib/spargebra/README.md index 5f66e253..56677fcc 100644 --- a/lib/spargebra/README.md +++ b/lib/spargebra/README.md @@ -9,7 +9,11 @@ Spargebra Spargebra is a [SPARQL](https://www.w3.org/TR/sparql11-overview/) parser. -It supports [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/) and [SPARQL 1.1 Update](https://www.w3.org/TR/sparql11-update/). +It supports both [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/) and [SPARQL 1.1 Update](https://www.w3.org/TR/sparql11-update/). + +The emitted tree is based on [SPARQL 1.1 Query Algebra](https://www.w3.org/TR/sparql11-query/#sparqlQuery) objects. + +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. @@ -21,7 +25,7 @@ Usage example: use spargebra::Query; let query_str = "SELECT ?s ?p ?o WHERE { ?s ?p ?o . }"; -let mut query = Query::parse(query_str, None)?; +let query = Query::parse(query_str, None).unwrap(); assert_eq!(query.to_string(), query_str); ``` @@ -30,9 +34,9 @@ assert_eq!(query.to_string(), query_str); This project is licensed under either of * Apache License, Version 2.0, ([LICENSE-APACHE](../LICENSE-APACHE) or - http://www.apache.org/licenses/LICENSE-2.0) + ``) * MIT license ([LICENSE-MIT](../LICENSE-MIT) or - http://opensource.org/licenses/MIT) + ``) at your option. diff --git a/lib/spargebra/src/lib.rs b/lib/spargebra/src/lib.rs index 3672f1b6..c47f16ef 100644 --- a/lib/spargebra/src/lib.rs +++ b/lib/spargebra/src/lib.rs @@ -1,21 +1,4 @@ -//! This crate provides [SPARQL 1.1](http://www.w3.org/TR/sparql11-overview/) query and update parsers. -//! The emitted tree is based on [SPARQL 1.1 Query Algebra](https://www.w3.org/TR/sparql11-query/#sparqlQuery) objects. -//! -//! The API entry point for SPARQL queries is [`Query`] and the API entry point for SPARQL updates is [`Update`]. -//! -//! This crate is intended to be a building piece for SPARQL implementations in Rust like [Oxigraph](https://oxigraph.org). -//! -//! Support for [SPARQL-star](https://w3c.github.io/rdf-star/cg-spec/) is available behind the `rdf-star` feature. -//! -//! Usage example: -//! ``` -//! use spargebra::Query; -//! -//! let query_str = "SELECT ?s ?p ?o WHERE { ?s ?p ?o . }"; -//! let query = Query::parse(query_str, None)?; -//! assert_eq!(query.to_string(), query_str); -//! # Result::Ok::<_, spargebra::ParseError>(()) -//! ``` +#![doc = include_str!("../README.md")] #![deny( future_incompatible, nonstandard_style, diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 892ca5a2..b7dca824 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -1,39 +1,4 @@ -//! Oxigraph is a graph database library implementing the [SPARQL](https://www.w3.org/TR/sparql11-overview/) standard. -//! -//! Its goal is to provide a compliant, safe and fast on-disk database. -//! It also provides a set of utility functions for reading, writing, and processing RDF files. -//! -//! Oxigraph is in heavy development and SPARQL query evaluation has not been optimized yet. -//! -//! The disabled by default `"sophia"` feature provides [`sophia_api`](https://docs.rs/sophia_api/) traits implemention on Oxigraph terms and stores. -//! -//! Oxigraph also provides [a standalone HTTP server](https://crates.io/crates/oxigraph_server) based on this library. -//! -//! -//! The main entry point of Oxigraph is the [`Store`](store::Store) struct: -//! -//! ``` -//! use oxigraph::store::Store; -//! use oxigraph::model::*; -//! use oxigraph::sparql::QueryResults; -//! -//! let store = Store::new()?; -//! -//! // insertion -//! let ex = NamedNode::new("http://example.com")?; -//! let quad = Quad::new(ex.clone(), ex.clone(), ex.clone(), GraphName::DefaultGraph); -//! store.insert(&quad)?; -//! -//! // quad filter -//! let results = store.quads_for_pattern(Some(ex.as_ref().into()), None, None, None).collect::,_>>()?; -//! assert_eq!(vec![quad], results); -//! -//! // SPARQL query -//! if let QueryResults::Solutions(mut solutions) = store.query("SELECT ?s WHERE { ?s ?p ?o }")? { -//! assert_eq!(solutions.next().unwrap()?.get("s"), Some(&ex.into())); -//! } -//! # Result::<_,Box>::Ok(()) -//! ``` +#![doc = include_str!("../README.md")] #![deny( future_incompatible, nonstandard_style, @@ -44,6 +9,7 @@ unsafe_code, unused_qualifications )] +#![doc(test(attr(deny(warnings))))] #![doc(html_favicon_url = "https://raw.githubusercontent.com/oxigraph/oxigraph/master/logo.svg")] #![doc(html_logo_url = "https://raw.githubusercontent.com/oxigraph/oxigraph/master/logo.svg")] #![warn( @@ -169,7 +135,6 @@ clippy::zero_sized_map_values, clippy::wrong_self_convention, )] -#![doc(test(attr(deny(warnings))))] pub mod io; pub mod model;