Introduction
This tutorial documents the demo_gui_use_case_trell.ipynb notebook, which implements a complete end-to-end pipeline:
Setup Project
Prepare simulation inputs and experimental data
Optimization
3-stage parameter identification (DE → NM → SS)
Validation
Independent validation against held-out data
KG Generation
7-node workflow: upload → Excel → TTL → CKAN
SPARQL Query
Retrieve calibrated parameters from Fuseki
Material Card Pass
HTML DPP with 6 SPARQL queries, published to CKAN
Calibration workflow
Original BAM sections — three-stage optimisation of SDCHABOX creep parameters for IN718.
Knowledge graph
New IWM integration — all results published to the BWMD ontology and indexed in Fuseki.
Material Card Pass
Auto-generated HTML report from 6 SPARQL queries, published to dataportal.material-digital.de.
Environment Setup
JupyterLab and the kernel must both come from pyiron_env. Mixing environments causes widget version mismatches and silent rendering failures.
Required packages
Step-by-step setup
Create the conda environment
# Use Miniforge Prompt or CMD (not PowerShell)
conda create -n pyiron_env python=3.12
conda activate pyiron_env
pip install pyiron-workflow pyironflow openpyxl requests rdflib pandas
Launch JupyterLab from within the environment
conda activate pyiron_env
jupyter lab "C:\path\to\Pyiron_Windows_06_10_2026\demo_gui_use_case_trell.ipynb"
Always launch from Miniforge Prompt or CMD. PowerShell does not honour conda activate for PATH switching, which causes the wrong anywidget version to be loaded.
Generate your CKAN API token
Required for the upload steps in Sections 4–6.
- Log in to dataportal.material-digital.de
- Click your username → My Profile
- Scroll to API Tokens → click Create API Token
- Copy the generated token and paste it into
ckan_upload_nodes.py→NEW_CKAN_TOKEN
Prepare configuration files
| File | Purpose |
|---|---|
Main.txt | Parameter names, bounds, initial values, MATERIAL_ID, MODEL_NAME, metadata |
Input.py | Optimizer settings, material_id/model_name variables, file path configuration |
sim/SDCHABOX.mat.tmpl | Parameter template for the simulator |
Validation/Validation.txt | Validation test configuration including MATERIAL_ID and MODEL_NAME |
Setup Project original BAM
The SetupProject node prepares all simulation inputs and pre-processes experimental data before the optimizer can run.
Notebook cell
import importlib
import setup_project_nodes as spn
from pyiron_workflow import Workflow
from pyironflow import PyironFlow
wf = Workflow("setup", delete_existing_savefiles=True)
wf.Setup = spn.SetupProject(
project_dir = 'C:/path/to/Pyiron_Windows_06_10_2026'
)
wf.run() # or: pf = PyironFlow([wf]); pf.gui for visual modePYTHON
Uncommenting pf.gui opens an interactive drag-and-drop workflow editor. It requires JupyterLab (not VSCode) and the correct anywidget version. For reliability, use wf.run() directly.
Optimization Process original BAM
Three-stage parameter identification strategy: a global search finds a good basin, then two local refinement stages converge to the optimum.
Key configuration in Main.txt
MODEL_NAME = SDCHABOX
MATERIAL_ID = IN718
SIMUL_PATH = C:/path/to/simulop.exeMAIN.TXT
Key configuration in Input.py
# Set material and model — determines output filenames
material_id = 'IN718'
model_name = 'SDCHABOX'
directories = Directories(
parameterFile = f'{material_id}_{model_name}.mat',
bestParameterFile= f'{material_id}_{model_name}.mat.best',
templateFile = f'{model_name}.mat.tmpl',
... # optimizer stages, log files, etc.
)PYTHON
sim/IN718_SDCHABOX.mat.best — final calibrated parameter values used by all downstream KG steps.
Info-Opt-v5/Plots/Creep_550-*.png — simulation vs. experiment comparison plots.
Validation original BAM
Runs independent validation against held-out experimental data (not used during calibration) to confirm the calibrated parameters generalise.
Notebook cell
from validation_node import run_validation_workflow
import os; os.chdir("Validation/")
results = run_validation_workflow("Validation.txt", verbose=True)
# Returns dict with: num_tests, num_passed, report path, metricsPYTHON
Configure Validation/Validation.txt
MATERIAL_ID = IN718
MODEL_NAME = SDCHABOX
OPTIMIZED_PARAMS_FILE = ../sim/IN718_SDCHABOX.mat.best
TEMPLATE_FILE = ../sim/SDCHABOX.mat.tmpl
SIMUL_PATH = C:/path/to/simulop.exeVALIDATION.TXT
KG Generation with CKAN Uploads new — IWM integration
A 7-node PyIron workflow that uploads all artefacts to CKAN first (to obtain stable URLs), then generates the knowledge-graph Excel template with URLs embedded, converts to Turtle RDF, and uploads the final TTL.
Notebook cell
project_dir = 'C:/path/to/Pyiron_Windows_06_10_2026'
MATERIAL_ID = 'IN718'
MODEL_NAME = 'SDCHABOX'
wf_kg = Workflow("kg_generation")
# STEP 1 — Zip experimental data
wf_kg.ZipExp = zipn.ZipExperimentalData(project_dir=project_dir)
# STEP 2 — Upload zip to CKAN → URL
wf_kg.UploadZip = ckan.UploadToCKAN(
ttl_file = wf_kg.ZipExp.outputs["str(zip_path)"],
description = "Experimental creep test data for calibration"
)
# STEP 3 — Upload material card → URL
wf_kg.UploadMatCard = ckan.UploadToCKAN(
ttl_file = f"{project_dir}/sim/{MATERIAL_ID}_{MODEL_NAME}.mat.best"
)
# STEP 4 — Upload validation report → URL
wf_kg.UploadReport = ckan.UploadToCKAN(
ttl_file = f"{project_dir}/Validation/results/{MATERIAL_ID}_{MODEL_NAME}_validation_report.txt"
)
# STEP 5 — Generate Excel KG template with URLs embedded
wf_kg.Excel = aen.PopulateExcel(
project_dir = project_dir,
exp_container_url = wf_kg.UploadZip.outputs["resource_url"],
material_card_url = wf_kg.UploadMatCard.outputs["resource_url"],
material_card_filename = f'{MATERIAL_ID}_{MODEL_NAME}.mat.best',
validation_report_url = wf_kg.UploadReport.outputs["resource_url"],
validation_report_filename= f'{MATERIAL_ID}_{MODEL_NAME}_validation_report.txt'
)
# STEP 6 — Convert Excel to Turtle RDF
wf_kg.TTL = ettn.ExcelToTTL(
excel_file = wf_kg.Excel.outputs["str(output_excel)"]
)
# STEP 7 — Upload TTL to CKAN
wf_kg.UploadTTL = ckan.UploadToCKAN(
ttl_file = wf_kg.TTL.outputs["str(ttl_path)"]
)
wf_kg.run()PYTHON
Uploading the TTL to CKAN does not automatically update the Fuseki triple store. After wf_kg.run() completes:
- Go to dataportal.material-digital.de/dataset/bam-sdchabox-workflow-kg
- Click the Fuseki tab
- Click Create / Update → confirm to load the new TTL
Until this step is done, SPARQL queries in Sections 5–6 return stale data from the previous load.
All resources land in dataset bam-sdchabox-workflow-kg at dataportal.material-digital.de · organization digitalmodelling.
Material Card Extraction via SPARQL new — IWM integration
Queries the Fuseki-backed knowledge graph to retrieve all calibrated SDCHABOX parameters for a material and exports them as a pivot-table CSV.
Notebook cell
MATERIAL_NAME = "IN718"
wf_sparql = Workflow("material_card_query")
wf_sparql.Query = sqn.QueryMaterialCard(
material_name = MATERIAL_NAME,
project_dir = PROJECT_DIR,
)
wf_sparql.run()
# Output channel name = the return expression string
csv_path = wf_sparql.Query.outputs["str(output_csv)"].valuePYTHON
Example output (pivot table)
| parameter | unit | calibrated_value | min_bound | max_bound | temperature_C |
|---|---|---|---|---|---|
| bk | — | 1.234 | 1.0 | 4.47 | 550 |
| bq | MPa | 48200.0 | -200000 | 200000 | 550 |
| sf | — | -9.31 | -15.0 | -3.0 | 550 |
| sk | MPa | 19.3 | 0.0 | 1500.0 | 550 |
| sn | — | 4.5 | 3.0 | 10.0 | 550 |
| … all CalibratedParameterSet parameters … | |||||
SPARQL endpoint
https://dataportal.material-digital.de/dataset/bam-sdchabox-workflow-kg/fuseki/$/sparql
# Pattern: {ckan_base}/dataset/{dataset_slug}/fuseki/$/sparql
# Method: POST (Content-Type: application/x-www-form-urlencoded)
# Auth: Authorization: <raw_jwt> (no "Bearer " prefix)SPARQL ENDPOINT
Material Card Pass (MCP) new — IWM integration
Generates a self-contained, browser-ready HTML Material Card Pass by running 6 SPARQL queries against the Fuseki knowledge graph. The result is published to CKAN and the download URL is returned.
Notebook cell
IDENTIFIER = "IN718" # material name OR full MaterialCard ID
PROJECT_DIR = 'C:/path/to/Pyiron_Windows_06_10_2026'
wf_mcp = Workflow("material_card_mcp")
wf_mcp.MCP = mcp.GenerateMaterialCardMCP(
identifier = IDENTIFIER,
project_dir = PROJECT_DIR,
)
wf_mcp.run()
ckan_url = wf_mcp.MCP.outputs["str(resource_url)"].value
print(f"MCP published: {ckan_url}")PYTHON
MCP HTML sections
| # | Section | SPARQL source | Typical rows |
|---|---|---|---|
| 1 | Provenance | Process label, timestamp, organization | 1 |
| 2 | Software & Equipment | SoftwareArchitecture, InfrastructureEquipmentSet, ProcessSetup | ~8 |
| 3 | Input & Control Parameters | hasControlInfo + input DataSet parameters | ~59 |
| 4 | Calibrated Parameters | CalibratedParameterSet (values, bounds, units) | ~16 |
| 5 | Linked Files | isInputFor + hasOutput (incl. MaterialCard, ValidationReport) | ~8 |
| 6 | Material Information | isRepresentativeFor → MaterialID | 1 |
The node accepts either a short material name ("IN718") or a full card ID ("IN718_SDCHABOX.mat.best"). It resolves to the MaterialCard identifier stored in the KG via two SPARQL fallback queries.
Dynamic Naming Convention
All output filenames are generated from MATERIAL_ID and MODEL_NAME. Changing the material or model only requires updating these values in Main.txt and Input.py — no hardcoded path edits elsewhere.
| File | Pattern | Example |
|---|---|---|
| Calibrated parameters | {MATERIAL_ID}_{MODEL_NAME}.mat.best | IN718_SDCHABOX.mat.best |
| Working parameter file | {MATERIAL_ID}_{MODEL_NAME}.mat | IN718_SDCHABOX.mat |
| Validation report | {MATERIAL_ID}_{MODEL_NAME}_validation_report.txt | IN718_SDCHABOX_validation_report.txt |
| MCP HTML | MCP_{card_id}.html | MCP_IN718_SDCHABOX.mat.best.html |
| SPARQL output CSV | material_card_{material_name}.csv | material_card_IN718.csv |
Where to change identifiers
| What | File | Key |
|---|---|---|
Material ID (e.g. IN718) | Main.txt | MATERIAL_ID = IN718 |
Model name (e.g. SDCHABOX) | Main.txt | MODEL_NAME = SDCHABOX |
| Optimizer file names | Input.py | material_id / model_name variables |
| Validation file names | Validation/Validation.txt | MATERIAL_ID / MODEL_NAME |
| CKAN dataset slug | ckan_upload_nodes.py | NEW_CKAN_DATASET |
| CKAN API token | ckan_upload_nodes.py | NEW_CKAN_TOKEN |
Troubleshooting
A helper function defined inside the @as_function_node body has its own return statement. PyIron's AST walker counts it. Fix: move all helpers to module level.
JupyterLab is served from base (anywidget 0.9.x) while the kernel is pyiron_env (anywidget 0.11.x). Always launch JupyterLab from within pyiron_env. Workaround: use display(pf.gui) explicitly, or just call wf.run().
The endpoint only accepts POST. GET returns 404. Pattern: {ckan_base}/dataset/{slug}/fuseki/$/sparql. UUID-based URLs do not work.
The Fuseki triple store was not refreshed after the last TTL upload. Go to the dataset on CKAN → Fuseki tab → Create/Update to reload. Also verify the MaterialCard identifier in the KG matches your current MATERIAL_ID_MODEL_NAME.mat.best naming.
The optimizer or validation node has not been run yet with the new MATERIAL_ID_MODEL_NAME naming convention. Either run those steps first, or copy the old files: SDCHABOX.mat.best → IN718_SDCHABOX.mat.best.
The Fuseki endpoint and the CKAN API both use the same JWT token. Set it as Authorization: <raw_token> without the "Bearer " prefix.
Use df.map(fn) instead of df.applymap(fn). This affects the MCP HTML table generation in mcp_dpp_node.py.