EMF reflection in completeOCL (Pivot) [message #1780017] |
Tue, 16 January 2018 09:58  |
Eclipse User |
|
|
|
I am using CompleteOCL scripts to add constraints to an EMF data model and I need to iterate over the set of features/references.
This is provided in the EMF API by EObject::eCrossReferences() but I cannot cast to EObject in the OCL
context MyDataClass
def: crossRefs() : Integer = self.oclAsType(ecore::EObject).eCrossReferences()->size()
inv HasCrossRefs : self.crossRefs() > 0
For each item of MyDataClass I get the error
'Incompatible source type: 'MyDataClass' for oclAsType(ecore::EObject)
From the OCL FAQ https://wiki.eclipse.org/OCL/FAQ I understand that for the Classic OCL the Parsing option implicitRootClass can be set to EObject to solve this, but in the Pivot OCL this is deprecated and only oclContainer() and oclContents() EMF functions are available (which work fine).
How can I discover an object's references (from a supertype context) using CompleteOCL and the Pivot OCL?
|
|
|
|
Powered by
FUDForum. Page generated in 0.04123 seconds