This project provides a simple web interface for decomposing variable definitions into the I-ADOPT ontology structure and visualizing the result.
The system combines:
- a Python backend that runs the LLM pipeline
- a JavaScript frontend that visualizes the generated RDF/Turtle (TTL)
The user can:
- enter a variable definition in plain text
- click Decompose
- inspect the raw LLM output
- inspect JSON schema validation errors
- view the generated TTL
- click Visualize
- see the I-ADOPT diagram
The project consists of two main parts.
Location:
backend/
The backend is responsible for running the LLM decomposition pipeline.
It performs the following steps:
- receives a variable definition from the frontend
- builds an LLM prompt
- calls the OpenRouter API
- extracts and parses the JSON output
- validates the output using a JSON Schema
- enriches components with Wikidata URIs
- converts the structured result to RDF/Turtle (TTL)
- returns the results to the frontend
The backend exposes a simple API:
POST /decompose
Input:
{
"definition": "My system is measuring air temperature at a height of 1.7m"
}
Output:
{
raw_llm_output,
parsed_json,
validation_errors,
ttl
}
Location:
frontend/
The frontend provides the interactive user interface.
It allows the user to:
-
enter a variable definition
-
send it to the backend
-
display:
- raw LLM output
- validation errors
- generated TTL
-
visualize the TTL using the I-ADOPT visualizer
-
export the current TTL or publish it as a nanopublication
The visualization is rendered as an SVG diagram.
The easiest way to run the project is using Docker Compose.
This will start:
- the backend container
- the frontend container
git clone (https://github.com/ArvinRastegar/i-adopt-service-website.git)
cd i-adopt-service-websiteCreate a file called:
.env
in the project root.
Inside the file add:
OPENROUTER_API_KEY=sk-or-xxxxxxxxxxxxxxxxxxxx
PSNC_API_KEY=your-psnc-api-key
NANOPUB_PRIVATE_KEY=base64-body-of-private-key
NANOPUB_ORCID_ID=0009-0006-1978-4302
NANOPUB_PROFILE_NAME=Barbara Magagna
NANOPUB_AGENT_INTRO_URI=https://w3id.org/np/RAwy2xTZzt5Y3ix-7f1HDTewgZqa6eRm5YnmrSKCy0PTA
Replace the keys with your OpenRouter API key and, if you want to use PSNC models, your PSNC API key.
These keys are used by the backend to call the selected LLM provider.
The nanopub values are used by the backend to sign and publish nanopublications from the frontend's Turtle payload.
NANOPUB_PRIVATE_KEY and NANOPUB_PUBLIC_KEY can be provided either as one-line base64 key bodies or as PEM strings with \n escapes.
Optional nanopub settings:
NANOPUB_PUBLIC_KEY=...
NANOPUB_AGENT_URI=...
NANOPUB_PROFILE_INTRODUCTION_URI=...
NANOPUB_LICENSE_URI=https://creativecommons.org/publicdomain/zero/1.0/
NANOPUB_USE_TEST_SERVER=false
MODEL_NAMES=qwen/qwen3.5-flash-02-23,qwen/qwen3-32b,qwen/qwen3.5-397b-a17b
PSNC_API_BASE_URL=https://llm.hpc.psnc.pl
PSNC_MODEL_NAME=Qwen3.5-397B-A17B
PSNC_MODEL_NAMES=Qwen3.5-397B-A17B,Qwen3-VL-235B-A22B-Instruct-FP8
From the project root run:
docker compose up --buildDocker will:
- build the backend image
- build the frontend image
- start both containers
Frontend:
http://localhost:5173
Backend API:
http://localhost:8000/docs
- Enter a variable definition in the first textbox.
Example:
My system is measuring air temperature at a height of 1.7m
- Click Decompose
You will see:
- raw LLM output
- schema validation results
- generated TTL
- Click Visualize
The I-ADOPT diagram will appear below.
Press:
CTRL + C
or run:
docker compose downi-adopt-service-website
│
├── backend
│ ├── app
│ │ └── main.py
│ ├── data
│ ├── requirements.txt
│ └── Dockerfile
│
├── frontend
│ ├── src
│ ├── css
│ ├── index.html
│ └── Dockerfile
│
├── docker-compose.yml
└── README.md
This project connects an LLM-based decomposition service with the I-ADOPT visualizer.
The backend performs the semantic decomposition and generates RDF.
The frontend provides a simple interface to explore the results and visualize the variable structure.
To load frontend and backend separately: in root directory: python3 -m uvicorn backend.app.main:app --reload --host 0.0.0.0 --port 8000 in frontend directory: pnpm dev Example of variable definition: Dynamic shear viscosity of polystyrene PS042 under the testing conditions of DIN 51810-1.