Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Parse OCL Constraints - Model Instance of an UML Profile
Parse OCL Constraints - Model Instance of an UML Profile [message #845236] Sat, 14 April 2012 22:21 Go to next message
John Guerson is currently offline John Guerson
Messages: 51
Registered: August 2011
Member
Hi,

-------
I have an UML Profile named as "AbcdUML" (only for example) and i have the metamodel in EMF/Ecore.

i.e. AbcdUML.ecore (metamodel)
i.e. myModelInstance.abcduml (model instance)

Now i have an OCl document with constraints against this model instance (not the metamodel).

i.e. MyConstraints.ocl

I need of these OCL constraints to make a transformation to another language.
--------

How can I parse this constraints against this specific model instance(*.abcduml) since the API only provide a binding to Ecore and UML models? I need to parse before to obtain the constraints, right?

Putting it simply, I need to parse the OCL to obtain the Constraints through API and then use a visitor to walk in the AST and make a transformation to another language.

My first solution was to transform my "MyModelInstance.abcduml" into a UML model instance.
So now I'm able to get the constraints and to make the transformation. Is there a better solution?
In this solution to UML i use the org.eclipse.ocl.uml and org.eclipse.ocl libraries.

Is there a way to do this without a binding to a UML/Ecore/AbcdProfile ?
In this case, how the the classifiers context and properties of OCL expressions will be recognized ?

Which library i have to use? And how to do this?

Regards,
John
Re: Parse OCL Constraints - Model Instance of an UML Profile [message #845501 is a reply to message #845236] Sun, 15 April 2012 05:30 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4045
Registered: July 2009
Senior Member
Hi

If you open MyConstraints.ocl in the Complete OCL editor, the editor
will parse the constraints for you.

MyModelInstance.abcduml already is a 'UML model instance' which is no
different to an 'Ecore model instance', so if you open it with the
reflective Ecore Model editor, you can invoke the Load Complete OCL
Resource menu action to add MyConstraints.ocl. (This long overdue
integration was added in JunoM6).

At the API level you may find the CompleteOCLEObjectValidator helpful.

You may find the Royal and Loyal example project helpful.

Regards

Ed Willink

On 14/04/2012 23:21, John G. wrote:
> Hi,
>
> -------
> I have an UML Profile named as "AbcdUML" (only for example) and i have
> the metamodel in EMF/Ecore.
>
> i.e. AbcdUML.ecore (metamodel) i.e. myModelInstance.abcduml (model
> instance)
>
> Now i have an OCl document with constraints against this model
> instance (not the metamodel).
> i.e. MyConstraints.ocl
> I need of these OCL constraints to make a transformation to another
> language.
> --------
>
> How can I parse this constraints against this specific model
> instance(*.abcduml) since the API only provide a binding to Ecore and
> UML models? I need to parse before to obtain the constraints, right?
>
> Putting it simply, I need to parse the OCL to obtain the Constraints
> through API and then use a visitor to walk in the AST and make a
> transformation to another language.
>
> My first solution was to transform my "MyModelInstance.abcduml" into a
> UML model instance. So now I'm able to get the constraints and to make
> the transformation. Is there a better solution?
> In this solution to UML i use the org.eclipse.ocl.uml and
> org.eclipse.ocl libraries.
>
> Is there a way to do this without a binding to a UML/Ecore/AbcdProfile
> ? In this case, how the the classifiers context and properties of OCL
> expressions will be recognized ?
>
> Which library i have to use? And how to do this?
>
> Regards,
> John
Re: Parse OCL Constraints - Model Instance of an UML Profile [message #845506 is a reply to message #845236] Sun, 15 April 2012 05:30 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4045
Registered: July 2009
Senior Member
Hi

If you open MyConstraints.ocl in the Complete OCL editor, the editor
will parse the constraints for you.

MyModelInstance.abcduml already is a 'UML model instance' which is no
different to an 'Ecore model instance', so if you open it with the
reflective Ecore Model editor, you can invoke the Load Complete OCL
Resource menu action to add MyConstraints.ocl. (This long overdue
integration was added in JunoM6).

At the API level you may find the CompleteOCLEObjectValidator helpful.

You may find the Royal and Loyal example project helpful.

Regards

Ed Willink

On 14/04/2012 23:21, John G. wrote:
> Hi,
>
> -------
> I have an UML Profile named as "AbcdUML" (only for example) and i have
> the metamodel in EMF/Ecore.
>
> i.e. AbcdUML.ecore (metamodel) i.e. myModelInstance.abcduml (model
> instance)
>
> Now i have an OCl document with constraints against this model
> instance (not the metamodel).
> i.e. MyConstraints.ocl
> I need of these OCL constraints to make a transformation to another
> language.
> --------
>
> How can I parse this constraints against this specific model
> instance(*.abcduml) since the API only provide a binding to Ecore and
> UML models? I need to parse before to obtain the constraints, right?
>
> Putting it simply, I need to parse the OCL to obtain the Constraints
> through API and then use a visitor to walk in the AST and make a
> transformation to another language.
>
> My first solution was to transform my "MyModelInstance.abcduml" into a
> UML model instance. So now I'm able to get the constraints and to make
> the transformation. Is there a better solution?
> In this solution to UML i use the org.eclipse.ocl.uml and
> org.eclipse.ocl libraries.
>
> Is there a way to do this without a binding to a UML/Ecore/AbcdProfile
> ? In this case, how the the classifiers context and properties of OCL
> expressions will be recognized ?
>
> Which library i have to use? And how to do this?
>
> Regards,
> John
Re: Parse OCL Constraints - Model Instance of an UML Profile [message #845511 is a reply to message #845236] Sun, 15 April 2012 05:30 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4045
Registered: July 2009
Senior Member
Hi

If you open MyConstraints.ocl in the Complete OCL editor, the editor
will parse the constraints for you.

MyModelInstance.abcduml already is a 'UML model instance' which is no
different to an 'Ecore model instance', so if you open it with the
reflective Ecore Model editor, you can invoke the Load Complete OCL
Resource menu action to add MyConstraints.ocl. (This long overdue
integration was added in JunoM6).

At the API level you may find the CompleteOCLEObjectValidator helpful.

You may find the Royal and Loyal example project helpful.

Regards

Ed Willink

On 14/04/2012 23:21, John G. wrote:
> Hi,
>
> -------
> I have an UML Profile named as "AbcdUML" (only for example) and i have
> the metamodel in EMF/Ecore.
>
> i.e. AbcdUML.ecore (metamodel) i.e. myModelInstance.abcduml (model
> instance)
>
> Now i have an OCl document with constraints against this model
> instance (not the metamodel).
> i.e. MyConstraints.ocl
> I need of these OCL constraints to make a transformation to another
> language.
> --------
>
> How can I parse this constraints against this specific model
> instance(*.abcduml) since the API only provide a binding to Ecore and
> UML models? I need to parse before to obtain the constraints, right?
>
> Putting it simply, I need to parse the OCL to obtain the Constraints
> through API and then use a visitor to walk in the AST and make a
> transformation to another language.
>
> My first solution was to transform my "MyModelInstance.abcduml" into a
> UML model instance. So now I'm able to get the constraints and to make
> the transformation. Is there a better solution?
> In this solution to UML i use the org.eclipse.ocl.uml and
> org.eclipse.ocl libraries.
>
> Is there a way to do this without a binding to a UML/Ecore/AbcdProfile
> ? In this case, how the the classifiers context and properties of OCL
> expressions will be recognized ?
>
> Which library i have to use? And how to do this?
>
> Regards,
> John
Re: Parse OCL Constraints - Model Instance of an UML Profile [message #845517 is a reply to message #845236] Sun, 15 April 2012 05:30 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4045
Registered: July 2009
Senior Member
Hi

If you open MyConstraints.ocl in the Complete OCL editor, the editor
will parse the constraints for you.

MyModelInstance.abcduml already is a 'UML model instance' which is no
different to an 'Ecore model instance', so if you open it with the
reflective Ecore Model editor, you can invoke the Load Complete OCL
Resource menu action to add MyConstraints.ocl. (This long overdue
integration was added in JunoM6).

At the API level you may find the CompleteOCLEObjectValidator helpful.

You may find the Royal and Loyal example project helpful.

Regards

Ed Willink

On 14/04/2012 23:21, John G. wrote:
> Hi,
>
> -------
> I have an UML Profile named as "AbcdUML" (only for example) and i have
> the metamodel in EMF/Ecore.
>
> i.e. AbcdUML.ecore (metamodel) i.e. myModelInstance.abcduml (model
> instance)
>
> Now i have an OCl document with constraints against this model
> instance (not the metamodel).
> i.e. MyConstraints.ocl
> I need of these OCL constraints to make a transformation to another
> language.
> --------
>
> How can I parse this constraints against this specific model
> instance(*.abcduml) since the API only provide a binding to Ecore and
> UML models? I need to parse before to obtain the constraints, right?
>
> Putting it simply, I need to parse the OCL to obtain the Constraints
> through API and then use a visitor to walk in the AST and make a
> transformation to another language.
>
> My first solution was to transform my "MyModelInstance.abcduml" into a
> UML model instance. So now I'm able to get the constraints and to make
> the transformation. Is there a better solution?
> In this solution to UML i use the org.eclipse.ocl.uml and
> org.eclipse.ocl libraries.
>
> Is there a way to do this without a binding to a UML/Ecore/AbcdProfile
> ? In this case, how the the classifiers context and properties of OCL
> expressions will be recognized ?
>
> Which library i have to use? And how to do this?
>
> Regards,
> John
Re: Parse OCL Constraints - Model Instance of an UML Profile [message #848139 is a reply to message #845517] Wed, 18 April 2012 01:05 Go to previous messageGo to next message
John Guerson is currently offline John Guerson
Messages: 51
Registered: August 2011
Member
Hi Edward,

I'm sorry but I still do not understand.

I'm opening MyConstraints.ocl with CompleteOCL Editor :
Right Click-> Open With
and importing the UML model :
import 'platform:/resource/ProjectName/model/myModel.uml`
But the ideal solution would be importing the UML profile:
import `platform:/resource/ProjectName/model/myModel.abcduml`
I tried to import this UML profile with the Complete OCL Editor and do not work.

Can you explain this more detailed?
Quote:

MyModelInstance.abcduml already is a 'UML model instance' which is no
different to an 'Ecore model instance', so if you open it with the
reflective Ecore Model editor, you can invoke the Load Complete OCL
Resource menu action to add MyConstraints.ocl. (This long overdue
integration was added in JunoM6).


I could open the "Reflective Ecore Model Editor" MyConstraints.ocl and with this editor that you mentioned import the model *.abcduml ?

I'll check the examples that you mentioned.

really appreciate your help
Thanks
John
Re: Parse OCL Constraints - Model Instance of an UML Profile [message #848389 is a reply to message #848139] Wed, 18 April 2012 07:12 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4045
Registered: July 2009
Senior Member
HI

You're trying to do something I've not done and so don't understand; I
don't use profiles.

Please provide a ZIP of your files with simple instructions on what you
cannot do.

Regards

Ed Willink

On 18/04/2012 02:05, John G. wrote:
> Hi Edward,
>
> I'm sorry but I still do not understand.
>
> I'm opening MyConstraints.ocl with CompleteOCL Editor :
> Right Click-> Open With
> and importing the UML model :
> import 'platform:/resource/ProjectName/model/myModel.uml`
> But the ideal solution would be importing the UML profile:
> import `platform:/resource/ProjectName/model/myModel.abcduml` I tried
> to import this UML profile with the Complete OCL Editor and do not work.
>
> Can you explain this more detailed?
> Quote:
>> MyModelInstance.abcduml already is a 'UML model instance' which is no
>> different to an 'Ecore model instance', so if you open it with the
>> reflective Ecore Model editor, you can invoke the Load Complete OCL
>> Resource menu action to add MyConstraints.ocl. (This long overdue
>> integration was added in JunoM6).
>
>
> I could open the "Reflective Ecore Model Editor" MyConstraints.ocl and
> with this editor that you mentioned import the model *.abcduml ?
>
> I'll check the examples that you mentioned.
>
> really appreciate your help
> Thanks
> John
>
Previous Topic:How to make query operation visible for OCL
Next Topic:how to use the context expressions in OCL
Goto Forum:
  


Current Time: Mon Sep 15 02:09:12 GMT 2014

Powered by FUDForum. Page generated in 0.01896 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software