Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to specify composed key in a reference
How to specify composed key in a reference [message #1823124] Thu, 19 March 2020 18:49 Go to next message
jo ber is currently offline jo berFriend
Messages: 94
Registered: August 2018
Member
Hi

I've the following model to illustrate my question:

index.php/fa/37624/0/

I would like to specify the attribute 'marketIdentifierCode' from the class 'Market' as part of the ekeys in the association 'liquidityassessment'. In other words, an element in the relation is identified by 'criterion' in the class 'LiquidityAssessment' and by the 'Market'. I've not found a way to achieve that.

Thank you and kind regards,
  • Attachment: Q1.PNG
    (Size: 109.02KB, Downloaded 182 times)
Re: How to specify composed key in a reference [message #1823137 is a reply to message #1823124] Fri, 20 March 2020 04:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
You cannot use eKeys for this purpose. The EReference.eKeys plays two roles. It defines a constraint. In addition, that constraint is used for navigation by org.eclipse.emf.ecore.impl.BasicEObjectImpl.eURIFragmentSegment(EStructuralFeature, EObject) (when serializing) and by org.eclipse.emf.ecore.impl.BasicEObjectImpl.eObjectForURIFragmentPredicate(String, EReference) as called from org.eclipse.emf.ecore.impl.BasicEObjectImpl.eObjectForURIFragmentSegment(String) when resolving deserialized proxies.

If you need a more general/flexible constraint, you can define a named constraint or an invariant operation on the Instrument EClass and implement arbitrary constraint logic for that in the generated validator or the operation body. If you want it also used for navigation, you can specialize eURIFragmentSegment and eObjectForURIFragmentSegment, though that's unlikely to helpful because it's not a containment reference.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] EMap update problem for the first element
Next Topic:[beginners] [Acceleo] User code blocks with @generated do not work / target file is no longer merged
Goto Forum:
  


Current Time: Thu Apr 25 18:12:59 GMT 2024

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

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

Back to the top