Semantic API
Versions
0.0.40 :
0.0.39 : queries.py to support matches_object_list and OR(query_object, ..., query_object)
0.0.38 : queries.py update
0.0.37 : object_queries and uri_for_name added
0.0.36 : minor changes such as improved error message on connection or request failure
0.0.35 : query_result method added to query_object
0.0.34 : query.py added to support the simplified query API
Install
pip3 install semantic-api
Use
Import
from semantic.api.semantic_api import semantic
from semantic.common.utils import defineSchemaId
from semantic.api.config import brokerIP, dbUri, batch_size
Schema context configuration
An ontology is assumed to built from a set of ontology clusters and identified by a schemaName, and a schemaVersion.
This schemaName-schemaVersion pair defines a schema instance in the database which is further identified by instanceName since it is common practice to have multiple logical instances in the database for the same ontology.
The function defineSchemaId(schemaName, schemaVersion, instanceName, dbUri) from semantic.common.utilsdefines and instance of the type SchemaID that is used to bind with the semantic context in the database.
The extra dbUri parameter provides the domain information of the schema and data and the JSON-LD @context that is returned in queries.
The Semantic API shall be instantiated before using api.narration or api.chain methods as these require a connection to the MQTT broker. Note that a database with the schemaName-schemaVersion-instanceName is assumed to be running along with a semantic service (out of scope of this project).
api = semantic( brokerIp, defineSchemaId(schemaName, schemaVersion, instanceName, dbUri), batch_size)
| Parameter | Use | Suggestion |
|---|---|---|
| brokerIP | MQTT Broker IP | use remote broker for project, default from config is 'localhost' |
| schemaName | identifying name for schema | according to defined schemas |
| schemaVersion | schema version | according to defined schemas |
| instanceName | database instance for schemaName-schemaVersion | suggest user defined instance assuming this has been created and instantiated with schema |
| dbUri | db IP:port URI | use default from config defined as 'http://127.0.0.1:6363/' |
Database client
The API supports a lower level database client semantic.clientthat is useful for database configuration tasks. Currently, only two methods are exposed on client but will be filled out and adequately documented to match the current service API. A commnand line version of this client libary will also be provided as the command line is more useful for maintenance than programtic use, as per the current node.js based semantic-client.
| semantic.client methods | return |
|---|---|
getSchemaId() |
SchemaID instance in service |
setSchemaId(schemaName, schemaVersion, instanceName) |
sets SchemaId instance (assumning current dBUri) |
The following section describes the usage of the API.
1 Semantic API
2 Background
3 RDF and Types
4 Editing Ontologies
Metadata
Release files for semantic-api 0.0.40
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 |
|---|---|---|---|---|
| semantic_api-0.0.40.tar.gz | 63.3 kB | Without provenance | Details for semantic_api-0.0.40.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| semantic_api-0.0.40-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for semantic_api-0.0.40-py2.py3-none-any.whl |
Total release size: 157.3 kB
Release files / semantic_api-0.0.40.tar.gz
| Download URL | semantic_api-0.0.40.tar.gz |
|---|---|
| Size | 63.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da76dbe3f57e8c975c43bdd5d7b4a172d56c85222e6237195785f2d96e956f63
|
|
BLAKE2b-256 checksum How to use checksums |
0cf45ac86a228228e93301b65d77f3f8269d1cb874be50ecbd30fd8ebb78469b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / semantic_api-0.0.40-py2.py3-none-any.whl
| Download URL | semantic_api-0.0.40-py2.py3-none-any.whl |
|---|---|
| Size | 94.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
bde6ae690d0535f22c2ff3f215c4748b2a2c607d674638822e980e2644359d2f
|
|
BLAKE2b-256 checksum How to use checksums |
b3039544867036cd8d146c0b565d9ff3577ecb2803fedf050e5199722162f786
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Security for semantic-api 0.0.40
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.