https://github.com/os-climate/sostrades-ontology
https://github.com/os-climate/sostrades-ontology
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/os-climate/sostrades-ontology
- Owner: os-climate
- License: apache-2.0
- Created: 2022-04-04T16:08:57.000Z (about 3 years ago)
- Default Branch: validation
- Last Pushed: 2025-04-09T18:42:32.000Z (about 2 months ago)
- Last Synced: 2025-04-09T19:41:36.089Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 6.95 MB
- Stars: 4
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> [!IMPORTANT]
> On June 26 2024, Linux Foundation announced the merger of its financial services umbrella, the Fintech Open Source Foundation ([FINOS](https://finos.org)), with OS-Climate, an open source community dedicated to building data technologies, modeling, and analytic tools that will drive global capital flows into climate change mitigation and resilience; OS-Climate projects are in the process of transitioning to the [FINOS governance framework](https://community.finos.org/docs/governance); read more on [finos.org/press/finos-join-forces-os-open-source-climate-sustainability-esg](https://finos.org/press/finos-join-forces-os-open-source-climate-sustainability-esg)# SoS Ontology
This is SoSTrades Ontology project.
It contains:
- the SoSTrades TBox (the ontology classes) used to create the SoSTrades ontology
- all the necessary code to generate the SoSTrades Ontology from parsing the Python code
- the SoSTrades Ontology API server and code## SoSTrades Ontology install
`pip install -r requirements.in --trusted-host pypi.org --trusted-host files.pythonhosted.org`## Update Ontology
The update process can be done through a Jenkins job or locally by running `python ontology\sos_ontology\core\script\createSoSOntologyFromCode.py`
## API Start
If you want to run the ontology API locally:`python sos_ontology\rest_api\api.py`
### Prerequisite
To be able to run correctly this script:
- ALL repositories must be cloned on the local environment and present on the Python PATH otherwise the models / process of the repositories that are not present will not appear on the updated ontology### Update process
### Files generated
Once the script is DONE, it will have created the files:
- `\data\sos_ontology\SoSTrades_Ontology_ABox_Decentralized.owl`
- `\data\logs\ontologyCreationLogs.json`
- `\data\terminology\SoS_Trades_Terminology_ABox.xlsx`## Ontology metadata
The ontology contains entities and information extracted from the code.
Each entity can be complemented with metadata like `label` or `description`. For that, these information must be stored in a specific format.
- For **Process Repository**, metadata are located in the file `__init__.py` present in the folder of the process repository:
- `label`= ``
- `description`= ``
- For **Process**, metadata are located in the ProcessBuilder Class of the process, in a class parameter named `_ontology_data`:
- `_ontology_data: {`
- `'label': ,`
- `'description': ,`
- `'category': ,`
- `'version': ,}`
- For **Discipline**, metadata are located in the SoSDiscipline Class of the discipline, in a class parameter named `_ontology_data`:
- `_ontology_data: {`
- `'label': ,`
- `'type': ,`
- `'source': ,`
- `'validated': ,`
- `'validated_by': ,`
- `'last_modification_date': ,`
- `'category': ,`
- `'definition': ,`
- `'icon': ,`
- For the icons, the class name is always like fa- can be personalised.
Using prefixes: fas for solid style, far for regular, fal for light, fad for duotone
Same width icon with adding suffix fa-fw
- For **Parameters**, metadata are located in a `parameters_glossary.csv` file at the root folder of each repository.
- `Id: name of parameter in the code`
- `Label: human readable label for the parameter`
- `Unit: unit of the parameter`
- `Definition: definition of the parameter`
- `DefinitionSource: source information for the definition if relevant`
- `ACLTag: Airbus Common Language Tag`
## Ontology Repository Details
### Code Details#### **\core\functions\ontology_to_terminology.py**
Function able to transform any Ontology content into an SoSTerminology. Basically it exports an OWL Ontology into an Excel file.
#### **\core\functions\sendGChatNotifications.py**Function use to send notification on Google Chat via webhook. It is used at the end of the update script to inform users about the status of the update.
#### **\core\script\createSoSOntologyFromCode.py**
Script to generate the SoSTrades Ontology from the parsing of the all repositories code.
#### **\core\sos_entities\\...**Classes that represent each ontology entity used during the update script.
#### **\core\ontology.py**
Class defining an Ontology based on RDFLib. It contains basic function to load OWL file, explorer them and update them.
#### **\core\sos_decentralized_codedataextractor.py**
Class to read and parse Python code to look for entities and generate sos entities class instances for each.
#### **\core\sos_ontology.py**
SoS_Ontology class that uses the Ontology class and implement it for the SoS Ontology
It adds specific methods to interact with the SosTrades Ontology#### **\core\sos_terminology.py**
SoS_Terminology class based on openpyxl to interact with Excel files. Allows to open, edit, saves files.
#### **\core\sos_toolbox.py**
SoS_Toolbox class that contains common methods that can be used everywhere
### Files Details
#### **\data\sos_ontology\SoSTrades_Ontology_ABox_Decentralized.owl**
Generated version of the SoSTrades Ontology with all the classes and individuals
#### **\data\sos_ontology\SoSTrades_Ontology_TBox.owl**
ABox for the SoSTrades Ontology. It contains all the OWL classes but without the instances. It is the base from which we construct the SoSTrades ontology.
#### **\data\terminology\SoS_Trades_Terminology_ABox.xlsx**
This file is an Excel export of the current SoSTrades Ontology. It is generated by the update_ontology script
#### **\data\logs\SoS_Trades_Terminology_ABox.xlsx**This file contains all the logs generated by the last ontology update script. There are information logs, warning logs and errors logs inside
## SoSOntology Concept
Details of the concepts (classes) in the SoSTrades Ontology

## License
The sostrades-ontology source code is distributed under the Apache License Version 2.0.
A copy of it can be found in the LICENSE file.The sostrades-ontology product depends on other software which have various licenses.
The list of dependencies with their licenses is given in the CREDITS.rst file.