ZGIS / semantique

Semantic Querying in Earth Observation Data Cubes
https://zgis.github.io/semantique/
Apache License 2.0
16 stars 6 forks source link

feat: blockly visualisation of models :gift: #46

Closed fkroeber closed 1 month ago

fkroeber commented 3 months ago

Summary

This PR introduces the possibility to visualise models using the Blockly visual programming editor. Concept and/or application definitions (termed "mappings", respectively "recipes" in semantique terminology) are converted from json to xml structures that adhere to the schema definition of Blockly elements (-> relates to https://github.com/Sen2Cube-at/sen2cube.at/issues/368). The resulting xml file is then embedded in a html such that the model can be visualised and explored in a webbrowser as shown below. From the user's point of view, the complexity of the visualisation process is hidden and can be triggered by simply calling .visualise() for a specific mapping or recipe.

grafik

Implementation details and features

The implementation of the Blockly xml generation is essentially a reverse engineering of the existing XmlToJsonConverter(). The block definitions are based on the block definitions as used for Sen2Cube, which have been modified as follows:

The Html embedding of the xml file utilises a reduced subset of the Javascript-based functions offered in Sen2Cube. It contains the different model views (semantic vs. processing view) as used by Sen2Cube. It further offers an export function to render the model in png format. The Javascript also takes care of handling blocks that are not defined in Sen2Cube (e.g. custom verbs or custom measurements/layers).

Challenges & Future Developments

The conversion to label representations is still missing. All numeric types are currently represented as numbers. Representations as labels are feasible but there is no easy way of deciding when to use numbers vs. labels for the Blockly xml representation. This is due to the fact that in the original json structure of a model both types are represented equally as numeric values. Some sort of intelligent recipe evaluation process is needed to make an educated guess if these numeric values should be mapped as numbers or labels for each case. If they should be mapped as labels, one would additionally need to consider the data cube layout to lookup the label names.

Type of change

Select one or more relevant options:

Checklist: