Validation through more model files. [message #690801] |
Thu, 30 June 2011 04:52  |
Eclipse User |
|
|
|
Hello Guys,
we have this problem. We need to split a model to more files and validate uniqueness of some parameters, e.g. names of objects, through all imported files.
Is it possible to get reference or even directly EObjects from another model in different file, by imports?
Look at the example bellow which should describe the basic problem.
MetaModel:
name = ID
('import' importURI = STRING)*
(a = A)?
(b = B)?
(c = C)?
;
A:
'SectionA'
name = ID
'index' index = INT
;
B:
'SectionB'
name = ID
index = INT
;
C:
'SectionC'
name= ID
aRef = [A]
bRef = [B]
arbitraryRef = [ecore::EObject]
index = INT
;
File1.dsl:
Main
import „File2.dsl"
import „File3.dsl"
SectionA nameA index 1
SectionB nameB index 1
SectionC nameC
Model2.nameB
Model3.nameC
index 1
File2.dsl:
Model2
SectionA nameA index 1
SectionB nameB index 1
File3.dsl:
Model3
SectionA nameA index 1
SectionB nameB index 1
Thank you for your ideas and help.
M&M
|
|
|
Re: Validation through more model files. [message #692323 is a reply to message #690801] |
Mon, 04 July 2011 03:52  |
Eclipse User |
|
|
|
The easiest wa is to switch from importURI to importedNamespace and use
fragment = validation.JavaValidatorFragment {
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
in your grammar.
If you stick to importURIs not that all imported resources will be
loaded into the models ResourceSet, so you can use the plain EMF model
access techniques.
Am 30.06.11 10:52, schrieb Martin Novak:
> Hello Guys,
> we have this problem. We need to split a model to more files and
> validate uniqueness of some parameters, e.g. names of objects, through
> all imported files.
> Is it possible to get reference or even directly EObjects from another
> model in different file, by imports?
> Look at the example bellow which should describe the basic problem.
>
>
>
> MetaModel:
> name = ID
> ('import' importURI = STRING)*
> (a = A)?
> (b = B)?
> (c = C)?
> ;
>
> A:
> 'SectionA'
> name = ID
> 'index' index = INT
> ;
>
> B:
> 'SectionB'
> name = ID
> index = INT
> ;
>
> C:
> 'SectionC'
> name= ID
> aRef = [A]
> bRef = [B]
> arbitraryRef = [ecore::EObject]
> index = INT
> ;
>
>
>
> File1.dsl:
>
> Main
> import „File2.dsl"
> import „File3.dsl"
>
> SectionA nameA index 1
> SectionB nameB index 1
>
> SectionC nameC
> Model2.nameB
> Model3.nameC
>
> index 1
>
> File2.dsl:
> Model2
>
> SectionA nameA index 1
> SectionB nameB index 1
>
> File3.dsl:
> Model3
>
> SectionA nameA index 1
> SectionB nameB index 1
>
>
>
> Thank you for your ideas and help.
>
> M&M
>
>
>
>
>
>
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
|
|
|
Powered by
FUDForum. Page generated in 0.04560 seconds