Next: FD Normalization
Up: Manipulation of FDs as
Previous: FD Accessors
FD Relocation
Note that the value returned by top-gdp is not a valid total fd in itself
because it can contain paths that point within the total FD. This is shown
above in the result of (top-gdp fd1 {b}) which contains a path ((b1 1) (b2
{^2 a})). If you are interested in observing a sub-fd as a self-contained
entity with no pointers into an external environment, you must use relocate
instead of top-gdp. Relocate extracts a sub-fd from a total FD and turns
it into a stand-alone total FD.
(relocate totalfd path)
Example:
(relocate '((a ((a1 {^ a2})
(a2 ((x 2)))
(a3 {a a1})
(a4 {b})
(a5 {^2 c})))
(b {a a1})
(c ((c1 1))))
{a})
=>
((a1 {^ a2}) <-- NOTE keep relative path
(a2 ((x 2)))
(a3 {a1}) <-- NOTE updated path
(a4 ((x 2))) <-- NOTE loose conflation a4/a2 because went out of a
scope.
(a5 ((c1 1)))) <-- NOTE resolved path
|
This function performs the following adjustments:
- Extract the sub-fd with top-gdp.
- Analyzes all paths found in the sub-fd. Absolute paths which point within
the sub-fd are updated to make them relative to the new root. For example,
above, the path (a3 {a a1}) is update to (a3 {a1}).
- Paths which point outside the scope of the new root are resolved and
replaced by the value pointed to. For example, (a5 {^2 c}) is replaced by
(a5 ((c1 1))).
- Relative paths which point inside the total FD remain relative paths. For
example, (a1 {^ a2}) remains relative.
- Conflations which are established indirectly through a feature which lies
outside the scope of the sub-fd are lost. This is the case above between
a1 and a4. In the original total FD, a1 and a4 are unified, because {a a4}
points to {b} which points to {a a1}. During the extraction analysis, it
is found that a4 points outside the scope of a (to b), and therefore, the
path is resolved. In this case, information is lost, since in the result,
a1 and a4 happen to have the same value, but they are not conflated.
The reverse of relocate is insert-fd, which inserts a total FD within a
larger total FD. The function also performs analysis of all the paths
found within the inserted FD to adjust them to their new environment.
(insert-fd fd total subfd-path)
Insert Fd into TOTAL at location subfd-path.
Example:
(insert-fd '((a {b}) (b 1) (c {^ b}))
'((b 2) (c ((x 1))))
{c})
=>
((b 2)
(c ((x1 1) <--- NOTE the inserted FD is unified with the
existing sub-fd
(a {c b}) <--- NOTE updated path.
(b 1)
(c {c b})))) <--- NOTE relative path is resolved
|
The main features of this function are illustrated by the example:
- The new FD is unified with the existing sub-fd at location subfd-path in
the total FD (so the FD ((x1 1)) is enriched with the new FD).
- Paths in the inserted FD are adjusted to their new environment. Absolute
paths are prefixed by subfd-path, and relative paths are resolved and made
absolute relative to the new root (e.g., (c {^ b}) is resolved to
(c {c b}).
Next: FD Normalization
Up: Manipulation of FDs as
Previous: FD Accessors
Michael Elhadad - elhadad@cs.bgu.ac.il