Metadata-Version: 2.4
Name: topologicpy
Version: 0.9.64
Summary: An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
License: GNU LESSER GENERAL PUBLIC LICENSE
        Version 3, 29 June 2007
        
        Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
        
        Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
        
        This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
        
        0. Additional Definitions.
        
        As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
        
        “The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
        
        An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
        
        A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
        
        The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
        
        The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
        
        1. Exception to Section 3 of the GNU GPL.
        
        You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
        
        2. Conveying Modified Versions.
        
        If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
        
        a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
        b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
        3. Object Code Incorporating Material from Library Header Files.
        
        The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
        
        a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
        b) Accompany the object code with a copy of the GNU GPL and this license document.
        4. Combined Works.
        
        You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
        
        a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
        b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
        c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
        d) Do one of the following:
        0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
        1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user’s computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
        e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
        5. Combined Libraries.
        
        You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
        
        a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
        b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
        6. Revised Versions of the GNU Lesser General Public License.
        
        The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
        
        Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
        
        If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy’s public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
Project-URL: Homepage, https://github.com/wassimj/TopologicPy
Project-URL: Bug Tracker, https://github.com/wassimj/TopologicPy/issues
Project-URL: Documentation, https://topologicpy.readthedocs.io
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
Classifier: Operating System :: OS Independent
Requires-Python: <3.15,>=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: COPYING
Requires-Dist: numpy>=1.18.0
Requires-Dist: scipy>=1.4.1
Requires-Dist: pandas
Requires-Dist: shapely
Requires-Dist: plotly
Requires-Dist: lark
Requires-Dist: webcolors
Requires-Dist: nbformat
Provides-Extra: test
Requires-Dist: pytest-xdist>=2.4.0; extra == "test"
Dynamic: license-file

# TopologicPy

<img src="https://topologic.app/wp-content/uploads/2023/02/topologicpy-logo-no-loop.gif" alt="topologicpy logo" width="250" loop="1">

# An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction

## Introduction
Welcome to **TopologicPy** (rhymes with *apple pie*). TopologicPy is a powerful, open-source Python library for spatial modelling, topology, graph analysis, and computational design in Architecture, Engineering, and Construction (AEC). It enables the creation and analysis of information-rich representations of architectural spaces, buildings, infrastructure, and other spatial systems by integrating **geometry, topology, semantics, graphs, and computation** within a coherent programming framework.

At the heart of TopologicPy is support for **non-manifold topology (NMT)**. Unlike conventional solid-modelling approaches, NMT allows entities of different dimensionalities to coexist within a single coherent model. Vertices, edges, surfaces, volumes, and their assemblies can therefore represent complex spatial and analytical systems while explicitly preserving their connectivity and adjacency relationships. This makes TopologicPy particularly well suited to applications in architectural space planning, building analysis, structural modelling, circulation and navigation, energy and environmental analysis, and other workflows in which relationships between entities are as important as their geometric form.

TopologicPy supports **mixed-dimensional models** naturally. For example, lines may represent beams, columns, circulation paths, or network connections; surfaces may represent walls, slabs, zones, or analytical boundaries; and volumes may represent rooms, buildings, or other spatial regions. These entities can coexist within the same topological structure and carry associated dictionaries and semantic information. This provides a flexible foundation for translating between geometric models, Building Information Models (BIM), analytical models, and graph-based representations.

A major strength of TopologicPy is its ability to transform spatial and topological models into **graphs**. Buildings and other spatial systems can be represented through nodes and edges describing adjacency, accessibility, containment, visibility, connectivity, or other relationships. TopologicPy provides graph algorithms for path finding, centrality, community detection, spatial analysis, and related operations, while also supporting integration with **Graph Machine Learning (GML)** workflows. These capabilities make it possible to investigate spatial configurations computationally and to apply machine-learning techniques to problems such as classification, prediction, pattern recognition, and inference over connected spatial data.

TopologicPy also supports **semantic and knowledge-based representations**. Its graph and ontology capabilities can be used to construct knowledge graphs, represent relationships derived from BIM and IFC data, perform reasoning, and connect spatial models with broader semantic information. This provides a foundation for workflows involving knowledge graphs, rule-based reasoning, graph databases, and emerging approaches such as GraphRAG and AI-assisted spatial analysis.

TopologicPy provides a comprehensive Python **Application Programming Interface (API)** designed for scripting, Jupyter notebooks, computational design workflows, research applications, and integration into larger software systems. Its geometry and topology capabilities are currently powered primarily by **PythonOCC/OpenCASCADE**, providing access to the mature Open CASCADE geometric modelling kernel through Python. TopologicPy also maintains support for alternative topology backends, allowing the Python API to remain increasingly independent of any single underlying geometry engine.

Interoperability is an important part of the library. TopologicPy supports widely used formats and workflows including **IFC, BREP, OBJ, STL, DXF, JSON, CSV, RDF/TTL, and HBJSON**, among others. Its IFC capabilities enable geometric, topological, spatial, and semantic information to be extracted from Building Information Models and transformed into structures suitable for analysis, graph generation, reasoning, and downstream computational workflows.

