Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » best practise?
best practise? [message #755978] Thu, 10 November 2011 11:24 Go to next message
Willi  is currently offline Willi Friend
Messages: 13
Registered: October 2011
Junior Member
Hallo together,

i have the following situation and don`t know how to solve it.
I have some xsd files with loose references. Loose means the reference is based on simple types and there is no real reference.
Now i would like to create a editor for those files and i think i need the whole model with references. But at the end i need instances based on the single xsd files.
I have read a little bit and found this rudiments

- create the references on the xsd files with ecore annotations
- create the references with ext. meta data and xpath or something
- create a new xsd with all elements and references and transform later to the single models

Is there an other good solution? Do any of you facing the same problem and have a hint for me what will work? Any idea or experience would be helpful.

regards willi
Re: best practise? [message #756010 is a reply to message #755978] Thu, 10 November 2011 13:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Willi,

Comments below.

On 10/11/2011 12:24 PM, Willi wrote:
> Hallo together,
>
> i have the following situation and don`t know how to solve it.
> I have some xsd files with loose references. Loose means the reference
> is based on simple types and there is no real reference.
The references are within a single resource?
> Now i would like to create a editor for those files and i think i need
> the whole model with references.
Yes, to get nice drop downs with lists of appropriate choices.
> But at the end i need instances based on the single xsd files.
So these things can't be modeled using xsd:ID I guess...
> I have read a little bit and found this rudiments
>
> - create the references on the xsd files with ecore annotations
Is more than one attribute involved in producing the reference?
> - create the references with ext. meta data and xpath or something
This is sounding more complex than just using some attribute value. Can
you give an example?
> - create a new xsd with all elements and references and transform
> later to the single models
>
> Is there an other good solution?
Maybe if you gave a small concrete example I'd be better able to suggest
an approach...
> Do any of you facing the same problem and have a hint for me what will
> work? Any idea or experience would be helpful.
>
> regards willi


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: best practise? [message #756024 is a reply to message #756010] Thu, 10 November 2011 13:59 Go to previous messageGo to next message
Willi  is currently offline Willi Friend
Messages: 13
Registered: October 2011
Junior Member
Hello Ed Merks,


Quote:

The references are within a single resource?

The references are over different files.

Quote:

Is more than one attribute involved in producing the reference?


Mostly no, but in a very few cases yes.

Quote:

> - create the references with ext. meta data and xpath or something
This is sounding more complex than just using some attribute value. Can
you give an example?


i try. when attr. refName(String) from ObjectA and FileA are refering to ObjectB from FileB. You add an EAnnontation and set there the modelpath and the path in the model (xpath) to refering object. I self only saw an example.

something like that:

services
<service name="test" child="test2" impl="org...">
...
</service>

<service name="test2" impl="org...">
...
</service>



events

<event name="test2" service="test" otherRef="reference">
...
</event>



There are over 10 xsd files which are connected together and i have to handle existing instances


Thank you and regards
Willi
Re: best practise? [message #756128 is a reply to message #756024] Fri, 11 November 2011 06:52 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Willi,

Comments below.

On 10/11/2011 2:59 PM, Willi wrote:
> Hello Ed Merks,
>
>
> Quote:
>> The references are within a single resource?
>
> The references are over different files.
> Quote:
>> Is more than one attribute involved in producing the reference?
>
>
> Mostly no, but in a very few cases yes.
>
> Quote:
>> > - create the references with ext. meta data and xpath or something
>> This is sounding more complex than just using some attribute value. Can
>> you give an example?
>
>
> i try. when attr. refName(String) from ObjectA and FileA are refering
> to ObjectB from FileB. You add an EAnnontation and set there the
> modelpath and the path in the model (xpath) to refering object. I self
> only saw an example.
>
> something like that:
> services
>
> <service name="test" child="test2"
So this is a reference. Is it always to something in the same resource?
> impl="org...">
> ..
> </service>
>
> <service name="test2" impl="org...">
> ..
> </service>
>
>
>
> events
>
>
> <event name="test2" service="test" otherRef="reference">
> ..
> </event>
>
>
>
> There are over 10 xsd files which are connected together and i have to
> handle existing instances
Do you have to connect multiple instance resources?
>
>
> Thank you and regards Willi
One approach would be just to specialize the property descriptors for
the referencing attributes to make them behave the way you want, i.e.,
produce the desired choice of values from the names that are "in
scope". You could also add helper methods just to the Java code to
follow/resolve the references using your own hand written code. You
might even go so far as to provide setter methods for the references
that actually set the attribute value. The only thing this wouldn't
buy you is the ability to rename things easily (because all the
references are encoded using the original name and would also need to be
changed).


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: best practise? [message #756151 is a reply to message #756128] Fri, 11 November 2011 09:36 Go to previous messageGo to next message
Willi  is currently offline Willi Friend
Messages: 13
Registered: October 2011
Junior Member
Hello Ed,

Quote:

So this is a reference. Is it always to something in the same resource?

> There are over 10 xsd files which are connected together and i have to
> handle existing instances
Do you have to connect multiple instance resources?



No not the same resource and yes multiple instances. For example i have the reportService.xml and the basicService.xml both based on service.xsd. Then i have reportEntity.xml and basicEntity.xml based on entity.xsd. References could be:

- reportService to basicService
- reportService to reportService
- reportServcie to reportEntity
- reportEntity to reportEntity
- reportEntity to basicEntity

Quote:

One approach would be just to specialize the property descriptors for
the referencing attributes to make them behave the way you want, i.e.,
produce the desired choice of values from the names that are "in
scope". You could also add helper methods just to the Java code to
follow/resolve the references using your own hand written code. You
might even go so far as to provide setter methods for the references
that actually set the attribute value. The only thing this wouldn't
buy you is the ability to rename things easily (because all the
references are encoded using the original name and would also need to be
changed).

Can you please give me an example for specialized property descriptors?

Would it be an approach to build manually a big model by make the refernces by hand create a editor for it and later transform the big model to single models with atl or something?

Thanks,
Willi
Re: best practise? [message #756156 is a reply to message #756151] Fri, 11 November 2011 10:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Willi,

Comments below.

On 11/11/2011 10:36 AM, Willi wrote:
> Hello Ed,
> Quote:
>> So this is a reference. Is it always to something in the same resource?
>>
>> > There are over 10 xsd files which are connected together and i have to
>> > handle existing instances
>> Do you have to connect multiple instance resources?
>
>
> No not the same resource and yes multiple instances.
I wonder how the resources will know about each other's existence unless
the URI of that resource is specified as part of the reference...
> For example i have the reportService.xml and the basicService.xml both
> based on service.xsd. Then i have reportEntity.xml and basicEntity.xml
> based on entity.xsd. References could be:
> - reportService to basicService
> - reportService to reportService
> - reportServcie to reportEntity
> - reportEntity to reportEntity
> - reportEntity to basicEntity
>
> Quote:
>> One approach would be just to specialize the property descriptors for
>> the referencing attributes to make them behave the way you want, i.e.,
>> produce the desired choice of values from the names that are "in
>> scope". You could also add helper methods just to the Java code to
>> follow/resolve the references using your own hand written code. You
>> might even go so far as to provide setter methods for the references
>> that actually set the attribute value. The only thing this wouldn't
>> buy you is the ability to rename things easily (because all the
>> references are encoded using the original name and would also need to be
>> changed).
>
> Can you please give me an example for specialized property descriptors?
This is the kind of question you can use Eclipse to answer. I.e., use
Ctrl-Shift-T to open ItemPropertyDescriptor. Then ask to see the type
hierarchy. You'll see all kinds of subclasses and can look at what
they're doing. You'll want to specialize getComboBoxObjects to produce
the list of appropriate names...
>
> Would it be an approach to build manually a big model by make the
> refernces by hand create a editor for it and later transform the big
> model to single models with atl or something?
I don't imagine it should be necessary to have two completely separate
models. I imagine a basic model produced from schema augmented with
convenience methods (or perhaps additional EReferences but you can do
that directly in the schema) will suffice.
> Thanks, Willi


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: best practise? [message #756162 is a reply to message #756156] Fri, 11 November 2011 10:39 Go to previous messageGo to next message
Willi  is currently offline Willi Friend
Messages: 13
Registered: October 2011
Junior Member
Hello Ed,

Quote:

I wonder how the resources will know about each other's existence unless
the URI of that resource is specified as part of the reference...

I really don't know how the files are procsessed later, the files are part of a framework.

Quote:

This is the kind of question you can use Eclipse to answer. I.e., use
Ctrl-Shift-T to open ItemPropertyDescriptor. Then ask to see the type
hierarchy. You'll see all kinds of subclasses and can look at what
they're doing. You'll want to specialize getComboBoxObjects to produce
the list of appropriate names...
>
> Would it be an approach to build manually a big model by make the
> refernces by hand create a editor for it and later transform the big
> model to single models with atl or something?
I don't imagine it should be necessary to have two completely separate
models. I imagine a basic model produced from schema augmented with
convenience methods (or perhaps additional EReferences but you can do
that directly in the schema) will suffice.


Ok i will have look into those things. One question i still have. Can i still export files of the original xsd instances with this approach? At the end i need instances of these.

Thank you very much. Your answers are very helpful.

regards, Willi


Re: best practise? [message #756167 is a reply to message #756162] Fri, 11 November 2011 11:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Willi,

Yes, you will be able to produce conforming serializations with the
approach I outlined. If you add references to the model (you'd have to
edit the generated *.ecore) you'd make them transient so they don't
affect the serialization.

On 11/11/2011 11:39 AM, Willi wrote:
> Hello Ed,
>
> Quote:
>> I wonder how the resources will know about each other's existence unless
>> the URI of that resource is specified as part of the reference...
>
> I really don't know how the files are procsessed later, the files are
> part of a framework.
> Quote:
>> This is the kind of question you can use Eclipse to answer. I.e., use
>> Ctrl-Shift-T to open ItemPropertyDescriptor. Then ask to see the type
>> hierarchy. You'll see all kinds of subclasses and can look at what
>> they're doing. You'll want to specialize getComboBoxObjects to produce
>> the list of appropriate names...
>> >
>> > Would it be an approach to build manually a big model by make the
>> > refernces by hand create a editor for it and later transform the big
>> > model to single models with atl or something?
>> I don't imagine it should be necessary to have two completely separate
>> models. I imagine a basic model produced from schema augmented with
>> convenience methods (or perhaps additional EReferences but you can do
>> that directly in the schema) will suffice.
>
>
> Ok i will have look into those things. One question i still have. Can
> i still export files of the original xsd instances with this approach?
> At the end i need instances of these.
>
> Thank you very much. Your answers are very helpful.
>
> regards, Willi
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: best practise? [message #756183 is a reply to message #756167] Fri, 11 November 2011 12:19 Go to previous message
Willi  is currently offline Willi Friend
Messages: 13
Registered: October 2011
Junior Member
That's sounds great. Thank you.

regards willi
Previous Topic:Readable serialization format for EMF/GWT
Next Topic:[EMF] Reflectively adding to a collection without creating copies.
Goto Forum:
  


Current Time: Fri Apr 26 20:19:33 GMT 2024

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

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

Back to the top