Even though, the metamodel of MOF 1.4 is built in the Repository, there is still a way to treat MOF metamodels as models and them explicitly using the common mechanisms of Modelant:
modelFactory = modelRepository.initialize("MOF14"); model = modelFactory.instantiate("model extent name"); ... modelRepository.readIntoExtent(model, "model file path"); or modelFactory.readModel(model, "model file path");
When processing MOF metamodels (which are models, written in MOF 1.4), then use the pattern:
sourceExtent = repository.constructMofExtent( "SOURCE" ); repository.readIntoExtent( sourceExtent, sourceMetamodel );
For example, when comparing two metamodels:
repository.readIntoExtent( sourceExtent, sourceMetamodel ); repository.readIntoExtent( targetExtent, targetMetamodel ); compare = new CompareMof14Models(bindings, sourceExtent); result = compare.execute( targetExtent );
Usage:
<build> <plugins> <plugin> <groupId>net.mdatools</groupId> <artifactId>modelant.mof14.maven.plugin</artifactId> <version>${revision}</version> <executions> <execution> <phase>compile</phase> <goals> <goal>compare-metamodels</goal> </goals> <configuration> <sourceMetamodel>...</sourceMetamodel> <targetMetamodel>...</targetMetamodel> <equals> <equal> <source>Foundation::Data_Types</source> <target>Data_Types</target> </equal> ... <export implementation="net.mdatools.modelant.core.operation.model.export.StructuredTextExport"/> </equals> </configuration> </execution> </executions> </plugin> </plugins> </build>
where:
<export implementation="net.mdatools.modelant.core.operation.model.export.StructuredTextExport"/>
It exports the text in a JSON-like format, suitable for collapsing/expanding and manual analysis.