Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Navigating a non-navigable (one way) association (Is it possible to navigate along a non-navigable (one way) association?)
icon5.gif  Navigating a non-navigable (one way) association [message #694498] Fri, 08 July 2011 13:54 Go to previous message
Mark Sluser is currently offline Mark Sluser
Messages: 15
Registered: June 2011
Location: Calgary
Junior Member
I have the following XML model:


MultiBlock
     Block
          BlockDef
               Parameters
                    Parameter
          EmbBlocks
               Block
                    BlockDef
               Block
                    BlockDef




Block must contain BlockDef
Block can contain EmbBlocks
EmbBlocks can contain Block


I want to select all the Block objects contained in the EmbBlock object if the top level BlockDef has certain values.

I was trying

context MultiBlock
block.embBlocks->excluding(null).block->select(this.block.blockDef.templateName='SYSTEM:CPM200')



but this fails.

Evaluating:
block.embBlocks->excluding(null).block->select(this.block.blockDef.templateName='SYSTEM:CPM200')
Results:
Parsing failure
null
Unresolved property 'block' for 'unknown-type'
Unresolved property 'embBlocks' for 'OclInvalid'
Unresolved property 'block' for 'Set<OclInvalid>'
Unresolved property 'this' for 'Bag<OclInvalid>'
Unresolved property 'block' for 'OclInvalid'
Unresolved property 'blockDef' for 'OclInvalid'
Unresolved property 'templateName' for 'OclInvalid'
Unresolved property 'block' for 'Bag<OclInvalid>'



Because the model is XML it does not contain opposite navigations
IE, I can't navigate from BlockDef up to its container Block.

Does OCL have the capability to select objects based on a condition that must be computed from on a non-navigable (one way) association? How do I reference back to the starting context?

I was thinking:

context MultiBlock
block.embBlocks->excluding(null).block->select(<<embBlocks_opposite>>.<<block_opposite>>.block.blockDef.templateName='SYSTEM:CPM200')




what would be a query that works?

This query is going to feed a QVTO transform.

Thank you,

-Mark
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Previous Topic:OCL Interactive Query fails for large file
Next Topic:oclAsType for external classes
Goto Forum:
  


Current Time: Tue May 21 18:02:25 EDT 2013

Powered by FUDForum. Page generated in 0.01597 seconds