# fiware/ngsi-ld_experimental architecture

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

- Interactive diagram: https://gitdiagram.com/fiware/ngsi-ld_experimental
- Repository: https://github.com/fiware/ngsi-ld_experimental

## Overview

##### Main Components

a) Client Layer:
- External NGSI-LD API consumers
- Supported HTTP endpoints (/ngsi-ld/v1/entities/, /version, /configuration)

b) NGSI-LD Wrapper Core:
- REST API Layer (represented by NgsiLdWrapper.scala)
- Model Mapping Layer:
- Ngsi2LdModelMapper (NGSI-v2 to NGSI-LD conversion)
- Ld2NgsiModelMapper (NGSI-LD to NGSI-v2 conversion)
- JSON Processing:
- JSONParser
- JsonSerializer

c) Utility Components:
- Context Resolution (LdContextResolver)
- Expression Filtering (ExpressionFilterParser)
- NGSI Client (for communicating with backend)

d) Backend Integration:
- FIWARE Context Broker (Orion)
- NGSI-v2 protocol connection

##### Component Relationships

- Incoming NGSI-LD requests → REST Layer
- REST Layer → Model Mappers
- Model Mappers ↔ JSON Processing
- Model Mappers → NGSI Client
- NGSI Client → FIWARE Context Broker

##### Additional Elements

- Version information
- Deployment options (Docker, standalone)
- Main data transformation flows

##### Important Notes

- Proxy/wrapper nature of the system
- Clear separation between NGSI-LD and NGSI-v2 protocols
- Model mapping functionality
- Error handling components

##### Technical Details

- Scala/Java runtime environment
- Web container (Jetty)
- Docker deployment support
- Configuration parameters

Remember to indicate this is an experimental/archived project and point to current alternatives (Orion-LD, Scorpio Broker, Stellio Context Broker) in the documentation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        CLIENTS[External NGSI-LD API Consumers]
        ENDPOINTS["/ngsi-ld/v1/entities/\n/version\n/configuration"]
    end

    subgraph Wrapper["NGSI-LD Wrapper Core"]
        subgraph API["REST API Layer"]
            REST[NgsiLdWrapper]:::core
            ERR[Error Handlers]:::core
        end

        subgraph Mapping["Model Mapping Layer"]
            N2L[Ngsi2LdModelMapper]:::core
            L2N[Ld2NgsiModelMapper]:::core
        end

        subgraph JSON["JSON Processing"]
            PARSER[JSONParser]:::util
            SERIAL[JsonSerializer]:::util
        end

        subgraph Utils["Utility Components"]
            CONTEXT[LdContextResolver]:::util
            FILTER[ExpressionFilterParser]:::util
            NGSI[NgsiClient]:::util
        end

        subgraph Config["Configuration"]
            CONF[Configuration]:::util
            JETTY[JettyLauncher]:::util
        end
    end

    subgraph Backend["Backend Layer"]
        ORION[FIWARE Context Broker]:::external
    end

    %% Relationships
    CLIENTS --> ENDPOINTS
    ENDPOINTS --> REST
    REST --> ERR
    REST --> N2L & L2N
    N2L & L2N <--> PARSER & SERIAL
    N2L & L2N --> NGSI
    NGSI --> ORION
    REST --> CONTEXT
    REST --> FILTER
    CONF --> REST

    %% Styling
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef util fill:#FFC107,stroke:#FFA000,color:black
    classDef external fill:#4CAF50,stroke:#388E3C,color:white

    %% Click events
    click REST "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/rest/NgsiLdWrapper.scala"
    click N2L "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/fiware/Ngsi2LdModelMapper.scala"
    click L2N "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/fiware/Ld2NgsiModelMapper.scala"
    click PARSER "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/json/JSONParser.scala"
    click SERIAL "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/json/JsonSerializer.scala"
    click CONTEXT "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/utils/LdContextResolver.scala"
    click FILTER "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/utils/ExpressionFilterParser.scala"
    click NGSI "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/utils/NgsiClient.scala"
    click CONF "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/main/Configuration.scala"
    click ERR "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/rest/LdErrors.scala"
    click JETTY "https://github.com/FIWARE/NGSI-LD_Experimental/blob/master/src/main/scala/main/JettyLauncher.scala"
```
