how to write ocl expression like this?
 
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



how to write ocl expression like this? Expand / Collapse
Author
Message
Posted 2010-03-30 00:56:00
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 2010-06-22 11:37:01
Posts: 32, Visits: 193
I have three classes ,and there relationship like this: a(1..0)-----c(0..*) and b(1..0)-------c(0..*);
how to write ocl expression equal to the sql :select * from c where c.aid=a.id and c.bid=b.id
thanks !
Post #5071
Posted 2010-03-30 03:46:35
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2010-08-18 20:45:24
Posts: 104, Visits: 315
Not sure what you are trying to do. When working with eco objects you do not need to write joins to access the associated objects. You can just get all the c objects and access the a or b objects by specifying c.a or c.b. If you are trying to get all the c objects where a is not null and b is not null then the following ocl should do that:

c.AllInstances->select(not a.IsNull and not b.IsNull)

Brian
Post #5072
Posted 2010-03-30 07:35:10
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 2010-06-22 11:37:01
Posts: 32, Visits: 193
Sorry,my english is not good enough to tell you my means.
My mean is I have get two objects a1 and b1;I want to get all the c objects which c.a=a1 and c.b=b1;
Can I get the list wich ocl expression and oclps expression.
thanks.
Post #5073
Posted 2010-03-30 20:22:55
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2010-08-18 20:45:24
Posts: 104, Visits: 315
assuming a1 and b1 are parameters passed into the ocl:

C.AllInstances->select(a = a1 and b = b1)

Post #5081
Posted 2010-03-31 10:49:01
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Today @ 09:40:19
Posts: 268, Visits: 2 465
All you need is this

ClassA.allInstances.RoleNamePointingToB.RoleNamePointingToC



====
Pete
Post #5086
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 3:34

Powered By InstantForum.NET v4.1.4 © 2010
Execution: 0,234. 13 queries. Compression Disabled.