Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Validation through more model files.
Validation through more model files. [message #690801] Thu, 30 June 2011 08:52 Go to next message
Martin Novak is currently offline Martin NovakFriend
Messages: 4
Registered: July 2009
Junior Member
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 07:52 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
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


---
Get professional support from the Xtext committers at www.typefox.io
Previous Topic:Inject a different StaticMethodsFeatureForTypeProvider
Next Topic:Leak in OutlineWithEditorLinker?
Goto Forum:
  


Current Time: Mon Sep 28 07:09:28 GMT 2020

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

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

Back to the top