Skip to main content

A simple python API for creating, inserting, querying, and processing semantic data. This requires semantic services that are not included here

Project description

Semantic API

Versions

0.0.26 : Intial version with only the API for insertion and query.

Feature Element Status Comment
semantic data insertion capability complete
semantic data query capability complete
documentation of semantic and semantic.client methods and functions in-process
typelib in-process
type tools in-process
database tools minimum added in 22 in-process
chain tools in-process

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semantic_api-0.0.26.tar.gz (54.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semantic_api-0.0.26-py2.py3-none-any.whl (74.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file semantic_api-0.0.26.tar.gz.

File metadata

  • Download URL: semantic_api-0.0.26.tar.gz
  • Upload date:
  • Size: 54.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for semantic_api-0.0.26.tar.gz
Algorithm Hash digest
SHA256 2c0524ff9b5e536132ff329db69f40688bd1b4d02591b75bd57cb4330c529ffb
MD5 a4e28ad88d8f68d5c3c776a40090c1b1
BLAKE2b-256 6ab2f3b95b1bd4bba9c2a3ea2bbbb0434ee58c6696019d26f72d272487ebbbcb

See more details on using hashes here.

File details

Details for the file semantic_api-0.0.26-py2.py3-none-any.whl.

File metadata

  • Download URL: semantic_api-0.0.26-py2.py3-none-any.whl
  • Upload date:
  • Size: 74.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for semantic_api-0.0.26-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1e53e04ee64fd1b386a8fd0bf50c451ba3162b916fcf7b7eb8d37ca5a19ca74f
MD5 6f5faa32c21bfc513fd7ece10432e3f0
BLAKE2b-256 31e17ead9127e4827770ed21ccdad22e64b71c5c5487f49dbd92ff61b178236f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page