Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » PluginUML2: Validating a uml diagram(which class implements the validation of an UML diagram )
icon9.gif  PluginUML2: Validating a uml diagram [message #1728029] Wed, 30 March 2016 11:11 Go to next message
jessica packer is currently offline jessica packerFriend
Messages: 9
Registered: March 2016
Junior Member
Dear members,

I'm trying to reuse the eclipse plugin UML2 in order to validate a given UML diagram (file.uml).
Is the "UML Validator.java" in charge of this task or does the package "Validation" containing "DelegatingConstraintDescriptor" (...) implement it?

Any help would be appreciated!

Regards,
Jessica
Re: PluginUML2: Validating a uml diagram [message #1728046 is a reply to message #1728029] Wed, 30 March 2016 15:08 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1162
Registered: July 2009
Location: Canada
Senior Member

Hi, Jessica,

The UMLValidator class is the EMF-generated implementation for UML2 of
the core EMF validation framework. The other is a shim that integrates
the constraints implemented by this generated validator into the
validation framework used by GMF and other EMF-based applications.

So, it really depends on which API you are using to perform validation
(the EMF Diagnostician or the extended validation framework's
IValidator). But in neither case would your coud be interacting with
these classes from UML2 directly; they are discovered automatically by
the higher-level APIs that they plug in to.

HTH,

Christian


On 2016-03-30 13:11:57 +0000, jessica packer said:

> Dear members,
>
> I'm trying to reuse the eclipse plugin UML2 in order to validate a
> given UML diagram (file.uml).
> Is the "UML Validator.java" in charge of this task or does the package
> "Validation" containing "DelegatingConstraintDescriptor" (...)
> implement it?
>
> Any help would be appreciated!
>
> Regards,
> Jessica
Re: PluginUML2: Validating a uml diagram [message #1728051 is a reply to message #1728046] Wed, 30 March 2016 16:00 Go to previous messageGo to next message
jessica packer is currently offline jessica packerFriend
Messages: 9
Registered: March 2016
Junior Member
Hi Christian,

Thank you for your reply. I really appreciate it.
I woulld like first to make sure that we're speaking about the same eclipse plugin which is UML2 (and not EMF).
I'm not sure that what I've understood matches well with your saying... Do you mean that I can't have this direct interaction with uml2 and that I need an API as the EMF Diagnostician or the extended validation framework's IValidator ?... What I was hoping to find out about is the class(/package) in the UML2 plugin that is responsible for validating a uml diagram(.XMI/.UML) and reuse it.... Isn't that possible?

Thank you in advance.

Regards,
Jessica
Re: PluginUML2: Validating a uml diagram [message #1728074 is a reply to message #1728051] Wed, 30 March 2016 18:25 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1162
Registered: July 2009
Location: Canada
Senior Member

Hi, Jessica,

UML2 is an EMF implementation of the UML metamodel, and is therefore an
extension of EMF. No discussion of UML2 is useful without the EMF
context.

The UMLValidator's purpose is to provide the constraints that are
evaluated on UML model objects by the Diagnostician. It is rarely
useful to interact with the UMLValidator directly, because then your
code is dependent on the specific validation rules that are
implemented, which can change from release to release.

Have a look at the EMF Validation documentation for more information
about how generated validators such as the UMLValidator are intended to
work within EMF and applications based on it:


http://help.eclipse.org/mars/topic/org.eclipse.emf.doc/references/overview/EMF.Validation.html


HTH,

Christian


On 2016-03-30 16:00:46 +0000, jessica packer said:

> Hi Christian,
>
> Thank you for your reply. I really appreciate it.
> I woulld like first to make sure that we're speaking about the same
> eclipse plugin which is UML2 (and not EMF).
> I'm not sure that what I've understood matches well with your saying...
> Do you mean that I can't have this direct interaction with uml2 and
> that I need an API as the EMF Diagnostician or the extended validation
> framework's IValidator ?... What I was hoping to find out about is the
> class(/package) in the UML2 plugin that is responsible for validating
> a uml diagram(.XMI/.UML) and reuse it.... Isn't that possible?
>
> Thank you in advance.
>
> Regards,
> Jessica
Re: PluginUML2: Validating a uml diagram [message #1728248 is a reply to message #1728074] Fri, 01 April 2016 10:07 Go to previous messageGo to next message
jessica packer is currently offline jessica packerFriend
Messages: 9
Registered: March 2016
Junior Member
Hi, Christian,

Your help is much appreciated.
As far as the validation is concerned, there's "validate" in the menu (UML editor) in the third step (in the link that you have included). There is also an alternative for validation (implementing it in another way).
However, it's not really what I was looking for...
The web application that I'm working on includes taking as input (a UML file) and tells if it's conform to OMG specifications. So, the point is that I'm not going to implement validation. I'm trying to benefit from the one already done in UML2 and EMF eclipse plugins.
That's why I was searching for the "main" method/class that is responsible for that in UML2 and EMF to call it: That's the first issue.
The second one is about having these plugins out of Eclipse:
Is the Black-box/ glass-box reuse of these plugins possible in order to make a simple call to the method/class that validates the UML file?

Your remarks are welcome. Please, tell me if you need any further explanation.

Thank you in advance.

Regards,
Jessica
Re: PluginUML2: Validating a uml diagram [message #1728264 is a reply to message #1728248] Fri, 01 April 2016 12:56 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1162
Registered: July 2009
Location: Canada
Senior Member

Hi, Jessica,

The Diagnostician is the prime interface for validation. The
"validate" action in the editor menu does very little more than just
invoke the diagnostician.

If you need to operate in a web container without the Eclipse Platform
running, then that's fine: the EMF and UML2 APIs for loading and
validating model resources all work without Eclipse. For UML models,
there are several EMF registrations required that are done
automatically by the UMLResourceUtil utility. Do be sure to use it to
initialize your ResourceSet before attempting to load a UML resource.
Just Google for UMLResourceUtil and you should find useful discussion
on that subject.

Cheers,

Christian


On 2016-04-01 10:07:13 +0000, jessica packer said:

> Hi, Christian,
>
> Your help is much appreciated. As far as the validation is concerned,
> there's "validate" in the menu (UML editor) in the third step (in the
> link that you have included). There is also an alternative for
> validation (implementing it in another way).
> However, it's not really what I was looking for...
> The web application that I'm working on includes taking as input (a UML
> file) and tells if it's conform to OMG specifications. So, the point is
> that I'm not going to implement validation. I'm trying to benefit from
> the one already done in UML2 and EMF eclipse plugins.
> That's why I was searching for the "main" method/class that is
> responsible for that in UML2 and EMF to call it: That's the first issue.
> The second one is about having these plugins out of Eclipse: Is the
> Black-box/ glass-box reuse of these plugins possible in order to make a
> simple call to the method/class that validates the UML file?
>
> Your remarks are welcome. Please, tell me if you need any further explanation.
>
> Thank you in advance.
>
> Regards,
> Jessica
Re: PluginUML2: Validating a uml diagram [message #1728313 is a reply to message #1728264] Fri, 01 April 2016 20:44 Go to previous messageGo to next message
jessica packer is currently offline jessica packerFriend
Messages: 9
Registered: March 2016
Junior Member
Hi,Christian,
Thank you for your quick reply.
As you have previously advised me to have a look at UMLResourceUtil utility, I have been trying to understand what it's supposed to do exactly.
What I have known so far is:
First, "when loading resources externally from Eclipse, the application needs to perform some registrations programmatically using this code:
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);

resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
Map uriMap = resourceSet.getURIConverter().getURIMap();
URI uri = URI.createURI("jar:file:/C:/eclipse/plugins/org.eclipse.uml2.uml.resources_<version>.jar!/"); // for example
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment(""));
".
That's only related to loading the uml ressource.
Second, you have said that "the Diagnostician is the prime interface for validation", do you mean that it's the one that I have to "call" once I have loaded the UML ressource?
I'm feeling that I'm almost there. Some more pieces of advice mean a lot!

Thanks in advance

Regards,
Jessica

[Updated on: Sat, 02 April 2016 18:46]

Report message to a moderator

Re: PluginUML2: Validating a uml diagram [message #1728912 is a reply to message #1728313] Fri, 08 April 2016 12:44 Go to previous message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1162
Registered: July 2009
Location: Canada
Senior Member

Hi, Jessica,

On 2016-04-01 20:44:42 +0000, jessica packer said:

> Hi,Christian,
> Thank you for your quick reply.
> As you have previously advised me to have a look at UMLResourceUtil
> utility, I have been trying to understand what it's supposed to do
> exactly. What I have known so far is:

This utility's purpose is to ensure that, in a non-Eclipse run-time
environment, your ResourceSet is configured with all of the
registrations that would be discovered automatically from extension
points in an Eclipse environment. So, that's package registries,
resource factories, URI mappings, and probably more.


> First, "when loading resources externally from Eclipse, the application
> needs to perform some registrations programmatically using this code:
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri =
> URI.createURI("jar:file:/C:/eclipse/plugins/org.eclipse.uml2.uml.resources_<version>.jar!/");
> // for example
> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
> uri.appendSegment("libraries").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
> uri.appendSegment("metamodels").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
> uri.appendSegment("profiles").appendSegment(""));".
> That's only related to loading the uml ressource.
> Second, you have said that "the Diagnostician is the prime interface
> for validation", do you mean that it's the one that I have to "call"
> once I have loaded the UML ressource? ...

Yes, that's what I mean. Look at Diagnostic::validate(EObject) and its
cohorts.


> I'm feeling that I'm almost there. Some more pieces of advice means a lot!
>
> Thanks in advance
>
> Regards,
> Jessica
Previous Topic:saving a model content into a string
Next Topic:Get the file (.uml) generated
Goto Forum:
  


Current Time: Wed Jan 17 07:43:03 GMT 2018

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

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