omniSPARQL
omniSparql is a python module to query triples from the OMNIBENCHMARK triplestore. Its main usage is to retrieve lineage information in an OMNIBENCHMARK (see the lineage query file of summary metric projects).
Usage
Minimal usage
The typical use of omniSparql consists in forming a SPARQL based on your need and running it on your triplestore URL:
import omniSparql as omni
## get a query
query = omni.getSparqlQuery.CLASS_METHOD
## run the query
out = omni.query_from_sparql(query, URL = TRIPLESTORE_URL)
Detailled usage
Let's start by getting a query. Several SPARQL queries are available in the getSparqlQuery class, which you can explore with the help page of the page;
import omniSparql as omni
help(omni.getSparqlQuery)
Help on class getSparqlQuery in module omniSparql.sparql:
class getSparqlQuery(builtins.object)
| Available SPARQL queries. One or multiple input to define when called.
|
| Returns:
| A string which contains a SPARQL command to use with `query_from_sparql`.
|
| Methods defined here:
[...]
| imported_datasets_from_project(project_name)
| Retrieves all datasets imported by a project.
|
| Args:
| project_name (str): abbreviated name of the project, e.g. 'omni_batch_processed'
| Returns:
| `query`: the query, `project_name`
| `full_name`: project full name
| `short_name`: project short name
| `keyword`: keyword associated to the dataset
| `creator`: the mail of the author of the dataset
| `dateCreated`
| `descr`: decription of the dataset
| `originID`: ID of dataset
[...]
As an example, we can select the query showed above; imported_datasets_from_project and store it for the next step. As explained in the class method documentation, this function helps to identify which renku datasets were imported by a project, only by providing its name. Let's use it to query all datasets imported by one of the iris omnibenchmark; iris_accuracy metric project.
Prepare the query:
q = omni.getSparqlQuery.imported_datasets_from_project(project_name='iris_accuracy')
q
"\n PREFIX ns1:<http://www.w3.org/ns/prov#>\n PREFIX ns2:<https://swissdatasciencecenter.github.io/renku-ontology#>\n PREFIX ns3 [...]"
The output of any SPARQL query from getSparqlQuery can be used to query a specified triplestore with the query_from_sparql function (you can ask the URL of your benchmark by contacting the dev team)-
out = omni.query_from_sparql(q, URL = "http://imlspenticton.uzh.ch/omni_iris_sparql")
All queries typically return a dictionary or a list of dictionaries with fields describing your output. In this case, the function retrieves the following information about the datasets imported by the specified project:
out[0].keys()
> dict_keys(['query', 'full_name', 'short_name', 'keyword', 'creator', 'dateCreated', 'descr', 'originID'])
Metadata
Release files for omniSparql 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| omniSparql-0.0.3.tar.gz | 16.7 kB | Without provenance | Details for omniSparql-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| omniSparql-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for omniSparql-0.0.3-py3-none-any.whl |
Total release size: 29.4 kB
Release files / omniSparql-0.0.3.tar.gz
| Download URL | omniSparql-0.0.3.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26e3887b8d55329a78127491664a8ec728ebdafdbb0aa24101115ed8815c053b
|
|
BLAKE2b-256 checksum How to use checksums |
70255ee1057a1302ec9574ca961fde68183e2bd15dd2c71b9d000437db31f33e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.10
|
Release files / omniSparql-0.0.3-py3-none-any.whl
| Download URL | omniSparql-0.0.3-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
297e75c171399bb650cb32028ae7bb6c6c333af6d924ac5b9dd10ccbb3984127
|
|
BLAKE2b-256 checksum How to use checksums |
2f543b3b67d2f7988cd4ee17178d2845a70a51861bda2b95811c643f04a3fb33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.10
|
Security for omniSparql 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.