0

Trying to make a meta model for Mongoose and MondoDb, using metamodeling concepts, eclipse and xtext.

I am trying to assign object that i created in my test.mydsl file to another object in the same file, but i get error in my test.mydsl file.

I am trying to assign created Schema(sc1) object to Collection(col) object, but currently getting an error

error message

the feature 'validate' of 'paket.impl.NCollectionImpl@67d76e14{platform:/resource/test/classes/test.mydsl#//@collections.0}' contains an unresolved proxy 'paket.impl.SchemaImpl@361d8284{platform:/resource/test/classes/test.mydsl#|0}'

my grammar for Schema and Collection

Schema returns Schema:
    {Schema}
    ('Schema' '<' Name=EString) '>'
    '{'
        (schemaExpression+=Expression ( "," schemaExpression+=Expression)*)?
        (verificationDocumentElement+=VerDocElement ( "," verificationDocumentElement+=VerDocElement)*)?
    '}';

NCollection returns NCollection:
    {NCollection}
    ('Collection' '<' Name=EString) ',' (validate=[Schema|EString])? '>'
    '{'
        (document+=Document ( "," document+=Document)*)?
    '}';

my test.mydsl

Database<db1>{

    Schema<sc1>{
        var ja=lp   
        ime:{
            type:String,
            min:123.0
        }

    }
    Collection<col, sc1> 
    {

    }
}

I tried all, but unsuccessful.

Any ideas what to do?

Thanks

EDIT:

Maybe I was not clear enough. The major problem is with "validate" attribute in NCollection rule. When I create my Schema object(sc1 in test.mydsl) and then try to pass it to Collection(col in test.mydsl) as a "sc1", the "validate" attribute cannot accept it like string, and I don't know how to pass it like Schema object. I hope this explanation helps.

4

2 回答 2

0

编码

validate=[Schema|EString]

说:我想要一个通过字符串的模式引用,即"sc1"而不是名称。Xtext 不知道如何将字符串转换为引用。改用这个:

validate=[Schema]

这是缩写

validate=[Schema|ID]

这将使用Schema作为参考的名称。请注意,您必须编写

('Schema' '<' name=EString) '>'

即小写name以使其工作。Xtext 对名为name.

于 2015-04-21T09:34:34.670 回答
0

请尝试使用name=EString而不是Name=EStringXtext 为属性强加一个特殊的默认语义name。另外我建议查看文档。

于 2015-04-20T10:25:59.023 回答