Metadata-Version: 2.1
Name: gldb
Version: 1.0.0
Summary: Generic linked database approach to manage RDF and raw data together.
Home-page: https://github.com/matthiasprobst/generic-linked-database
Author: Matthias Probst
Author-email: matth.probst@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: appdirs
Requires-Dist: rdflib
Provides-Extra: test
Requires-Dist: pytest>=8.3.2; extra == "test"
Requires-Dist: pytest-cov>=5.0.0; extra == "test"
Requires-Dist: pandas; extra == "test"
Provides-Extra: tutorial
Requires-Dist: pandas; extra == "tutorial"
Provides-Extra: complete
Requires-Dist: pytest>=8.3.2; extra == "complete"
Requires-Dist: pytest-cov>=5.0.0; extra == "complete"
Requires-Dist: pandas; extra == "complete"

# generic-linked-database

![Tests Status](https://github.com/matthiasprobst/generic-linked-database/actions/workflows/tests.yml/badge.svg)
[![codecov](https://codecov.io/gh/matthiasprobst/generic-linked-database/branch/main/graph/badge.svg?token=2ZFIX0Z1QW)](https://codecov.io/gh/matthiasprobst/generic-linked-database)
![pyvers Status](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)

An approach to integrate multiple databases behind a unified interface. At least on database is intended to be 
an RDF database for metadata storage, the others are raw data storages like SQL or noSQL databases.

## Quickstart

### Installation

Install the package:

```bash
pip install gldb
```

### Example

An example exists as [Jupyter Notebook](docs/examples/Tutorial.ipynb) in `docs/examples/`. You may also try it online 
with Google Colab:

[![Open Quickstart Notebook](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/matthiasprobst/generic-linked-database/blob/main/docs/examples/Tutorial.ipynb)

## Design

### Abstractions

The package provides the following abstractions:

- `GenericLinkedDatabase`: The unified interface to interact with the semantic metadata and raw data storage
- `RDFStore`: The interface to interact with the semantic metadata storage
- `RawDataStore`: The interface to interact with the raw data storage
- `DataStoreManager`: The manager to interact with the different data stores
- `Query`: The interface to interact with the different data stores
- `RDFStoreQuery`: The interface to interact with the semantic metadata storage
- `RawDataStoreQuery`: The interface to interact with the raw data storage

### Class Diagram

```mermaid
classDiagram
    class GenericLinkedDatabase {
        <<abstract>>
        +StoreManager store_manager
        +linked_upload(filename)
        +execute_query(store_name, query)
    }

    class DataStoreManager {
        +stores: Dict
        +add_store(store_name, store)
        +get_store(store_name)
        +execute_query(store_name, query)
        +upload_file(store_name, filename)
    }

    class DataStore {
        <<abstract>>
        +execute_query(query)
        +upload_file(filename)
    }

    class RDFStore {
        <<abstract>>
        +execute_query(query)
        +upload_file(filename)
    }

    class RawDataStore {
        <<abstract>>
        +execute_query(query)
        +upload_file(filename)
    }

    class Query {
        <<abstract>>
        +execute(*args, **kwargs)
    }

    class RDFStoreQuery {
        <<abstract>>
    }

    class RawDataStoreQuery {
        <<abstract>>
    }
    
    class SparqlQuery {
        +sparql_query: str
        +execute(graph: rdflib.Graph)
    }

    %% Relationships
    GenericLinkedDatabase --> DataStoreManager
    GenericLinkedDatabase --> Query
    DataStoreManager --> DataStore
    DataStore <|-- RDFStore
    DataStore <|-- RawDataStore
    Query <|-- RDFStoreQuery
    Query <|-- RawDataStoreQuery
    RDFStoreQuery <|-- SparqlQuery : implements
```


