Lecture 6 Notes

3 e classo1 classo2 class graph object graph o1 o2 e

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lass o1 ¨ See figure 1. As we did for class graphs, we use O to denote the entire object graph whose set of objects is O. 3 e class(o1) class(o2) class graph object graph o1 o2 e Figure 1: Typical link in an object graph. If there is an e-edge from o1 to o2, then there is a path class o1 e class o2 in the class graph.  ¨   ¨ All parts are optional (allowing for null values) or multi-valued (for a given object o1 , there may be many objects o2 such that e o1 o2 ). The latter case allows us to handle collections: if class c1 contains a field e that is a collection of objects of type c2 , we may represent this as e c1 c2 and use multi-valued edges in the object graph, rather than introduce the notion of collections into our model.  © ¨  © ¨ c1 and e c1 c2 , We might propose the additional condition that if class o1 then there exists an o2 such that e o1 o2 and class o2 c2 . This means that every edge predicted by the class graph exists in the object graph. All the theorems in the paper are true under this stronger definition, but the additional condition is undesirable because it rules out null fields.  © ¨   ¨    ¨ © ¨ 4 The Problem The computational problem we wish to study is the following: We are at an object o of class c in object graph O and we wish to find all reachable objects of type c . However, we have no information about the object graph other than that it is a legal object graph for C. Which edges must we explore in order to find all these objects? £ We can formalize the problem as follows. For each pair of classes c and c , we need to find a set FIRST c c such that e FIRST c c iff it is possible for an object of class c to reach an object of type c by a path beginning with an edge e. £  #£ © ¨  #£  £ 4 © ¨ More precisely, E there exists an object graph O of C and objects o and o such that: 1. class o c, 2. class o c 3. o eO o  e ( & '% £ $ FIRST c c © ¨ £ £ ¨ $ ) ¨  £  0 1£  The last condition, o eO o says that there is a path from o to o in the object graph, consisting of an edge labelled e, followed by any sequence of edges in the graph. £ £  Our lack of information about the actual object graph is represented by the existential operator. Since we cannot search explicitly over all object graphs, our goal is to find a static algorithm to compute these sets. 5 Traversal Algorithms Before considering an algorithm for finding the FIRST sets, we consider some applications of these sets. We can use these sets to find not just reachable objects of a given type, but paths that pass through objects of a given type. c1 cK be a non-empty sequence of classes. Let p Definition 3 Let R o1 oN be a path in O. We say that p is an...
View Full Document

Ask a homework question - tutors are online