Uses README for crates documentation

Avoids duplicated documentation
pull/190/head
Tpt 3 years ago
parent 850b8eddcf
commit 375fef1e22
  1. 29
      lib/README.md
  2. 6
      lib/oxrdf/README.md
  3. 38
      lib/oxrdf/src/lib.rs
  4. 12
      lib/spargebra/README.md
  5. 19
      lib/spargebra/src/lib.rs
  6. 39
      lib/src/lib.rs

@ -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<Vec<Quad>,_> = 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::<Result<Vec<Quad>,_>>().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
`<http://www.apache.org/licenses/LICENSE-2.0>`)
* MIT license ([LICENSE-MIT](../LICENSE-MIT) or
`<http://opensource.org/licenses/MIT>`)
at your option.

@ -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)
`<http://www.apache.org/licenses/LICENSE-2.0>`)
* MIT license ([LICENSE-MIT](../LICENSE-MIT) or
http://opensource.org/licenses/MIT)
`<http://opensource.org/licenses/MIT>`)
at your option.

@ -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<dyn std::error::Error>>::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;

@ -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)
`<http://www.apache.org/licenses/LICENSE-2.0>`)
* MIT license ([LICENSE-MIT](../LICENSE-MIT) or
http://opensource.org/licenses/MIT)
`<http://opensource.org/licenses/MIT>`)
at your option.

@ -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,

@ -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::<Result<Vec<Quad>,_>>()?;
//! 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<dyn std::error::Error>>::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;

Loading…
Cancel
Save