Presentation is loading. Please wait.

Presentation is loading. Please wait.

/ department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20021 1. Extraction Operators Projection.

Similar presentations


Presentation on theme: "/ department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20021 1. Extraction Operators Projection."— Presentation transcript:

1 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20021 1. Extraction Operators Projection Selection Unorder Join Cartesian Product Union Difference Intersection set-like operators (commutativity)

2 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20022 Projection  [type, name](e: expression) = follows the edges of a given type and name from the input collection of vertices. The result is the collection of target vertices of the followed edges. The order of the output collection depends on the order of the input collection. type = E, A, R, D or disjunctions (|) of these name = regular expression over strings Example.  [E, (P|p)ainter[s]#)](e) produces all the target vertices of element containment edges that have names starting with Painter, painter, Painters, or painters, and that originate from the vertices in e.

3 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20023 Selection  [condition](e: expression) = selects input collection vertices fulfilling the given condition. The order of the output collection depends on the order of the input collection. In condition one can use projection operator, comparison operators (=, etc.), and logical operators (and, or, not). Example.  [  [A, name]=“Dali”](e: expression) selects all the vertices that have an attribute called name with the value “Dali”.

4 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20024 Unorder  (e: expression) = unorders an input collection. Unordering collections enables the definition of set-like (commutative) operators. ⋈, , , , and  are considering the order of the input collections in building the result. Unordering input collections enables the usage of their set-like variants (order is not important). Two vertices are equal if they have the same value.

5 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20025 Join (x: expression) ⋈ [condition] (y: expression) =  [condition](x  y) = the cartesian product is defined as two loops: the external loop traverses the left input collection and the internal loop traverses the right input collection. The pairs that fulfill the join condition form virtual vertices that have as outgoing edges, first the outgoing edges of the vertex from the left input collection and then the outgoing edges of the vertex from the right input collection preserving the original edge order.

6 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20026 Join (ctn’d) Example. (x:  [E, person](people)) ⋈ [  [A, id](x) =  [A, name](y)] (y:  [E, painter](painters)) pairs person and painter vertices in virtual vertices based on the equality of the id attribute value of a person and the name attribute value of a painter. Cartesian Product (x: expression)  (y: expression) = join without condition.

7 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20027 Difference (x: expression)  (y:expression) = the result is a collection containing vertices that exist in first collection but not in second one preserving the original vertex order of the left input collection. Intersection (x: expression)  (y:expression) = the result is a collection containing vertices that exist in both input collections preserving the original vertex order of the left input collection.

8 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20028 Union (x: expression)  (y:expression) = the result is a collection that contains first the left input collection, then the right input collection preserving the original vertex order. It can be easily generalized to an n-ary operator. Flexibility ensured by the fact that the input collections do not have to be “union compatible” as it was the case in relational algebra.

9 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20029 2. Meta-operators Map map[f](e: expression) = applies a given function f to each element of the input collection. The function results are concatenated in the output collection. All unary extraction operators have an inherent map operator associated to them. In the construction phase, the map operator is used explicitly to iterate not just over collection of vertices but also collection of edges.

10 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 200210 Kleene Star  [f](e: expression) = repeats a given function f possibly infinite times starting with the given input collection. At each iteration the results of the function are added to the next function input. The order of the result collection depends on the order of the input collection and the recursion order. Compared with the map operator it includes in the result the input collection. When a fix point is reached (output = input) the repetition stops.

11 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 200211 3. Construction Operators Create vertex vertex[type](value) = adds a new vertex with the given type and value to the graph. Example. v 1 : vertex[element](null) creates a vertex of type element which has a new value (id) given by the system (by a skolem function) and v 2 : vertex[string](“Dali”) creates a vertex of type string and value “Dali”.

12 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 200212 Create edge edge[type, name, parent](child) = adds a new edge with a given type, name, parent, and child vertex to the graph. Before inserting a new edge of type E, the resulting graph is checked for presence of loops among element containment edges. If such a loop is formed the operation is unsuccessful. Example. edge[E, painter, v 1 ](v 2 ) creates an edge of type E with name painter between two vertices (the vertices from the previous example).

13 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 200213 Examples Example. Copying a vertex v means creating a new vertex with the type and value of the original vertex: vertex[type(v)](value(v)). Example. Copying an edge e, involves copying also the parent and children vertices: edge[type(e), name(e), v p ](v c ) where v p = vertex[type(parent(e))](value(parent(e)), and v c = vertex[type(child(e))](value(child(e))).

14 / department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 200214 Example. Copying a complete graph starting from the vertex v can be done by copying all the graph edges and their associated vertices: map[edge[type(e), name(e), vertex[type(parent(e))](value(parent(e))) ](vertex[type(child(e))](value(child(e)))) ](e) where e = *[parentedge(  [E|A|D, #](child(x)))] (x: parentedge(  [E|A|D, #](v))) e represents all the edges in the original graph. For each original vertex a unique new vertex is created using a skolem function.


Download ppt "/ department of mathematics and computer science TU/e eindhoven university of technology ADC 2002 (Extra)January 29, 20021 1. Extraction Operators Projection."

Similar presentations


Ads by Google