Home » Modeling » TMF (Xtext) » Integrate Xtext with CDO DbStore(how to integrate Xtext grammar with EMF model persisted into CDO DbStore)
Integrate Xtext with CDO DbStore [message #659092] |
Thu, 10 March 2011 23:19 |
romeh Messages: 35 Registered: February 2011 |
Member |
|
|
Hi All,
my question here how my DSL can easily include predefined persistent objects and of course appear in the famous content assist editor of my Xtext gramamr?,
i have implemented Ecore model persisted into CDO DbStore, and i want my up and running version of Xtext grammar to reference these persisted object of that model, of-course, i have imported the ecore model in my grammar syntax, also the gen model in the MW2 generator, any tips or examples i can follow?
these what i have done:
1- define my ecore model
2- implement that ecore model and persist it into CDO with DbStore
3- define my Xtext grammar, import the ecore model, to be able to write parser rules against it
4- now, i want to reference the persisted object of the EMF ecore model into my generated editor of the Xtext grammar?
Thanks a lot
|
|
|
Re: Integrate Xtext with CDO DbStore [message #659218 is a reply to message #659092] |
Fri, 11 March 2011 15:11 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
Do you want to refer to CDO elements only (cross reference) or do you
intend to edit CDO models textually?
The latter will be very difficult, as CDO and Xtext are handling EMF
models very differently. I suppose you'll burn your fingers here. If I
had to go that path I'd write a transformation converting a section of
the CDO model into a plain EMF model, edit this one in Xtext and
reconcile the changes back into the CDO source.
OTOH, Referring to CDO model elements via cross-references could work,
if you manage to put them on your scopes (implementing a scope
provider). Nevertheless, this depends on whether it is technically
possible to cross-reference a CDO object from a non-CDO EObject. I am
not sure if this is the case, as CDO is does not use EMF's proxy
resolution mechanism, and this would likely require to have CDO and
non-CDO Resources within the same ResourceSet.
A viable alternative would be to refer to the CDO elements by name only
(EAttribute of type String instead of a EReference) and manage the
correspondence in the tooling components such as validation and content
assist.
Also keep in mind that CDO persistence is often used because the models
are huge and unpartitioned. So you might have to implement some Xtext
services to use CDO queries instead of navigating the whole model in
order to scale.
Am 11.03.11 00:19, schrieb romeh:
> Hi All,
>
> my question here how my DSL can easily include predefined persistent
> objects and of course appear in the famous content assist editor of my
> Xtext gramamr?,
> i have implemented Ecore model persisted into CDO DbStore, and i want my
> up and running version of Xtext grammar to reference these persisted
> object of that model, of-course, i have imported the ecore model in my
> grammar syntax, also the gen model in the MW2 generator, any tips or
> examples i can follow?
>
> these what i have done:
> 1- define my ecore model
> 2- implement that ecore model and persist it into CDO with DbStore
> 3- define my Xtext grammar, import the ecore model, to be able to write
> parser rules against it
> 4- now, i want to reference the persisted object of the EMF ecore model
> into my generated editor of the Xtext grammar?
> Thanks a lot
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
Re: Integrate Xtext with CDO DbStore [message #659263 is a reply to message #659218] |
Fri, 11 March 2011 17:16 |
Victor Roldan Betancort Messages: 524 Registered: July 2009 |
Senior Member |
|
|
Jan,
>> OTOH, Referring to CDO model elements via cross-references could work,
>> if you manage to put them on your scopes (implementing a scope
>> provider). Nevertheless, this depends on whether it is technically
>> possible to cross-reference a CDO object from a non-CDO EObject. I am
>> not sure if this is the case, as CDO is does not use EMF's proxy
>> resolution mechanism, and this would likely require to have CDO and
>> non-CDO Resources within the same ResourceSet.
CDO contributes to EMF extension point
org.eclipse.emf.ecore.protocol_parser a special resource factory,
capable to resolve CDOResource/CDOObjects within a ResourceSet. For
instance, you can have a GMF diagram referencing CDOObjects in a CDO
repository through its URI. At resolution time, CDOResourceFactory kicks
in an executes several mechanisms to resolve it.
So I can confirm it is possible to reference a CDOObject of a
CDOResource from a regular EObject.
Cheers,
Víctor.
El 11/03/2011 14:11, Jan Koehnlein escribió:
> Do you want to refer to CDO elements only (cross reference) or do you
> intend to edit CDO models textually?
>
> The latter will be very difficult, as CDO and Xtext are handling EMF
> models very differently. I suppose you'll burn your fingers here. If I
> had to go that path I'd write a transformation converting a section of
> the CDO model into a plain EMF model, edit this one in Xtext and
> reconcile the changes back into the CDO source.
>
> OTOH, Referring to CDO model elements via cross-references could work,
> if you manage to put them on your scopes (implementing a scope
> provider). Nevertheless, this depends on whether it is technically
> possible to cross-reference a CDO object from a non-CDO EObject. I am
> not sure if this is the case, as CDO is does not use EMF's proxy
> resolution mechanism, and this would likely require to have CDO and
> non-CDO Resources within the same ResourceSet.
>
> A viable alternative would be to refer to the CDO elements by name only
> (EAttribute of type String instead of a EReference) and manage the
> correspondence in the tooling components such as validation and content
> assist.
>
> Also keep in mind that CDO persistence is often used because the models
> are huge and unpartitioned. So you might have to implement some Xtext
> services to use CDO queries instead of navigating the whole model in
> order to scale.
>
> Am 11.03.11 00:19, schrieb romeh:
>> Hi All,
>>
>> my question here how my DSL can easily include predefined persistent
>> objects and of course appear in the famous content assist editor of my
>> Xtext gramamr?,
>> i have implemented Ecore model persisted into CDO DbStore, and i want my
>> up and running version of Xtext grammar to reference these persisted
>> object of that model, of-course, i have imported the ecore model in my
>> grammar syntax, also the gen model in the MW2 generator, any tips or
>> examples i can follow?
>>
>> these what i have done:
>> 1- define my ecore model
>> 2- implement that ecore model and persist it into CDO with DbStore
>> 3- define my Xtext grammar, import the ecore model, to be able to write
>> parser rules against it
>> 4- now, i want to reference the persisted object of the EMF ecore model
>> into my generated editor of the Xtext grammar?
>> Thanks a lot
>
>
|
|
| |
Re: Integrate Xtext with CDO DbStore [message #659480 is a reply to message #659263] |
Mon, 14 March 2011 08:45 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
Cool, thanks for clarifying.
Am 11.03.11 19:14, schrieb Víctor Roldán Betancort:
> Jan,
>
>>> OTOH, Referring to CDO model elements via cross-references could work,
>>> if you manage to put them on your scopes (implementing a scope
>>> provider). Nevertheless, this depends on whether it is technically
>>> possible to cross-reference a CDO object from a non-CDO EObject. I am
>>> not sure if this is the case, as CDO is does not use EMF's proxy
>>> resolution mechanism, and this would likely require to have CDO and
>>> non-CDO Resources within the same ResourceSet.
>
> CDO contributes to EMF extension point
> org.eclipse.emf.ecore.protocol_parser a special resource factory,
> capable to resolve CDOResource/CDOObjects within a ResourceSet. For
> instance, you can have a GMF diagram referencing CDOObjects in a CDO
> repository through its URI. At resolution time, CDOResourceFactory kicks
> in an executes several mechanisms to resolve it.
>
> So I can confirm it is possible to reference a CDOObject of a
> CDOResource from a regular EObject.
>
> Cheers,
> Víctor.
>
> El 11/03/2011 14:11, Jan Koehnlein escribió:
>> Do you want to refer to CDO elements only (cross reference) or do you
>> intend to edit CDO models textually?
>>
>> The latter will be very difficult, as CDO and Xtext are handling EMF
>> models very differently. I suppose you'll burn your fingers here. If I
>> had to go that path I'd write a transformation converting a section of
>> the CDO model into a plain EMF model, edit this one in Xtext and
>> reconcile the changes back into the CDO source.
>>
>> OTOH, Referring to CDO model elements via cross-references could work,
>> if you manage to put them on your scopes (implementing a scope
>> provider). Nevertheless, this depends on whether it is technically
>> possible to cross-reference a CDO object from a non-CDO EObject. I am
>> not sure if this is the case, as CDO is does not use EMF's proxy
>> resolution mechanism, and this would likely require to have CDO and
>> non-CDO Resources within the same ResourceSet.
>>
>> A viable alternative would be to refer to the CDO elements by name only
>> (EAttribute of type String instead of a EReference) and manage the
>> correspondence in the tooling components such as validation and content
>> assist.
>>
>> Also keep in mind that CDO persistence is often used because the models
>> are huge and unpartitioned. So you might have to implement some Xtext
>> services to use CDO queries instead of navigating the whole model in
>> order to scale.
>>
>> Am 11.03.11 00:19, schrieb romeh:
>>> Hi All,
>>>
>>> my question here how my DSL can easily include predefined persistent
>>> objects and of course appear in the famous content assist editor of my
>>> Xtext gramamr?,
>>> i have implemented Ecore model persisted into CDO DbStore, and i want my
>>> up and running version of Xtext grammar to reference these persisted
>>> object of that model, of-course, i have imported the ecore model in my
>>> grammar syntax, also the gen model in the MW2 generator, any tips or
>>> examples i can follow?
>>>
>>> these what i have done:
>>> 1- define my ecore model
>>> 2- implement that ecore model and persist it into CDO with DbStore
>>> 3- define my Xtext grammar, import the ecore model, to be able to write
>>> parser rules against it
>>> 4- now, i want to reference the persisted object of the EMF ecore model
>>> into my generated editor of the Xtext grammar?
>>> Thanks a lot
>>
>>
>
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
| |
Re: Integrate Xtext with CDO DbStore [message #659501 is a reply to message #659218] |
Mon, 14 March 2011 10:43 |
|
Am 11.03.2011 16:11, schrieb Jan Koehnlein:
> [...] OTOH, Referring to CDO model elements via cross-references could work, if you manage to put them on your scopes (implementing a scope provider). Nevertheless, this depends on whether it is technically possible to cross-reference a CDO object from a non-CDO EObject. I am not sure if this is the case, as CDO is does not use EMF's proxy resolution mechanism, and this would likely require to have CDO and non-CDO Resources within the same ResourceSet.
As Vik already pointed out, it should be possible. This is because EMF's proxy resolution mechanism is present in the *referring* object.
If you want to load the CDOObjects into an existing resource set all you have to do is open the CDOView or CDOTransaction with one of these methods and pass in your resource set:
CDOSession.openTransaction(CDOBranchPoint, ResourceSet)
CDOSession.openTransaction(CDOBranch, ResourceSet)
CDOSession.openTransaction(ResourceSet)
CDOSession.openView(CDOBranchPoint, ResourceSet)
CDOSession.openView(CDOBranch, long, ResourceSet)
CDOSession.openView(ResourceSet)
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
> A viable alternative would be to refer to the CDO elements by name only (EAttribute of type String instead of a EReference) and manage the correspondence in the tooling components such as validation and content assist.
>
> Also keep in mind that CDO persistence is often used because the models are huge and unpartitioned. So you might have to implement some Xtext services to use CDO queries instead of navigating the whole model in order to scale.
>
> Am 11.03.11 00:19, schrieb romeh:
>> Hi All,
>>
>> my question here how my DSL can easily include predefined persistent
>> objects and of course appear in the famous content assist editor of my
>> Xtext gramamr?,
>> i have implemented Ecore model persisted into CDO DbStore, and i want my
>> up and running version of Xtext grammar to reference these persisted
>> object of that model, of-course, i have imported the ecore model in my
>> grammar syntax, also the gen model in the MW2 generator, any tips or
>> examples i can follow?
>>
>> these what i have done:
>> 1- define my ecore model
>> 2- implement that ecore model and persist it into CDO with DbStore
>> 3- define my Xtext grammar, import the ecore model, to be able to write
>> parser rules against it
>> 4- now, i want to reference the persisted object of the EMF ecore model
>> into my generated editor of the Xtext grammar?
>> Thanks a lot
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
| | |
Goto Forum:
Current Time: Wed Sep 25 16:51:48 GMT 2024
Powered by FUDForum. Page generated in 0.04462 seconds
|