Wiki

Clone wiki

smool / Configure

How to compile and generate SMOOL code (SMOOL Ontology Compilation guide )

Introduction

This page cover the steps required to compile and generate the code for SMOOL. NOTE: This should not be mandatory unless you plan to modify the core smool ontology. All the required elements are already in /trunk, so this is not needed to start working any longer, still, you can try though.

Adding new concepts to the ontology

The ontology is located in the "org.smool.sib.osgi" project. The name is "smool-core.owl". You can edit the ontology using an ontology tool such as Protégé.

You should erase the file "smoolcore.ontmodel" which is located in the eclipse runtime you are using for SMOOL. This is required since it should be regenerated when launching SMOOL with the new ontology.

Code Generation

Before compiling SMOOL it is necessary to generate part of the code of the tool. These generation processes are based on MDE techniques, and are executed by the tools and plugins installed during the environment preparation phase. The following sections will describe what plugins require code generation and how to do it.

1. org.smool.sdk.ontomodel

This plugin contains an internal SMOOL model used by the code generation wizard of the SDK. To generate it just follow these steps:

  • Right click on org.smool.sdk.ontmodel/model/myOwl.emf and click on Generate Ecore Model
  • Right click on the generated org.smool.sdk.ontmodel/model/myOwl.ecore and click on Eugenia/Generate EMF Genmodel
  • Right click on org.smool.sdk.ontmodel/model/myOwl.genmodel and click on Eugenia/Synchronize EMF Genmodel
  • Open org.smool.sdk.ontmodel/model/myOwl.genmodel
  • On the tree editor, right click on the root item and click on Generate Model Code

2. org.smool.sdk.owlparser

This plugin contains a parser for XML based OWL ontology files. This parser is used by the wizard to show the available concepts for the generation of producers and consumers. To generate the code related to this plugin, follow these steps:

  • Right click on org.smool.sdk.owlparser/src/org/smool/sdk/owlparser/GenerateOWLModel.mwe2 and click on Run as.../MWE2 Workflow
  • When the program prompts you for the antlr library just say "y".

After the code is generated it might be necessary to close the org.smool.sdk.owlparser.tests plugin, as it has a dependency to the com.google.inject.Injector class, which it is not part of SMOOL.

3. org.smool.kpi.j2se

The SMOOL clients or KPIs are based on a set on libraries that are required by the generated code to interact with the middleware. When a new project is created, the SMOOL SDK wizard will add these libraries to the new project. However, in order to do so, the libraries must be compiled and placed in the directory of the wizard plugin. To do this, an ant script is provided.

  • right click on org.smool.kpi.j2se/build.xml and click on Run as.../Ant Build...
  • select for execution the following Ant targets in the exact same order: clean, build, create-all-jars, deploy-all-jars
  • go to j2segenerator/kp_libs and refresh folder. The new jars should be there. Now you can run the derived eclipse and create KPs with the new libs.
  • change the version in the org.smool.sdk.wizard.j2segenerator/src/org/smool/sdk/wizard/j2segenerator/J2SEGeneratorActivator.java and in smool.thingml file

Updated