The Semantiva is a modular and extensible framework designed to enable semantic transparency and ontology-driven processing for data operations.
Project description
Semantiva
Overview
The Semantiva is a modular and extensible framework designed to enable semantic transparency and ontology-driven processing for data operations. By leveraging concepts from ontology and context-aware computing, this framework provides tools for managing, processing, and interpreting data in a manner that aligns with predefined semantic rules and contexts.
This framework is particularly suited for applications where:
- Semantic transparency is essential for traceable and explainable operations.
- Ontologies guide the interpretation of data within well-defined domains.
Key Features
- Ontology Integration: Ensures data processing aligns with domain-specific ontologies, enabling standardized interpretation.
- Semantic Transparency: Maintains traceability and clarity for all operations, ensuring outputs are explainable.
- Modular Architecture: Facilitates the addition of new data types, operations, and contexts without disrupting the existing structure.
- Context-Aware Operations: Incorporates contextual knowledge into data processing workflows, adapting behavior dynamically.
- Extensibility: Provides abstract base classes and interfaces for creating custom data types and operations.
Components
1. Data Operations
Abstract classes and tools to define and execute operations on data, ensuring semantic consistency.
2. Context Operations
Manage contextual information that influences data processing, enabling adaptive workflows.
3. Payload Operations
Handle the execution and orchestration of processing nodes, encapsulating data operations and their associated contexts.
4. Data Types
Abstract and concrete implementations for handling different types of data with validation rules.
5. Execution Tools
Utility tools to streamline execution, monitoring, and debugging of data pipelines.
License
This project is licensed under the MIT License.
Appendix: Getting Started
This short guide helps you jump right in with a minimal example showcasing the Semantiva’s modular design. We’ll create and process a simple string literal rather than dealing with more complex domains like audio or images.
#########################
# Step 1: Define StringLiteralDataType
#########################
from semantiva.data_types import BaseDataType
class StringLiteralDataType(BaseDataType):
"""
Represents a simple string literal data type.
This class encapsulates a Python string, ensuring type consistency
and providing a base for operations on string data.
"""
def __init__(self, data: str):
"""
Initialize the StringLiteralDataType with the provided string.
Args:
data (str): The string data to encapsulate.
"""
super().__init__(data)
def validate(self, data):
"""
Validate that the provided data is a string literal.
Args:
data: The value to validate.
"""
assert isinstance(data, str), "Data must be a string."
#########################
# Step 2: Create a Specialized StringLiteralAlgorithm Using AlgorithmTopologyFactory
#########################
from semantiva.data_operations import AlgorithmTopologyFactory
# Dynamically create a base algorithm class for (StringLiteralDataType -> StringLiteralDataType)
StringLiteralAlgorithm = AlgorithmTopologyFactory.create_algorithm(
input_type=StringLiteralDataType,
output_type=StringLiteralDataType,
class_name="StringLiteralAlgorithm",
)
#########################
# Step 3: Define HelloOperation (Extending StringLiteralAlgorithm)
#########################
class HelloOperation(StringLiteralAlgorithm):
"""
A simple operation that modifies the input string to greet the inout
and returns the updated value as a new StringLiteralDataType.
"""
def _operation(self, data: StringLiteralDataType) -> StringLiteralDataType:
"""
Prepends "Hello, " to the input string and returns it as a new StringLiteralDataType.
Args:
data (StringLiteralDataType): The input data containing a Python string.
Returns:
StringLiteralDataType: The updated data containing the greeting.
"""
hello_data = f"Hello, {data.data}"
return StringLiteralDataType(hello_data)
#########################
# Step 4: Create a Pipeline Configuration Using HelloOperation
#########################
node_configurations = [
{
"operation": HelloOperation,
"parameters": {}, # No extra parameters needed
},
]
#########################
# Step 5: Instantiate and Use the Pipeline
#########################
from semantiva.payload_operations import Pipeline
if __name__ == "__main__":
# 1. Initialize the minimal pipeline with our node configurations
pipeline = Pipeline(node_configurations)
# 2. Create a StringLiteralDataType object
input_data = StringLiteralDataType("World!")
# 3. Run the pipeline
output_data, _ = pipeline.process(input_data, {})
# 4. Print final result
print("Pipeline completed. Final output:", output_data.data)
Summary
In these five simple steps, you’ve:
- Created a custom data type for strings (
StringLiteralDataType). - Leveraged the built-in
AlgorithmTopologyFactoryto generate aStringLiteralAlgorithm. - Extended that generic algorithm to define a specific operation (
HelloOperation). - Built a node configuration referencing
HelloOperation. - Instantiated a minimal pipeline and executed it, confirming everything works.
This approach shows how easy it is to scale from a “Hello World” scenario to more complex data transformations—just define new data types, create operations through the factory, and configure the pipeline. Once comfortable, you can explore domain-specific modules (audio, image, text, etc.) and advanced features like context observers or parallel execution.
Acknowledgments
This framework was inspired by the need for transparency and traceability in data-driven systems of the ALICE O2 computing system. It incorporates principles of ontology-driven design to ensure robust and interpretable workflows.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file semantiva-0.1.0.tar.gz.
File metadata
- Download URL: semantiva-0.1.0.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.22.2 CPython/3.10.12 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b2f5d09046c05cd5298278438dd98a17f202def52109a39b6e5948fe205b2ed
|
|
| MD5 |
4d820187ccbc7aca9554b6f8dfb92fb3
|
|
| BLAKE2b-256 |
661f8f7cb5d17eff466a5ad2a320788d7230f8eff4a6f0526170e7021a135445
|
File details
Details for the file semantiva-0.1.0-py3-none-any.whl.
File metadata
- Download URL: semantiva-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.22.2 CPython/3.10.12 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc0d4b7e9f98c2c64e2d086f9e7e81b3187a6e5f13728624b6b426084d08964d
|
|
| MD5 |
4f276d0f82a6da8c109ec49cc32d7375
|
|
| BLAKE2b-256 |
d684d52866db1b83cd0f357efc107e4b891c80ed40e0eb61d971cd7e29cab30f
|