Skip to main content

OBA Sparql Query Manager Build Status codecov

OBA Sparql Query Manager is a Python Module to translate CRUD requests to SPARQL queries. This module is used by OBA project to generate a REST API from OWL ontologies.

OBA sparql use JSON-LD contexts to translate RDF triples to JSON, and vice versa.

Quick Start

Generate the context files

Simply speaking, a context is used to map terms to IRIs. Terms are case sensitive and most valid strings that are not reserved JSON-LD keywords can be used as a term.

To generate the context files, we recommend to use:

  1. OBA
  2. owl2jsonld

TODO: Insert a good example.

from obasparql import QueryManager
from test.settings import dbpedia_queries, dbpedia_context, dbpedia_endpoint, dbpedia_prefix
from obasparql.static import * 
queries = "queries/"
contexts = "contexts/"
dbpedia_endpoint = "https://dbpedia.org/sparql"
dbpedia_prefix = "http://dbpedia.org/resource"
graph = None

query_manager = QueryManager(queries_dir=queries,
                                  context_dir=contexts,
                                  endpoint=dbpedia_endpoint,
                                  named_graph_base=graph,
                                  uri_prefix=dbpedia_prefix)

query_manager.get_one_resource()
query_manager.get_all_resource()

Supported features

OBA sparql supports two types of queries:

  • Default queries: queries related to the CRUD requests.
    • Get a resource and get all the resource by type.
  • Custom queries: In some cases, users need to implement custom queries that are not the default instances of a class of the ontology (e.g., get all instances of a class that comply with certain conditions)

Default queries

Custom queries

Testing

This repository is using pytest for the testing

$ pip install -r test-requirements.txt
$ pytest

For more information. You can inspect the file .travis.yaml

Metadata

Release files for obasparql 5.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for obasparql 5.0.3
File Size Uploaded Provenance Actions
obasparql-5.0.3.tar.gz 22.0 kB Without provenance Details for obasparql-5.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for obasparql 5.0.3
File Interpreter ABI Platform Actions
obasparql-5.0.3-py3-none-any.whl Python 3 none any Details for obasparql-5.0.3-py3-none-any.whl

Total release size: 43.3 kB

Release files / obasparql-5.0.3.tar.gz

Download URL obasparql-5.0.3.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d695c69fbc0ee671c47b6f0adaf203f498c03bf329ed0c0952e8f9ca40ac9eee
BLAKE2b-256 checksum
How to use checksums
2dbfcf8fe7bf2474162bd4e6854d4482db113eb7049ba750abe111173c9482f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / obasparql-5.0.3-py3-none-any.whl

Download URL obasparql-5.0.3-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b75f1fac79753ef389239bdb42118decfd2adc688973d78d3279d8fc1127f28a
BLAKE2b-256 checksum
How to use checksums
e38bace684721fd27ffed9ac8cabfc9d1d658a620742ba7b245419b2b9c0ebfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for obasparql 5.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.

Release history Release notifications | RSS feed

This release

5.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page