Issue 19127: Support zero and multiple context invariants (ocl2-rtf) Source: Model Driven Solutions (Dr. Edward Willink, ed(at)willink.me.uk) Nature: Clarification Severity: Minor Summary: A.5.1.5 suggests that an invariant may be specified for many contexts. The Complete OCL syntax does not support this. Many users like to write grandiose truths: context X inv: X.allInstances()->... These do not use the context and so naively increase the complexity from O(N) to O(N*N). Suggest allowing such constraints to be context-less constraints provided by the Package rather than a spurious Classifier. Resolution: Revised Text: Actions taken: November 27, 2013: received issue Discussion: End of Annotations:===== m: webmaster@omg.org Date: 27 Nov 2013 02:42:26 -0500 To: Subject: Issue/Bug Report ******************************************************************************* Name: Edward Willink Employer: mailFrom: ed@willink.me.uk Terms_Agreement: I agree Specification: OCL Section: 12 FormalNumber: formal/2012-01-01 Version: 2.3.1 Doc_Year: 2012 Doc_Month: January Doc_Day: 01 Page: 224 Title: Support zero and multiple context invariants Nature: Clarification Severity: Minor CODE: 3TMw8 B1: Report Issue Remote Name: edwillink.plus.com Remote User: HTTP User Agent: Mozilla/5.0 (Windows NT 6.0; rv:25.0) Gecko/20100101 Firefox/25.0 Time: 02:42 AM Description: A.5.1.5 suggests that an invariant may be specified for many contexts. The Complete OCL syntax does not support this. Many users like to write grandiose truths: context X inv: X.allInstances()->... These do not use the context and so naively increase the complexity from O(N) to O(N*N). Suggest allowing such constraints to be context-less constraints provided by the Package rather than a spurious Classifier. X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=e4I/F8Z/ c=1 sm=1 tr=0 a=eW53zEZrsyElcQ0NK1QpqA==:117 a=eW53zEZrsyElcQ0NK1QpqA==:17 a=0Bzu9jTXAAAA:8 a=yHWlLdbd9ikA:10 a=ZQkIueT9jI8A:10 a=IkcTkHD0fZMA:10 a=YYzpnO7rAAAA:8 a=YT6OzUMu_78A:10 a=KHpXyVWLAAAA:8 a=EBOSESyhAAAA:8 a=oCcaPWc0AAAA:8 a=eZbb1mKhr-BdxZNcE8IA:9 a=gSqYHW0Sux1rwS6I:21 a=-G8ctICLsr7fyQCk:21 a=GeFLBfWzroYQ2SGy:21 a=QEXdDO2ut3YA:10 a=UiCQ7L4-1S4A:10 a=hTZeC7Yk6K0A:10 a=_W_S_7VecoQA:10 a=frz4AuCg-hUA:10 a=c9tJgGcuwpQA:10 a=WP4_USCxRkkA:10 Date: Wed, 27 Nov 2013 15:59:17 +0000 From: Ed Willink User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 To: "ocl2-rtf@omg.org" Subject: Re: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants X-Virus-Scanned: amavisd-new at omg.org Hi David You certainly can, but I'm just observing normal practice. For a long time there has been the "never use allInstances()" guideline because naive tooling can be horrendously inefficient. But that doesn't stop users from using allInstances(). I now question why users should be recommended to compensate for naff tooling. The example in In 7.6.10 is a classic case context Person inv: Person.allInstances()->forAll(p1, p2 | p1 <> p2 implies p1.name <> p2.name) would be better written as context inv: -- this is not legal in OCL 2.3.1 Person.allInstances()->forAll(p1, p2 | p1 <> p2 implies p1.name <> p2.name) to avoid the naive O(P*P*P) rather than O(P*P) complexity. [Or O(P*log(P)) of: context inv: let allPersons = Person.allInstances() in allPersons->size() = allPersons.name->asSet()->size()] Many invariants are global statements. Mandating that they be contexted to some not very helpful Classifier seems unhelpful. Let's give users some freedom to modularize constraints as they see fit. Regards Ed Willink On 27/11/2013 15:28, AKEHURST David wrote: could one not write instead, context X inv: self. to achieve the same constraint ? writing "global" invariants seems to me to be breaking a fundemental principle of OO. From: Juergen Boldt [mailto:juergen@omg.org] Sent: 27 November 2013 15:17 To: issues@omg.org; ocl2-rtf@omg.org Subject: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants From: webmaster@omg.org Date: 27 Nov 2013 02:42:26 -0500 To: Subject: Issue/Bug Report ******************************************************************************* Name: Edward Willink Employer: mailFrom: ed@willink.me.uk Terms_Agreement: I agree Specification: OCL Section: 12 FormalNumber: formal/2012-01-01 Version: 2.3.1 Doc_Year: 2012 Doc_Month: January Doc_Day: 01 Page: 224 Title: Support zero and multiple context invariants Nature: Clarification Severity: Minor CODE: 3TMw8 B1: Report Issue Remote Name: edwillink.plus.com Remote User: HTTP User Agent: Mozilla/5.0 (Windows NT 6.0; rv:25.0) Gecko/20100101 Firefox/25.0 Time: 02:42 AM Description: A.5.1.5 suggests that an invariant may be specified for many contexts. The Complete OCL syntax does not support this. Many users like to write grandiose truths: context X inv: X.allInstances()->... These do not use the context and so naively increase the complexity from O(N) to O(N*N). Suggest allowing such constraints to be context-less constraints provided by the Package rather than a spurious Classifier. Juergen Boldt Director, Member Services 109 Highland Ave Needham, MA 02494 USA Tel: 781 444 0404 x 132 fax: 781 444 0320 www.omg.org [] No virus found in this message. Checked by AVG - www.avg.com Version: 2014.0.4259 / Virus Database: 3629/6871 - Release Date: 11/27/13 X-IronPort-AV: E=Sophos;i="4.93,782,1378854000"; d="scan'208,217";a="70957694" From: AKEHURST David To: Juergen Boldt , "issues@omg.org" , "ocl2-rtf@omg.org" Date: Wed, 27 Nov 2013 15:28:25 +0000 Subject: RE: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants Thread-Topic: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants Thread-Index: Ac7rg+WNtC/Kuo/9RAK2I+2v2AWxHwAATAoA Accept-Language: en-US, en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, en-GB X-SpamInfo: helo-dns, X-Virus-Scanned: amavisd-new at omg.org could one not write instead, context X inv: self. to achieve the same constraint ? writing "global" invariants seems to me to be breaking a fundemental principle of OO. From: Juergen Boldt [mailto:juergen@omg.org] Sent: 27 November 2013 15:17 To: issues@omg.org; ocl2-rtf@omg.org Subject: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants From: webmaster@omg.org Date: 27 Nov 2013 02:42:26 -0500 To: Subject: Issue/Bug Report ******************************************************************************* Name: Edward Willink Employer: mailFrom: ed@willink.me.uk Terms_Agreement: I agree Specification: OCL Section: 12 FormalNumber: formal/2012-01-01 Version: 2.3.1 Doc_Year: 2012 Doc_Month: January Doc_Day: 01 Page: 224 Title: Support zero and multiple context invariants Nature: Clarification Severity: Minor CODE: 3TMw8 B1: Report Issue Remote Name: edwillink.plus.com Remote User: HTTP User Agent: Mozilla/5.0 (Windows NT 6.0; rv:25.0) Gecko/20100101 Firefox/25.0 Time: 02:42 AM Description: A.5.1.5 suggests that an invariant may be specified for many contexts. The Complete OCL syntax does not support this. Many users like to write grandiose truths: context X inv: X.allInstances()->... These do not use the context and so naively increase the complexity from O(N) to O(N*N). Suggest allowing such constraints to be context-less constraints provided by the Package rather than a spurious Classifier. Juergen Boldt Director, Member Services 109 Highland Ave Needham, MA 02494 USA Tel: 781 444 0404 x 132 fax: 781 444 0320 www.omg.org [] X-IronPort-AV: E=Sophos;i="4.93,783,1378854000"; d="scan'208,217";a="70962884" From: AKEHURST David To: Ed Willink , "ocl2-rtf@omg.org" Date: Wed, 27 Nov 2013 16:05:56 +0000 Subject: RE: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants Thread-Topic: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants Thread-Index: Ac7rigClFIFIOx9KSZ2nvjsGlhA9PgAAIgwA Accept-Language: en-US, en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, en-GB X-SpamInfo: helo-dns, X-Virus-Scanned: amavisd-new at omg.org would some kind context still not be needed by tooling? i.e. to scope the instances of Person. e.g. some kind of "Model Instance" or object Registry? From: Ed Willink [mailto:ed@willink.me.uk] Sent: 27 November 2013 15:59 To: ocl2-rtf@omg.org Subject: Re: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants Hi David You certainly can, but I'm just observing normal practice. For a long time there has been the "never use allInstances()" guideline because naive tooling can be horrendously inefficient. But that doesn't stop users from using allInstances(). I now question why users should be recommended to compensate for naff tooling. The example in In 7.6.10 is a classic case context Person inv: Person.allInstances()->forAll(p1, p2 | p1 <> p2 implies p1.name <> p2.name) would be better written as context inv: -- this is not legal in OCL 2.3.1 Person.allInstances()->forAll(p1, p2 | p1 <> p2 implies p1.name <> p2.name) to avoid the naive O(P*P*P) rather than O(P*P) complexity. [Or O(P*log(P)) of: context inv: let allPersons = Person.allInstances() in allPersons->size() = allPersons.name->asSet()->size()] Many invariants are global statements. Mandating that they be contexted to some not very helpful Classifier seems unhelpful. Let's give users some freedom to modularize constraints as they see fit. Regards Ed Willink On 27/11/2013 15:28, AKEHURST David wrote: could one not write instead, context X inv: self. to achieve the same constraint ? writing "global" invariants seems to me to be breaking a fundemental principle of OO. From: Juergen Boldt [mailto:juergen@omg.org] Sent: 27 November 2013 15:17 To: issues@omg.org; ocl2-rtf@omg.org Subject: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants From: webmaster@omg.org Date: 27 Nov 2013 02:42:26 -0500 To: Subject: Issue/Bug Report ******************************************************************************* Name: Edward Willink Employer: mailFrom: ed@willink.me.uk Terms_Agreement: I agree Specification: OCL Section: 12 FormalNumber: formal/2012-01-01 Version: 2.3.1 Doc_Year: 2012 Doc_Month: January Doc_Day: 01 Page: 224 Title: Support zero and multiple context invariants Nature: Clarification Severity: Minor CODE: 3TMw8 B1: Report Issue Remote Name: edwillink.plus.com Remote User: HTTP User Agent: Mozilla/5.0 (Windows NT 6.0; rv:25.0) Gecko/20100101 Firefox/25.0 Time: 02:42 AM Description: A.5.1.5 suggests that an invariant may be specified for many contexts. The Complete OCL syntax does not support this. Many users like to write grandiose truths: context X inv: X.allInstances()->... These do not use the context and so naively increase the complexity from O(N) to O(N*N). Suggest allowing such constraints to be context-less constraints provided by the Package rather than a spurious Classifier. Juergen Boldt Director, Member Services 109 Highland Ave Needham, MA 02494 USA Tel: 781 444 0404 x 132 fax: 781 444 0320 www.omg.org [] No virus found in this message. Checked by AVG - www.avg.com Version: 2014.0.4259 / Virus Database: 3629/6871 - Release Date: 11/27/13 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=e4I/F8Z/ c=1 sm=1 tr=0 a=eW53zEZrsyElcQ0NK1QpqA==:117 a=eW53zEZrsyElcQ0NK1QpqA==:17 a=0Bzu9jTXAAAA:8 a=yHWlLdbd9ikA:10 a=ZQkIueT9jI8A:10 a=IkcTkHD0fZMA:10 a=YYzpnO7rAAAA:8 a=YT6OzUMu_78A:10 a=KHpXyVWLAAAA:8 a=EBOSESyhAAAA:8 a=oCcaPWc0AAAA:8 a=e1dRR4zYeerDhtp3RE8A:9 a=7JBUFChyOy3gzi_9:21 a=v1c3ek94lRQXZz0N:21 a=MdamdlkbA-6HswRo:21 a=QEXdDO2ut3YA:10 a=UiCQ7L4-1S4A:10 a=hTZeC7Yk6K0A:10 a=_W_S_7VecoQA:10 a=frz4AuCg-hUA:10 a=c9tJgGcuwpQA:10 a=WP4_USCxRkkA:10 Date: Wed, 27 Nov 2013 16:17:00 +0000 From: Ed Willink User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 To: "ocl2-rtf@omg.org" Subject: Re: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants X-Virus-Scanned: amavisd-new at omg.org Hi David For package XXX context inv: -- this is not legal in OCL 2.3.1 Person.allInstances()->forAll(p1, p2 | p1 <> p2 implies p1.name <> p2.name) endpackage there is no context (other than the Package) so 'self' cannot be used. I envision that a Package constraint can be realised as Namespace.ownedRule just the same as a Classifier constraint. But you're probably right that a package-less context might be illegal, and when we try to be more definitive about the domain of allInstances() we will need to explain how the genuine class instances are related to the fictitious 'Package XXX instance'. Regards Ed Willink On 27/11/2013 16:05, AKEHURST David wrote: would some kind context still not be needed by tooling? i.e. to scope the instances of Person. e.g. some kind of "Model Instance" or object Registry? From: Ed Willink [mailto:ed@willink.me.uk] Sent: 27 November 2013 15:59 To: ocl2-rtf@omg.org Subject: Re: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants Hi David You certainly can, but I'm just observing normal practice. For a long time there has been the "never use allInstances()" guideline because naive tooling can be horrendously inefficient. But that doesn't stop users from using allInstances(). I now question why users should be recommended to compensate for naff tooling. The example in In 7.6.10 is a classic case context Person inv: Person.allInstances()->forAll(p1, p2 | p1 <> p2 implies p1.name <> p2.name) would be better written as context inv: -- this is not legal in OCL 2.3.1 Person.allInstances()->forAll(p1, p2 | p1 <> p2 implies p1.name <> p2.name) to avoid the naive O(P*P*P) rather than O(P*P) complexity. [Or O(P*log(P)) of: context inv: let allPersons = Person.allInstances() in allPersons->size() = allPersons.name->asSet()->size()] Many invariants are global statements. Mandating that they be contexted to some not very helpful Classifier seems unhelpful. Let's give users some freedom to modularize constraints as they see fit. Regards Ed Willink On 27/11/2013 15:28, AKEHURST David wrote: could one not write instead, context X inv: self. to achieve the same constraint ? writing "global" invariants seems to me to be breaking a fundemental principle of OO. From: Juergen Boldt [mailto:juergen@omg.org] Sent: 27 November 2013 15:17 To: issues@omg.org; ocl2-rtf@omg.org Subject: issue 19127 -- OCL 2 RTF issue -- Support zero and multiple context invariants From: webmaster@omg.org Date: 27 Nov 2013 02:42:26 -0500 To: Subject: Issue/Bug Report ******************************************************************************* Name: Edward Willink Employer: mailFrom: ed@willink.me.uk Terms_Agreement: I agree Specification: OCL Section: 12 FormalNumber: formal/2012-01-01 Version: 2.3.1 Doc_Year: 2012 Doc_Month: January Doc_Day: 01 Page: 224 Title: Support zero and multiple context invariants Nature: Clarification Severity: Minor CODE: 3TMw8 B1: Report Issue Remote Name: edwillink.plus.com Remote User: HTTP User Agent: Mozilla/5.0 (Windows NT 6.0; rv:25.0) Gecko/20100101 Firefox/25.0 Time: 02:42 AM Description: A.5.1.5 suggests that an invariant may be specified for many contexts. The Complete OCL syntax does not support this. Many users like to write grandiose truths: context X inv: X.allInstances()->... These do not use the context and so naively increase the complexity from O(N) to O(N*N). Suggest allowing such constraints to be context-less constraints provided by the Package rather than a spurious Classifier. Juergen Boldt Director, Member Services 109 Highland Ave Needham, MA 02494 USA Tel: 781 444 0404 x 132 fax: 781 444 0320 www.omg.org [] No virus found in this message. Checked by AVG - www.avg.com Version: 2014.0.4259 / Virus Database: 3629/6871 - Release Date: 11/27/13 No virus found in this message. Checked by AVG - www.avg.com Version: 2014.0.4259 / Virus Database: 3629/6871 - Release Date: 11/27/13