How rwth-e3d/ifc2tso works
Project Type and Purpose
• This is a modular, command-line pipeline application (IFC2TSO) written in Python 3.7. It ingests IFC (Industry Foundation Classes) building models, transforms them into an internal graph representation, enriches and simplifies that graph, and finally exports a technical system ontology (TSO).
• The “modules” directory contains three independent pipeline stages (IFC2GRAPH, GRAPH, GRAPH2TSO), each with its own conda environment. The top-level “src” directory provides a unified entry point (src/main.py) that calls all stages in sequence.
Core Components
a. Input Layer
• IFC Models on disk (user-supplied .ifc files)
b. Processing Modules (each a Python package + environment)
1. IFC2GRAPH
• Parses IFC via ifcopenshell
• Builds an initial NetworkX graph of building elements
2. GRAPH
• Analyzes, enriches, reduces graph topology (helper_analyse.py, helper_enrich.py)
3. GRAPH2TSO
• Converts graph → TSO ontology using rdflib, yields RDF/XML or JSON-LD
c. Orchestrator
• src/main.py with argparse handles user flags, invokes each module in order
d. Output Layer
• Text logs, JSON, BCF files, RDF/OWL produced in the model path
Relationships & Data Flow
• Logging and intermediate storage occurs at each stage (TXT, JSON, BCF)
Architectural Patterns & Design Principles
• Pipeline pattern: discrete, reusable stages that can run independently or chained
• Modular packaging: each module has its own conda env (reproducibility, isolation)
• Single-responsibility: helpers are separated (analyse, enrich, convert, check)
• CLI façade: unified interface with fine-grained flags
Key Technologies
• Python 3.7.12
• Conda environments (env/environment.yml, modules/*/env/environment.yml)
• ifcopenshell (IFC parsing)
• NetworkX (graph handling)
• Rtree, trimesh, NumPy (spatial queries)
• rdflib (ontology serialization)
• lxml (BCF file creation)
Must‐Include
• Clear component names (IFC2GRAPH, GRAPH, GRAPH2TSO, Orchestrator)
• Modules (blue rectangles)
• Orchestrator (orange hexagon)
• Annotations of file formats and major helper scripts