Skip to main content



      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 14:49 Go to next message
Eclipse UserFriend
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 284 times)
Re: How to specify composed key in a reference [message #1823137 is a reply to message #1823124] Fri, 20 March 2020 00:23 Go to previous message
Eclipse UserFriend
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.
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: Wed Jul 23 13:41:49 EDT 2025

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

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

Back to the top