# unipop-graph/unipop architecture

> Architecture diagram of the GitHub repository unipop-graph/unipop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unipop-graph/unipop
- Repository: https://github.com/unipop-graph/unipop

## Overview

##### Main Components
- Core Engine (Unipop Core): This module (located in the “unipop-core” directory) is where most of the business logic resides. It handles query processing (traversal steps, predicate processing, grouping, ordering, etc.), schema definitions, and execution strategies.
- Data Source Connectors/Providers: There are separate modules for different data sources:
– Unipop-elastic: Provides an implementation for integrating with ElasticSearch. It includes configuration resources and supports document- and nested-schema based graph elements.
– Unipop-jdbc: Handles JDBC-based integrations, providing schemas, controllers, and utilities for connecting to relational databases.
– Unipop-rest: Offers a RESTful interface with server-side endpoints (and related configurations and templates) for exposing the engine via HTTP APIs.
- Configuration and Resource Files: The multiple “resources/configuration” directories across modules indicate that the system is highly configurable to map data source schemas to a “property graph” model.
- Testing Modules: The “unipop-test” module contains integration and unit tests that exercise the engine and its connectors.

##### Relationships and Interactions
- Client Applications (Console, Embedded, Server): These consumers of Unipop, as outlined in the README (via “Getting Started”), initiate graph queries. They send requests to the engine over diverse interfaces (such as REST endpoints provided by unipop-rest).
- Core Query Processing: The engine receives a query which is processed in multiple layers (query parsing, traversal assembly, predicate translation, and execution strategies).
- Integration via Connectors: Once a query is processed, the core engine delegates data fetching/manipulation operations to the underlying source provider (Elastic, JDBC, or REST), each of which retrieves data from its respective data store.
- Configuration and Schema Mapping: Config files present in several modules inform how external data is mapped into the internal graph model (e.g., Vertex/Edge schema definitions are provided in unipop-core and supported by similar concepts in connector modules).

##### Architectural Patterns and Technologies
- Modular Design: The project is structured as a multi-module Maven project. Each module (core, elastic, jdbc, rest, test) encapsulates distinct responsibilities.
- Plugin/Extension Model: Through the usage of configuration files (like META-INF/services) and clearly separated “SourceProvider” classes, the system appears designed for extensibility – allowing additional data sources to be integrated easily.
- Layered Architecture: You have a separation between the presentation interfaces (REST, Console, Embedded) and the internal graph processing logic which then interfaces with external data services.
- Use of Apache Tinkerpop: Unipop leverages Apache Tinkerpop’s Gremlin framework to enable graph traversal and query language features.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client["Client Applications"]:::client
    Config["Configuration & Resources"]:::config
    Tinkerpop["Apache Tinkerpop/Gremlin"]:::external

    UCore["Unipop Core Engine"]:::core
    QP["Query Processing"]:::core
    SM["Schema Mapping"]:::core
    SE["Execution Strategy"]:::core

    Elastic["ElasticSearch Connector"]:::connector
    JDBC["JDBC Connector"]:::connector
    REST["REST Connector"]:::connector

    ES_DB["ElasticSearch Data Store"]:::external
    JDBC_DB["Relational Database"]:::external
    REST_DB["REST Data Source"]:::external

    Test["Testing Modules"]:::testing

    Client -->|"graph queries"| UCore
    UCore -->|"initiate"| QP
    Tinkerpop -->|"framework"| QP
    QP -->|"process"| SM
    Config -->|"configure"| SM
    SM -->|"execute"| SE
    SE -->|"delegate"| Elastic
    SE -->|"delegate"| JDBC
    SE -->|"delegate"| REST
    Elastic -->|"fetch"| ES_DB
    JDBC -->|"fetch"| JDBC_DB
    REST -->|"fetch"| REST_DB
    Test -->|"tests_engine"| UCore
    Test -->|"tests_connector"| Elastic
    Test -->|"tests_connector"| JDBC
    Test -->|"tests_connector"| REST

    click UCore "https://github.com/unipop-graph/unipop/tree/master/unipop-core"
    click Elastic "https://github.com/unipop-graph/unipop/tree/master/unipop-elastic"
    click JDBC "https://github.com/unipop-graph/unipop/tree/master/unipop-jdbc"
    click REST "https://github.com/unipop-graph/unipop/tree/master/unipop-rest"
    click Test "https://github.com/unipop-graph/unipop/tree/master/unipop-test"

    classDef client fill:#f4d03f,stroke:#333,stroke-width:2px;
    classDef core fill:#aed6f1,stroke:#333,stroke-width:2px;
    classDef connector fill:#82e0aa,stroke:#333,stroke-width:2px;
    classDef config fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef external fill:#fadbd8,stroke:#333,stroke-width:2px;
    classDef testing fill:#d5f5e3,stroke:#333,stroke-width:2px;
```
