diff --git a/js/README.md b/js/README.md index 0c4cf685..497e3d8e 100644 --- a/js/README.md +++ b/js/README.md @@ -9,7 +9,7 @@ This package provides a JavaScript API on top of Oxigraph compiled with WebAssem Oxigraph is a graph database written in Rust implementing the [SPARQL](https://www.w3.org/TR/sparql11-overview/) standard. -Oxigraph or JavaScript is a work in progress and currently offers a simple in-memory store with [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/) capabilities. +Oxigraph for JavaScript is a work in progress and currently offers a simple in-memory store with [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/) capabilities. The store is also able to load RDF serialized in [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/). diff --git a/lib/src/sparql/mod.rs b/lib/src/sparql/mod.rs index 656d3d61..39d85926 100644 --- a/lib/src/sparql/mod.rs +++ b/lib/src/sparql/mod.rs @@ -206,16 +206,16 @@ impl QueryOptions { self } - /// Adds a named graph to the set of graphs considered by the SPARQL query as the queried dataset default graph - /// Overrides the `FROM` and `FROM NAMED` elements of the evaluated query + /// Adds a named graph to the set of graphs considered by the SPARQL query as the queried dataset default graph. + /// It overrides the `FROM` and `FROM NAMED` elements of the evaluated query. #[inline] pub fn with_default_graph(mut self, default_graph_name: impl Into) -> Self { self.dataset.default.push(default_graph_name.into()); self } - /// Adds a named graph to the set of graphs considered by the SPARQL query as the queried dataset named graphs - /// Overrides the `FROM` and `FROM NAMED` elements of the evaluated query + /// Adds a named graph to the set of graphs considered by the SPARQL query as the queried dataset named graphs. + /// It overrides the `FROM` and `FROM NAMED` elements of the evaluated query. #[inline] pub fn with_named_graph(mut self, named_graph_name: impl Into) -> Self { self.dataset.named.push(named_graph_name.into()); diff --git a/python/README.md b/python/README.md index 9905a8a1..12034fa8 100644 --- a/python/README.md +++ b/python/README.md @@ -23,9 +23,9 @@ It also provides a set of utility functions for reading, writing and processing Pyoxigraph is distributed [on Pypi](https://pypi.org/project/pyoxigraph/). Run `pip install pyoxigraph` to install it. -There exists also a small library providing [rdflib](https://rdflib.readthedocs.io) store using pyoxigraph: [oxrdflib](https://github.com/oxigraph/oxrdflib). +There exists also a small library providing [rdflib](https://rdflib.readthedocs.io) stores using pyoxigraph: [oxrdflib](https://github.com/oxigraph/oxrdflib). -Pyoxigraph documentation is [available on Oxigraph website](https://oxigraph.org/pyoxigraph/). +Pyoxigraph documentation is [available on the Oxigraph website](https://oxigraph.org/pyoxigraph/). ## Build the development version @@ -37,12 +37,12 @@ and to run `pip install .` in the `python` directory (the one this README is in) Pyoxigraph is written in Rust using [PyO3](https://github.com/PyO3/pyo3). -Pyoxigraph is build using [Maturin](https://github.com/PyO3/maturin). -Maturin could be installed using the usual `pip install maturin`. -To install a development version of Oxigraph just run `maturin develop`. +Pyoxigraph is built using [Maturin](https://github.com/PyO3/maturin). +Maturin could be installed using the `pip install maturin`. +To install a development version of Oxigraph just run `maturin develop` in this README directory. The Python bindings tests are written in Python. -To run them use the usual `python -m unittest` in the `tests` directory. +To run them use `python -m unittest` in the `tests` directory. To release a new version of Pyoxigraph run: ```bash diff --git a/python/docs/index.rst b/python/docs/index.rst index 70740d1b..d7484145 100644 --- a/python/docs/index.rst +++ b/python/docs/index.rst @@ -12,9 +12,9 @@ pyoxigraph |release| :alt: PyPI - License -Pyoxigraph is a graph database library implementing the `SPARQL `_ standard. +Pyoxigraph is a Python graph database library implementing the `SPARQL `_ standard. -It is built on top of `Oxigraph `_ using `PyO3 `_ to provides a Python API. +It is built on top of `Oxigraph `_ using `PyO3 `_. It offers two stores with `SPARQL 1.1 Query `_ capabilities. One of the store is in-memory, and the other one is disk based. @@ -28,7 +28,7 @@ It also provides a set of utility functions for reading, writing and processing Pyoxigraph is `distributed on Pypi `_. -There exists also a small library providing `rdflib `_ store using pyoxigraph: `oxrdflib `_. +There exists also a small library providing `rdflib `_ stores using pyoxigraph: `oxrdflib `_. Oxigraph and pyoxigraph source code are on `GitHub `_. @@ -52,8 +52,8 @@ Insert the triple `` "example"`` and p store = MemoryStore() ex = NamedNode('http://example/') - schemaName = NamedNode('http://schema.org/name') - store.add((ex, schemaName, Literal('example'))) + schema_name = NamedNode('http://schema.org/name') + store.add(Quad(ex, schema_name, Literal('example'))) for binding in store.query('SELECT ?name WHERE { ?name }'): print(binding['name'].value) diff --git a/python/src/io.rs b/python/src/io.rs index b8e28c5c..0a63a90b 100644 --- a/python/src/io.rs +++ b/python/src/io.rs @@ -36,7 +36,7 @@ pub fn add_to_module(module: &PyModule) -> PyResult<()> { /// :param mime_type: the MIME type of the RDF serialization /// :type mime_type: str /// :param base_iri: the base IRI used to resolve the relative IRIs in the file or :py:const:`None` if relative IRI resolution should not be done -/// :type base_iri: str or None +/// :type base_iri: str or None, optional /// :return: an iterator of RDF triples or quads depending on the format /// :rtype: iter(Triple) or iter(Quad) /// :raises ValueError: if the MIME type is not supported @@ -99,7 +99,7 @@ pub fn parse( /// and ``application/xml`` for `RDF/XML `_. /// /// :param input: the RDF triples and quads to serialize -/// :type input: iterable(Triple) or iterable(Quad) +/// :type input: iter(Triple) or iter(Quad) /// :param output: The binary I/O object to write to. For example, it could be a file opened in binary mode with ``open('my_file.ttl', 'wb')``. /// :type output: io.RawIOBase or io.BufferedIOBase /// :param mime_type: the MIME type of the RDF serialization diff --git a/python/src/memory_store.rs b/python/src/memory_store.rs index db60237b..b981fb6f 100644 --- a/python/src/memory_store.rs +++ b/python/src/memory_store.rs @@ -109,11 +109,11 @@ impl PyMemoryStore { /// :param query: the query to execute /// :type query: str /// :param use_default_graph_as_union: optional, if the SPARQL query should look for triples in all the dataset graphs by default (i.e. without `GRAPH` operations). Disabled by default. - /// :type use_default_graph_as_union: bool + /// :type use_default_graph_as_union: bool, optional /// :param default_graph_uris: optional, list of the named graph URIs that should be used as the query default graph. By default the store default graph is used. - /// :type default_graph_uris: list(NamedNode),None + /// :type default_graph_uris: list(NamedNode) or None, optional /// :param named_graph_uris: optional, list of the named graph URIs that could be used in SPARQL `GRAPH` clause. By default all the store default graphs are available. - /// :type named_graph_uris: list(NamedNode),None + /// :type named_graph_uris: list(NamedNode) or None, optional /// :return: a :py:class:`bool` for ``ASK`` queries, an iterator of :py:class:`Triple` for ``CONSTRUCT`` and ``DESCRIBE`` queries and an iterator of :py:class:`QuerySolution` for ``SELECT`` queries. /// :rtype: QuerySolutions or QueryTriples or bool /// :raises SyntaxError: if the provided query is invalid @@ -186,9 +186,9 @@ impl PyMemoryStore { /// :param mime_type: the MIME type of the RDF serialization /// :type mime_type: str /// :param base_iri: the base IRI used to resolve the relative IRIs in the file or :py:const:`None` if relative IRI resolution should not be done - /// :type base_iri: str or None + /// :type base_iri: str or None, optional /// :param to_graph: if it is a file composed of triples, the graph in which store the triples. By default, the default graph is used. - /// :type to_graph: NamedNode or BlankNode or DefaultGraph or None + /// :type to_graph: NamedNode or BlankNode or DefaultGraph or None, optional /// :raises ValueError: if the MIME type is not supported or the `to_graph` parameter is given with a quad file. /// :raises SyntaxError: if the provided data is invalid /// @@ -257,7 +257,7 @@ impl PyMemoryStore { /// :param mime_type: the MIME type of the RDF serialization /// :type mime_type: str /// :param from_graph: if a triple based format is requested, the store graph from which dump the triples. By default, the default graph is used. - /// :type from_graph: NamedNode or BlankNode or DefaultGraph or None + /// :type from_graph: NamedNode or BlankNode or DefaultGraph or None, optional /// :raises ValueError: if the MIME type is not supported or the `from_graph` parameter is given with a quad syntax. /// /// >>> store = MemoryStore() diff --git a/python/src/model.rs b/python/src/model.rs index ad8500e9..b385c581 100644 --- a/python/src/model.rs +++ b/python/src/model.rs @@ -514,7 +514,7 @@ impl PyIterProtocol for PyTriple { /// :param object: the quad object /// :type object: NamedNode or BlankNode or Literal /// :param graph: the quad graph name. If not present, the default graph is assumed. -/// :type object: NamedNode or BlankNode or DefaultGraph or None +/// :type graph: NamedNode or BlankNode or DefaultGraph or None, optional /// /// The :py:func:`str` function provides a serialization compatible with NTriples, Turtle and SPARQL: /// diff --git a/python/src/sled_store.rs b/python/src/sled_store.rs index e7cff892..90389071 100644 --- a/python/src/sled_store.rs +++ b/python/src/sled_store.rs @@ -17,7 +17,7 @@ use std::io::BufReader; /// It encodes a `RDF dataset `_ and allows to query it using SPARQL. /// /// :param path: the path of the directory in which Sled should read and write its data. If the directory does not exist, it is created. If no directory is provided a temporary one is created and removed when the Python garbage collector removes the store. -/// :type path: str or None +/// :type path: str or None, optional /// :raises IOError: if the target directory contains invalid data or could not be accessed /// /// Warning: Sled is not stable yet and might break its storage format. @@ -124,11 +124,11 @@ impl PySledStore { /// :param query: the query to execute /// :type query: str /// :param use_default_graph_as_union: optional, if the SPARQL query should look for triples in all the dataset graphs by default (i.e. without `GRAPH` operations). Disabled by default. - /// :type use_default_graph_as_union: bool + /// :type use_default_graph_as_union: bool, optional /// :param default_graph_uris: optional, list of the named graph URIs that should be used as the query default graph. By default the store default graph is used. - /// :type default_graph_uris: list(NamedNode),None + /// :type default_graph_uris: list(NamedNode) or None, optional /// :param named_graph_uris: optional, list of the named graph URIs that could be used in SPARQL `GRAPH` clause. By default all the store default graphs are available. - /// :type named_graph_uris: list(NamedNode),None + /// :type named_graph_uris: list(NamedNode) or None, optional /// :return: a :py:class:`bool` for ``ASK`` queries, an iterator of :py:class:`Triple` for ``CONSTRUCT`` and ``DESCRIBE`` queries and an iterator of :py:class:`QuerySolution` for ``SELECT`` queries. /// :rtype: QuerySolutions or QueryTriples or bool /// :raises SyntaxError: if the provided query is invalid @@ -202,9 +202,9 @@ impl PySledStore { /// :param mime_type: the MIME type of the RDF serialization /// :type mime_type: str /// :param base_iri: the base IRI used to resolve the relative IRIs in the file or :py:const:`None` if relative IRI resolution should not be done - /// :type base_iri: str or None + /// :type base_iri: str or None, optional /// :param to_graph: if it is a file composed of triples, the graph in which store the triples. By default, the default graph is used. - /// :type to_graph: NamedNode or BlankNode or DefaultGraph or None + /// :type to_graph: NamedNode or BlankNode or DefaultGraph or None, optional /// :raises ValueError: if the MIME type is not supported or the `to_graph` parameter is given with a quad file. /// :raises SyntaxError: if the provided data is invalid /// :raises IOError: if an I/O error happens during a quad insertion @@ -274,7 +274,7 @@ impl PySledStore { /// :param mime_type: the MIME type of the RDF serialization /// :type mime_type: str /// :param from_graph: if a triple based format is requested, the store graph from which dump the triples. By default, the default graph is used. - /// :type from_graph: NamedNode or BlankNode or DefaultGraph or None + /// :type from_graph: NamedNode or BlankNode or DefaultGraph or None, optional /// :raises ValueError: if the MIME type is not supported or the `from_graph` parameter is given with a quad syntax. /// :raises IOError: if an I/O error happens during a quad lookup ///