Contribution - UCM Use Cases 0p1

advertisement
UCM Use Cases
Version 0.1
1.
Introduction
This document lists uses cases for the UCM (UN/CEFACT Context
Methodology). The aim is to collect a set of test cases that can be used to
validate the workability and usability of the UCM methodology.
2.
Use Case – Reduction of Context Scope
This example is taken from the document “Why Set Based Context 0p1.doc”.
In this example, there are 3 context categories:

category I has has context values which are the uppercase letters A to Z;

category C has context values which are the lowercase letters a to z;

category B has context values which are single digits 0 to 9.
An artefact initially has the following compound context:
First Context
(I = A or B or D) and (C = a or e) and (B = 1 or 3 or 5)
Note that “and” indicates an intersection (narrowing) of contexts, which “or”
indicates a union (broadening) of contexts.
It is subsequently decided that the context that has been assigned to the
artefact is incorrect; the artefact is valid in the above context scope except
Second Context
(I = B) and (C = e) and (B = 3)
The key question of the use case is how you computer the “difference” of the
two contexts; what is the remaining context when the second context is
removed from the first context? It certainly is not correct to completely
remove the 2nd expression's context values from the first expression, which
would give
Incorrect Answer for Context Difference
(I = A or D) and (C = a) and (B = 1 or 5)
(a wrong answer).
Set-based solution
The “set-based” solution to this problem is calculated using cartesian products.
The first expression can be fully expanded as
First Context, Fully Expanded
or
or
or
or
or
or
or
or
or
or
or
or
or
or
or
or
or
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
A)
A)
A)
A)
A)
A)
B)
B)
B)
B)
B)
B)
D)
D)
D)
D)
D)
D)
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
a)
a)
a)
e)
e)
e)
a)
a)
a)
e)
e)
e)
a)
a)
a)
e)
e)
e)
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
1))
3))
5))
1))
3))
5))
1))
3))
5))
1))
3))
5))
1))
3))
5))
1))
3))
5))
The second context expression is already fully expanded, and appears as one
of the components (highlighted) of the fully expanded first expression. The
difference between the two context expressions is
Context Difference, Fully Expanded
or
or
or
or
or
or
or
or
or
or
or
or
or
or
or
or
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
((I
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
A)
A)
A)
A)
A)
A)
B)
B)
B)
B)
B)
D)
D)
D)
D)
D)
D)
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
(C
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
a)
a)
a)
e)
e)
e)
a)
a)
a)
e)
e)
a)
a)
a)
e)
e)
e)
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
1))
3))
5))
1))
3))
5))
1))
3))
5))
1))
5))
1))
3))
5))
1))
3))
5))
Tree-based solution
In the tree-based approach, contexts aren't automatically decomposed into
indivisible “leaf” contexts. Unions, intersections, and exclusions are the 3
supported operations on contexts. The first context is written
First Context, Tree-Based
(I/A or I/B or I/D) and (C/a or C/e) and (B/1 or B/3 or B/5)
where “I/A” is read as “context A in category I”, etc. The second context is
Second Context, Tree-Based
I/B and C/e and B/3
The “difference” is the exclusion of the second context from the first context,
written here as
Context Difference, Tree-Based
[ (I/A or I/B or I/D) and (C/a or C/e) and (B/1 or B/3 or B/5)
| I/B and C/e and B/3 ]
where “[X | Y]” is the context derived by excluding context Y from context X.
There is no further calculation to be done here from the point of view of this
representation. To compare this to the set-based approach, it is necessary to
demonstrate the equivalence of the two expressions. The “set-based”
expressions, when fully expanded, are unions of “simple” context intersections
which contain one and only one context value from each category. Each of
these simple intersections has zero overlap (intersection) with any other
simple intersection. For example
((I = A) and (C = a) and (B = 1))
and ((I = A) and (C = a) and (B = 3)) = Ø
where “Ø” is the empty context (i.e. no context at all). When the intersection
between two contexts is “Ø”, we say that they are “disjoint”. So the treebased expression for the context “difference” is the same as the set based
expression if

the intersection between the context difference and each of the simple
intersection components of “Context Difference, Fully Expanded” must be
the same as the simple intersection component itself;

the intersection between the context difference and the second context
must be “Ø”, i.e. the intersection must be disjoint with the second
context.
If both of these are satisfied, the tree-based expression is equivalent to the
set-based expression for the context difference.
The rules for tree-based context calculations are as follows:

“A and B” and “A or B” indicate union and intersection respectively, as
already noted;

“A > B” means A is a broader context than B (context B is a proper,
strict subset of context A);

“A < B” means A is a narrower context than B, and is equivalent to
“B > A”;

“A = B” means the two contexts are the same;

Similarly “A >= B” and “A <= B”;A and B are disjoint if


not “A = B”

A and B do not have any narrower contexts in common, i.e. there is
no non-empty context C such that “C < A” and “C < B”;
(the importance of this above rule is that any two contexts are
considered disjoint by default, and a common non-empty sub-context is
necessary to establish that they are not disjoint)

any component of a union is narrower than or equal to the union;

any component of an intersection is broader or equal to the intersection;

if “A <= B” then “(A and B) = A”;

perhaps most importantly – an exclusion [X | Y] is disjoint with the
excluded context Y, and disjoint with each context that is narrower
than the excluded context Y.
With this established, it is possible to evaluate intersections between the
simple intersections from the set-based expansions, and the tree-based
context expression.
Intersection Calculation #1
Consider the intersection of the “difference” context
[ (I/A or I/B or I/D) and (C/a or C/e) and (B/1 or B/3 or B/5)
| I/B and C/e and B/3 ]
with the first simple intersection from the “Context Difference, Fully
Expanded”, which is
I/A and C/a and B/1
This has no terms in common with the exclusion part
I/B and C/e and B/3
(i.e. it is disjoint with the exclusion part), so the exclusion part is ignored, and
the effective intersection is between
(I/A or I/B or I/D) and (C/a or C/e) and (B/1 or B/3 or B/5)
and
I/A and C/a and B/1
Since “I/A <= (I/A or I/B or I/D)” and “C/a <= (C/a or C/e)” and
“B/1 <= (B/1 or B/3 or B/5)”, then
(I/A and C/a and B/1)
<= ((I/A or I/B or I/D) and (C/a or C/e) and (B/1 or B/3 or B/5))
and the intersection then is just
I/A and C/a and B/1
as required. The same calculation applies to each of the other simple
intersection components of the “Context Difference, Fully Expanded”.
Intersection Calculation #2
Now consider the intersection between the “difference” context
[ (I/A or I/B or I/D) and (C/a or C/e) and (B/1 or B/3 or B/5)
| I/B and C/e and B/3 ]
and the second context
I/B and C/e and B/3
Since the second context is the same as the excluded part of the “difference”
context, the two are disjoint.
Consequently, the tree-based expression of the “difference” context is identical
to the set-based expression of the “difference” context.
Download