Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Validation through more model files.
Validation through more model files. [message #690801] Thu, 30 June 2011 04:52 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Inject a different StaticMethodsFeatureForTypeProvider
Next Topic:Leak in OutlineWithEditorLinker?
Goto Forum:
  


Current Time: Sat Jul 26 14:52:17 EDT 2025

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

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

Back to the top