universAAL / tools.eclipse-plugins

Tools in form of Eclipse plugins that help developers use universAAL
2 stars 1 forks source link

Issue transforming .OWL files into .Java files #413

Closed cstockloew closed 7 years ago

cstockloew commented 7 years ago

Originally Opened: Pablo Coronado Barrios (2014-07-16 13:10:39) Originally Closed: 2015-05-26 18:04:29

Given an ontology(OWL file) created with Protege, transformation to UML (using "Transform2UML tool") works correctly. This UML created cannot be transformed into Java files. An example of this error is shown next:

Starting transformation: "OntologyUML2Java_3_0_0"

Validating model before transformation

--- Class Check --- Checking for unnamed Class or Class with the same name... OK! Class PERSSILAA_1101... 1 error(s), 1 warning(s)! Class PERSSILAA_1043... 1 error(s), 1 warning(s)! --- Associations Check --- Checking for unnamed Associations... 0 error(s), 38 warning(s)! Association <<unnamed>> (org.eclipse.uml2.uml.internal.impl.AssociationImpl@e301a3) between PERSSILAA_1060 and PERSSILAA_1078... OK! Association <<unnamed>> (org.eclipse.uml2.uml.internal.impl.AssociationImpl@142b9ae) between PERSSILAA_1108 and PERSSILAA_1078... OK! Association <<unnamed>> (org.eclipse.uml2.uml.internal.impl.AssociationImpl@9681e0) between PERSSILAA_1072 and PERSSILAA_1049... OK! Association <<unnamed>> (org.eclipse.uml2.uml.internal.impl.AssociationImpl@db9f36) between PERSSILAA_1017 and PERSSILAA_1043... OK!


Check Report: 332 problem(s) (136 error(s), 196 warning(s)) occurred when validating UML ontology model phThing

Class PERSSILAA_1101: Must derive directly or indirectly from one of the entities of the upper ontology !Class PERSSILAA_1101: No property found Class PERSSILAA_1043: Must derive directly or indirectly from one of the entities of the upper ontology !Class PERSSILAA_1043: No property found

!Found unnamed Association between PERSSILAA_1060 and PERSSILAA_1078 !Found unnamed Association between PERSSILAA_1108 and PERSSILAA_1078

======================================================================= Validaton errors found - please correct the model before transformation

Finished transformation: "OntologyUML2Java_3_0_0"

## Parsing 'OntologyUML2Java_3_0_0.m2t'
## Parsing 'OntologyUML2Java_2_0_0.m2t'
## Parsing 'OntologyUML2Java_1_3_0.m2t'
## Parsing 'OntologyUML2Java_1_2_0.m2t'
## Parsing 'OntologyUML2Java_1_1_0.m2t'
## Parsing 'validateOntUML.m2t'

Starting transformation: "OntologyUML2Java_3_0_0"

Validating model before transformation

Start validation of UML ontology model phThing

Class PERSSILAA_1071... 1 error(s), 1 warning(s)! Class PERSSILAA_1024... 1 error(s), 1 warning(s)!


Check Report: 332 problem(s) (136 error(s), 196 warning(s)) occurred when validating UML ontology model phThing

Class PERSSILAA_1087: Must derive directly or indirectly from one of the entities of the upper ontology !Class PERSSILAA_1087: No property found Class PERSSILAA_1002: Must derive directly or indirectly from one of the entities of the upper ontology !Class PERSSILAA_1002: Property PERSSILAA_1093: First character's name should be lowercase

Finished transformation: "OntologyUML2Java_3_0_0"

When creating an UML diagram using Papyrus, the UML2Java transformation works without any issue.

--

From: this issue has been automatically imported from our old issue tracker

cstockloew commented 7 years ago

Original author: @Alfiva (2014-07-16 14:40:42)

Would it be possible to get the OWL file you are using, together with the XML with the uAAL properties? If I try with one of the ontologies I already have I may not be able to reproduce the problem. If you don't want to post the OWL & XML files here you can send them to me via email.

BTW: Did you set the extra XML file I am talking about, before transforming to UML?

cstockloew commented 7 years ago

Original author: Pablo Coronado Barrios (2014-07-24 09:44:18)

I attach the .owl used, and both the .xml and .uml files generated with the owl2uml tools aswell. I hope this is the extra XML file u mean, as we didnt set any additional XML file

cstockloew commented 7 years ago

Original author: @Alfiva (2014-07-25 11:28:23)

I think I have found the origin of all this, and it is twofold: an incorrect procedure from your side and an actual bug in the tool. I will try to explain what you have to do to obtain the right result, by explaining the process and circumventing the bug:

1) First, when making ontologies for uAAL, your "root" concepts that now inherit from "Thing" should inherit from "ManagedIndividual", in uAAL data representation. It is just a matter of making those nodes subClassOf http://ontology.universAAL.org/uAAL.owl#ManagedIndividual instead of Thing.

2) Not critical, but you should edit your persilaa_v03.xml file to write your own customized properties. This is very important because there you define for instance the name of the generated package, which by default is phthing (which is a "system" ontology). So just edit that file to put your own names. And remove the AbstractClasses entries. These are used for defining Abstract ontology classes (something added by uAAL) but generally not needed.

3) Now comes the bug. Even if you follow the above required instructions, you will still get the errors when transforming from the UML to Java. This is because of a bug for which the generated UML file does not correctly reference outside classes (like ManagedIndividual) and replicates them inside itself. To overcome this bug, you can manually edit the UML file to properly reference the outside files: using the Eclipse UML editor, locate all your classes (in platform > Model > OwlOntology) that inherit from outside classes (in your case from ManagedIndividual). These will have a Generalization of Type ManagedIndividual. Click it and in the Properties View change the property General to org.universaal.middleware.owl::org.universAAL.middleware.owl::ManagedIndividual. Once you have changed all of those, find and remove the ManagedIndividual class that you will find in there too (the one generated within the UML file itself). Save the file and it should now be ready to transform to Java.

I know these instructions are a bit tricky but let me know if you have any trouble. Unfortunately I cannot fix this bug any time soon, so you will have to put up with this for now, sorry.

cstockloew commented 7 years ago

Original author: @Alfiva (2015-05-26 18:04:28)

The bug mentioned in the posts will not be fixed: the OWL-to-Java conversion will be superseded by a new tool (Protege plugin). If using the bugged tool, refer to the workaround mentioned above.

cstockloew commented 7 years ago

issue cloed on 2015-05-26 18:04:29