Replace the function ExtractUnitsFromMSL in MSL2OWL.py with code that reads the JSON output of export_modelica_units.py. ExtractUnitsFromMSL must accept the JSON file path as a parameter.
build_ontologies.py should check if this JSON file exists. If not, it should run export_modelica_units.py to generate it.
Background
Zsolt has provided a Python script, export_modelica_units.py, for extracting units from the Modelica Standard Library by using the Modelica compiler. This will result in higher-quality extraction of the Modelica units by taking into account the inheritance and equality relations between the units.
The function ExtractUnitsFromMSL in MSL2OWL.py should be replaced with code that reads the JSON output of export_modelica_units.py. This code will return a dictionary in the same format that ExtractUnitsFromMSL returns. GenerateOWLIndividualFileContent should be able to be re-used without modifications.
We do not want to re-generate the JSON file every time, because it is very slow, so we will assume that it exists. ExtractUnitsFromMSL must accept the path to the JSON file as a parameter. This parameter replaces the current parameter p_SIUnits, which points to the file SIUnits.mo. We will not be reading SIUnits.mo any more.
Tasks
ExtractUnitsFromMSL
in MSL2OWL.py with code that reads the JSON output of export_modelica_units.py.ExtractUnitsFromMSL
must accept the JSON file path as a parameter.Background
Zsolt has provided a Python script, export_modelica_units.py, for extracting units from the Modelica Standard Library by using the Modelica compiler. This will result in higher-quality extraction of the Modelica units by taking into account the inheritance and equality relations between the units.
The function
ExtractUnitsFromMSL
in MSL2OWL.py should be replaced with code that reads the JSON output of export_modelica_units.py. This code will return a dictionary in the same format thatExtractUnitsFromMSL
returns.GenerateOWLIndividualFileContent
should be able to be re-used without modifications.We do not want to re-generate the JSON file every time, because it is very slow, so we will assume that it exists.
ExtractUnitsFromMSL
must accept the path to the JSON file as a parameter. This parameter replaces the current parameterp_SIUnits
, which points to the file SIUnits.mo. We will not be reading SIUnits.mo any more.