170 likes | 283 Views
A Simple Logic For Contexts. Anthony B. Coates, Miley Watts LLP, abcoates@mileywatts.com 13 th December 2007 Contributed to the UN/CEFACT Context Methodology project. Assumptions. Context model made up of individually identifiable context nodes
E N D
A Simple Logic For Contexts Anthony B. Coates, Miley Watts LLP, abcoates@mileywatts.com 13th December 2007 Contributed to the UN/CEFACT Context Methodology project
Assumptions • Context model made up of individually identifiable context nodes • Contexts can have broader/narrower associations with each other • No circular references allowed • Also allow unions of contexts – each item in the union is narrower than the union • Also allow intersections of contexts – each item in the intersection is broader than the intersection
Notation • “A and B” is the intersection of contexts A and B • “A or B” is the union of contexts A and B • We will write “A > B” if context A is broader than context B • “A < B” if context A is narrower than context B • “A = B” if contexts A and B are the same context (or have a “same as” association), or if they are “identical” contexts (explained later) • Similarly “A <= B”, “A >= B”
Comparison • Two union contexts are identical if they are composed identical contexts (flattening any unions which are items in the union) • (A or B) or (C or D)= A or B or C or D
Comparison • Two intersection contexts are identical if they are composed of identical contexts (flattening any intersections which are items in the intersection) • (A and B) and (C and D)= A and B and C and D
Comparison • Two contexts A and B are disjoint if • not “A = B” • they do not have any “narrower” contexts in common • This means that contexts are treated as disjoint by default, and only a common narrower context (not an intersection context nor via an intersection context) can establish that two contexts are not disjoint
Comparison • Two unions are disjoint if they do not contain any of the same items (once flattening of union items is applied) • “A or B” is disjoint from “C or D” • Two intersections are disjoint unless they contain all of the same items (once flattening of intersection items is applied) • “A and B” disjoint from “A and C”
Comparison • Comparison of intersections: • “A and B” <= “C and D” if and only if • “A <= C” and “B <= D”, or • “A <= D” and “B <= C” • “A and B” >= “C and D” if and only if • “A >= C” and “B >= D”, or • “A >= D” and “B >= C” • Reverse these for “>” and “<” respectively
Assumptions • Also allow exclusions – each exclusion includes 1 context and excludes 1 context • This is a slight change from the definition in the current proposal, but not a significant change • Makes it easier to express these rules • The exclusion is disjoint with the excluded context, and disjoint with each context that is narrower than the excluded context • Otherwise, perform comparisons with the included context
Examples • These are the rules • Short and sweet • Let's look at some examples of how this works in practice • In each example, there is a message which contains some BIEs • Each BIE has been associated with a context • A context is also applied to the message
Examples • If the BIE's context and the message's context are disjoint, then the BIE is suppressed from the message • If the BIE's context is narrower than the message's context, then the BIE is suppressed from the message • Otherwise, the BIE is included in the message • Note: a BBIE or ASBIE context must not be broader than the parent ABIE's context
Example #1 • BIE #1: All • BIE #2: North America and Automotive • BIE #3: USA and Marine • Message: North America • BIE #1 is broader – included • BIE #2 is narrower (message not automotive) – excluded • BIE #3 is disjoint (Automotive not = Marine) – excluded
Example #2 • BIE #1: All • BIE #2: North America and Automotive • BIE #3: USA and Marine • Message: North America and Automotive • BIE #1 is broader – included • BIE #2 is identical – included • BIE #3 is disjoint (Automotive not = Marine) – excluded
Example #3 • BIE #1: All • BIE #2: North America and Automotive • BIE #3: USA and Marine • Message: USA and Automotive • BIE #1 is broader – included • BIE #2 is broader – included • BIE #3 is disjoint (Automotive not = Marine) – excluded
Example #4 • BIE #1: All • BIE #2: North America and Automotive • BIE #3: USA and Marine • Message: USA and Marine • BIE #1 is broader – included • BIE #2 is disjoint (Automotive not = Marine) – excluded • BIE #3 is identical – included
Example #5 • BIE #1: All • BIE #2: North America excluding USA • BIE #3: USA and Marine • Message: North America and Marine • BIE #1 is broader – included • BIE #2 is (effectively) broader – included • BIE #3 is narrower – excluded
Example #6 • BIE #1: All • BIE #2: North America excluding USA • BIE #3: USA and Marine • Message: USA and Marine • BIE #1 is broader – included • BIE #2 is excluded by “USA” • BIE #3 is identical – excluded