Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
romeh  is currently offline romeh Friend
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 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
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 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
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 #659358 is a reply to message #659092] Sat, 12 March 2011 20:01 Go to previous messageGo to next message
romeh  is currently offline romeh Friend
Messages: 35
Registered: February 2011
Member
Hi All,

Thanks for your reply, can any one provide me with an example or link explain this type of integration between EMF objects persisted into CDO DBStore and Xtext Grammar?, also do you advise me to switch to Teno and Hibernate for EMF persistence , which can be integrated with 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 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
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 #659481 is a reply to message #659358] Mon, 14 March 2011 09:00 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
I am not aware of any such example.

From the Xtext side, you should
1) Use plain cross references to the CDO model elements in the grammar
2) Implement the services needed to refer to the CDO elements, similar
to what we do in the org.eclipse.xtext.ecore plugin (runtime module
inheriting from AbstractGenericResourceRuntimeModule and a
DefaultResourceDescriptionStrategy)

Not sure what to do on the CDO side. With regard to Víctor's post, it
should work out of the bx.

Am 12.03.11 21:01, schrieb romeh:
> Hi All,
>
> Thanks for your reply, can any one provide me with an example or link
> explain this type of integration between EMF objects persisted into CDO
> DBStore and Xtext Grammar?, also do you advise me to switch to Teno and
> Hibernate for EMF persistence , which can be integrated with 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 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
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
>
>


Re: Integrate Xtext with CDO DbStore [message #659644 is a reply to message #659092] Mon, 14 March 2011 23:08 Go to previous messageGo to next message
romeh  is currently offline romeh Friend
Messages: 35
Registered: February 2011
Member
Hi Eike and all,

I have a small question,when i load my ResourceSet using one of the methods , you have mentioned above, the ResourceSet will contain my persisted ecore model into its original EMF model format , or in CDO objects format?

Thanks a lot
Re: Integrate Xtext with CDO DbStore [message #659667 is a reply to message #659644] Tue, 15 March 2011 06:21 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 15.03.2011 00:08, schrieb romeh:
> Hi Eike and all,
>
> I have a small question,when i load my ResourceSet using one of the methods , you have mentioned above, the ResourceSet will contain my persisted ecore model into its original EMF model format , or in CDO objects format?
If you've followed http://wiki.eclipse.org/CDO/Preparing_EMF_Models to regenerate your model for CDO then your actual EObjects will always be CDOObjects. But CDOObjects can live in both CDOResources or non-CDOResources and you can even move/copy them in both dierections, so it depends on how/from where you load your resources into the resource set. Does that answer your question?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:Plan for formatter related issues?
Next Topic:using a model form another project
Goto Forum:
  


Current Time: Thu Mar 28 12:25:48 GMT 2024

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

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

Back to the top