TopologicPy is distributed as open-source software under the **[GNU Lesser General Public License (LGPL)](https://opensource.org/license/lgpl-3-0)**. This allows it to be used, extended, embedded, and integrated into both research and professional workflows without dependence on proprietary subscription-based platforms. The library is designed to provide an extensible computational foundation on which researchers, designers, engineers, educators, and software developers can build their own spatial analysis and design tools.

TopologicPy can be used interactively in Python and Jupyter environments, incorporated into automated analysis pipelines, or embedded within larger applications. By bringing together **geometry, non-manifold topology, graph computation, semantics, and artificial intelligence**, TopologicPy provides a flexible platform for computationally understanding and working with the spatial relationships that underpin the built environment.

## Installation

### Recommended: Conda

TopologicPy can be installed from conda-forge:

```bash
conda create -n topologicpy -c conda-forge topologicpy
conda activate topologicpy
```

### Pip

TopologicPy can also be installed from PyPI:

```bash
pip install topologicpy --upgrade
```

## Prerequisites

TopologicPy requires Python 3.8 or newer and currently supports Python versions below 3.15.

### Core Dependencies

TopologicPy depends on the following Python libraries:

<details>

<summary><b>Expand to view dependencies</b></summary>

* [numpy](https://numpy.org/) >= 1.18.0
* [scipy](https://scipy.org/) >= 1.4.1
* [pandas](https://pandas.pydata.org/)
* [shapely](https://shapely.readthedocs.io/)
* [plotly](https://plotly.com/python/)
* [lark](https://github.com/lark-parser/lark)
* [webcolors](https://pypi.org/project/webcolors/)
* [nbformat](https://nbformat.readthedocs.io/)

</details>

These dependencies are installed automatically when TopologicPy is installed.

### Geometry and Topology Backend

TopologicPy requires a geometry and topology backend.

When TopologicPy is installed from **conda-forge**, the recommended
[pythonocc-core](https://github.com/tpaviot/pythonocc-core) backend is installed automatically:

```bash
conda create -n topologicpy -c conda-forge topologicpy
conda activate topologicpy
```

## How to start using TopologicPy
1. Open your favourite python editor ([jupyter notebook](https://jupyter.org/) is highly recommended)
1. Type 'import topologicpy'
1. Start using the API


## Ontology and Semantic Web Support

topologicpy now includes a formal ontology specification that provides a semantic framework for representing geometry, topology, graphs, spatial relationships, building information, provenance, and analytical metrics.

The ontology enables interoperability with:

* RDF / RDFS / OWL
* BOT (Building Topology Ontology)
* Brick Schema
* IFC and Linked Building Data workflows
* Graph databases such as Neo4j and Kùzu
* GraphRAG and AI reasoning systems

The canonical namespace is:

`@prefix top: <http://w3id.org/topologicpy#> .`

The ontology is persistently identified through w3id.org and physically hosted through GitHub Pages.

### Ontology Resources

* Ontology namespace: `http://w3id.org/topologicpy#`
* Ontology document: `http://w3id.org/topologicpy`
* Current ontology specification:
  `https://wassimj.github.io/topologicpy/ontology/topologicpy.ttl`
* Ontology source folder:
  `https://github.com/wassimj/topologicpy/tree/main/ontology`

### Example

```ttl
@prefix top: <http://w3id.org/topologicpy#> .

:room_101 a top:Room ;
    top:hasArea "24.6"^^xsd:double ;
    top:adjacentTo :corridor_1 .

:wall_12 a top:Wall ;
    top:bounds :room_101 .
```

### Python Example

```python
from topologicpy.Ontology import Ontology

Ontology.SetClass(cell, "top:Room")
Ontology.SetLabel(cell, "Room 101")
Ontology.SetCategory(cell, "space")

ttl = Ontology.TTLString(cell)
print(ttl)
```


## API Documentation
API documentation can be found at [https://topologicpy.readthedocs.io](https://topologicpy.readthedocs.io)

## How to cite topologicpy
If you wish to cite the actual software, you can use:

**Jabi, W. (2024). topologicpy. pypi.org. http://doi.org/10.5281/zenodo.11555172**

To cite one of the main papers that defines topologicpy, you can use:

**Jabi, W., & Chatzivasileiadi, A. (2021). Topologic: Exploring Spatial Reasoning Through Geometry, Topology, and Semantics. In S. Eloy, D. Leite Viana, F. Morais, & J. Vieira Vaz (Eds.), Formal Methods in Architecture (pp. 277–285). Springer International Publishing. https://doi.org/10.1007/978-3-030-57509-0_25**

Or you can import the following .bib formatted references into your favourite reference manager
```
@misc{Jabi2025,
   author = {Wassim Jabi},
   doi = {https://doi.org/10.5281/zenodo.11555173},
   title = {topologicpy},
   url = {http://pypi.org/projects/topologicpy},
   year = {2025},
}
```
```
  @inbook{Jabi2021,
   abstract = {Topologic is a software modelling library that supports a comprehensive conceptual framework for the hierarchical spatial representation of buildings based on the data structures and concepts of non-manifold topology (NMT). Topologic supports conceptual design and spatial reasoning through the integration of geometry, topology, and semantics. This enables architects and designers to reflect on their design decisions before the complexities of building information modelling (BIM) set in. We summarize below related work on NMT starting in the late 1980s, describe Topologic’s software architecture, methods, and classes, and discuss how Topologic’s features support conceptual design and spatial reasoning. We also report on a software usability workshop that was conducted to validate a software evaluation methodology and reports on the collected qualitative data. A reflection on Topologic’s features and software architecture illustrates how it enables a fundamental shift from pursuing fidelity of design form to pursuing fidelity of design intent.},
   author = {Wassim Jabi and Aikaterini Chatzivasileiadi},
   city = {Cham},
   doi = {10.1007/978-3-030-57509-0_25},
   editor = {Sara Eloy and David Leite Viana and Franklim Morais and Jorge Vieira Vaz},
   isbn = {978-3-030-57509-0},
   journal = {Formal Methods in Architecture},
   pages = {277-285},
   publisher = {Springer International Publishing},
   title = {Topologic: Exploring Spatial Reasoning Through Geometry, Topology, and Semantics},
   url = {https://link.springer.com/10.1007/978-3-030-57509-0_25},
   year = {2021},
}
```

topologicpy: © 2026 Wassim Jabi
