Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Skipping validations of features from EMF Model
Skipping validations of features from EMF Model [message #995815] Mon, 31 December 2012 02:18 Go to next message
Ashwani Kr Sharma is currently offline Ashwani Kr Sharma
Messages: 118
Registered: July 2009
Location: Bangalore, India
Senior Member

Hi,

I am creating DSL for existing EMF Model who persistence format is xmi. The DSL will be just an alternate representation of xmi format.

The DSL contains many less features because i want only relevant features available to user and system specific stuff is kept hidden.
These features in DSL are marked optional in grammar. But they are not optional in ECore model.

Hence in the DSL i see error reporting that "... feature is not optional and should be specified ...". One way is to change the ECore model but I can't do this because i don't have authorizations to change the ECore model. Is it possible to skip these validation errors ?

Regards,
Ashwani Kr Sharma
Re: Skipping validations of features from EMF Model [message #999616 is a reply to message #995815] Sat, 12 January 2013 12:10 Go to previous messageGo to next message
Ashwani Kr Sharma is currently offline Ashwani Kr Sharma
Messages: 118
Registered: July 2009
Location: Bangalore, India
Senior Member

Hi,

I am kinna stuck with this issue. Can you please give some hints.

Regards,
Ashwani Kr Sharma
Re: Skipping validations of features from EMF Model [message #1000197 is a reply to message #995815] Mon, 14 January 2013 03:38 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2809
Registered: July 2009
Senior Member
Am 31.12.12 08:18, schrieb Ashwani Kr Sharma:
> Hi,
>
> I am creating DSL for existing EMF Model who persistence format is xmi.
> The DSL will be just an alternate representation of xmi format.
>
> The DSL contains many less features because i want only relevant
> features available to user and system specific stuff is kept hidden.
> These features in DSL are marked optional in grammar. But they are not
> optional in ECore model.
>
> Hence in the DSL i see error reporting that "... feature is not optional
> and should be specified ...". One way is to change the ECore model but I
> can't do this because i don't have authorizations to change the ECore
> model. Is it possible to skip these validation errors ?
>
> Regards,
> Ashwani Kr Sharma

Yes, you may skip the EObjectValidator in case you validate your
language files. See
org.eclipse.xtext.validation.CompositeEValidator.useEObjectValidator

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Skipping validations of features from EMF Model [message #1006986 is a reply to message #1000197] Sun, 03 February 2013 10:10 Go to previous messageGo to next message
Ashwani Kr Sharma is currently offline Ashwani Kr Sharma
Messages: 118
Registered: July 2009
Location: Bangalore, India
Senior Member

Hi Sebastian,

Where do i specify org.eclipse.xtext.validation.CompositeEValidator.useEObjectValidator ?
In mwe2 file ?

Regards,
Ashwani Kr Sharma
Re: Skipping validations of features from EMF Model [message #1006990 is a reply to message #1006986] Sun, 03 February 2013 10:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6241
Registered: July 2009
Senior Member
Hi,

adding a simple straight forward binding to the runtime module doesnt work?

public void configureUseEObjectValidator(Binder binder) {
binder.bind(Boolean.class)
.annotatedWith(
Names.named(CompositeEValidator.USE_EOBJECT_VALIDATOR))
.toInstance(Boolean.FALSE);
}
Re: Skipping validations of features from EMF Model [message #1010297 is a reply to message #1006990] Sat, 16 February 2013 23:21 Go to previous messageGo to next message
Ashwani Kr Sharma is currently offline Ashwani Kr Sharma
Messages: 118
Registered: July 2009
Location: Bangalore, India
Senior Member

Hi,

I have put following method in my RuntimeModule class. But nothing changes:

public void configureUseEObjectValidator(Binder binder) {
binder.bind(Boolean.class).annotatedWith(Names.named(CompositeEValidator.USE_EOBJECT_VALIDATOR)).toInstance(Boolean.FALSE);
}


I read the documentation of xText and following is mentioned there. So, can't we skip them ?
Quote:
The IConcreteSyntaxValidator validates all constraints that are implied by a grammar.
Meeting these constraints for a model is mandatory to be serialized.


Regards,
Ashwani Kr Sharma

[Updated on: Sat, 16 February 2013 23:55]

Report message to a moderator

Re: Skipping validations of features from EMF Model [message #1010437 is a reply to message #1010297] Sun, 17 February 2013 04:30 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6241
Registered: July 2009
Senior Member
Hi,

so are we talking about two things?

first you where talking about mandatory things in the metamodel that do not appear in the grammar, not you are talking about mandatory things in the grammar that dont appear in the model?

~Christian
Previous Topic:Empty rule
Next Topic:XMI resource to xText resource
Goto Forum:
  


Current Time: Mon Sep 01 07:34:13 EDT 2014

Powered by FUDForum. Page generated in 0.02147 seconds