Πανεπιστήμιο Κρήτης Τμήμα Επιστήμης Υπολογιστών. ΗΥ-561 Διαχείριση Δεδομένων στο Παγκόσμιο Ιστό Ειρήνη Φουντουλάκη Βασίλης Χριστοφίδης

Σχετικά έγγραφα
ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

EE512: Error Control Coding

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

2 Composition. Invertible Mappings

Homework 3 Solutions

Εισαγωγή(στη(γλώσσα(XML(

Οδηγίες Αγοράς Ηλεκτρονικού Βιβλίου Instructions for Buying an ebook

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

Matrices and Determinants

ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ ΣΤΟΝ ΠΑΓΚΟΣΜΙΟ ΙΣΤΟ

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ EPL035: ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ ΚΑΙ ΑΛΓΟΡΙΘΜΟΙ

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

derivation of the Laplacian from rectangular to spherical coordinates

Dynamic types, Lambda calculus machines Section and Practice Problems Apr 21 22, 2016

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

Section 7.6 Double and Half Angle Formulas

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 24/3/2007

HY380 Αλγόριθμοι και πολυπλοκότητα Hard Problems

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ. ΕΠΛ342: Βάσεις Δεδομένων. Χειμερινό Εξάμηνο Φροντιστήριο 10 ΛΥΣΕΙΣ. Επερωτήσεις SQL

C.S. 430 Assignment 6, Sample Solutions

ST5224: Advanced Statistical Theory II

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

Areas and Lengths in Polar Coordinates

ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ ΣΤΟΝ ΠΑΓΚΟΣΜΙΟ ΙΣΤΟ

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R +

Physical DB Design. B-Trees Index files can become quite large for large main files Indices on index files are possible.

Mean bond enthalpy Standard enthalpy of formation Bond N H N N N N H O O O

Lecture 2: Dirac notation and a review of linear algebra Read Sakurai chapter 1, Baym chatper 3

2. THEORY OF EQUATIONS. PREVIOUS EAMCET Bits.

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

The challenges of non-stable predicates

Areas and Lengths in Polar Coordinates

Section 8.3 Trigonometric Equations

Finite Field Problems: Solutions

Inverse trigonometric functions & General Solution of Trigonometric Equations

Δομές Δεδομένων & Αλγόριθμοι

AVL-trees C++ implementation

Homework 8 Model Solution Section

ΠΤΥΧΙΑΚΗ ΕΡΓΑΣΙΑ. Graphical XML Schema

5. Επερώτηση XML Εγγράφων: Εισαγωγή στη Γλώσσα XQuery

Srednicki Chapter 55

Πανεπιστήμιο Κρήτης Τμήμα Επιστήμης Υπολογιστών. ΗΥ-561 Διαχείριση Δεδομένων στο Παγκόσμιο Ιστό Βασίλης Χριστοφίδης

Πανεπιστήµιο Κρήτης Τµήµα Επιστήµης Υπολογιστών. ΗΥ-561 ιαχείριση εδοµένων στο Παγκόσµιο Ιστό Βασίλης Χριστοφίδης

department listing department name αχχουντσ ϕανε βαλικτ δδσϕηασδδη σδηφγ ασκϕηλκ τεχηνιχαλ αλαν ϕουν διξ τεχηνιχαλ ϕοην µαριανι

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

FSM Toolkit Exercises

Solution Series 9. i=1 x i and i=1 x i.

Other Test Constructions: Likelihood Ratio & Bayes Tests

Μοντέλο. για ημι-δομημένα μημ δεδομένα. Ημι-δομημένα δεδομένα XML DTD XML Schema

5.4 The Poisson Distribution.

Main source: "Discrete-time systems and computer control" by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1

Models for Probabilistic Programs with an Adversary

Σημασιολογικός Ιστός (Semantic Web) - XML

Προγραμματισμός και Συστήματα στον Παγκόσμιο Ιστό Ενότητα 5: XML. Καθ. Ιωάννης Γαροφαλάκης Πολυτεχνική Σχολή Μηχανικών Η/Υ & Πληροφορικής

Δομές Δεδομένων (Data Structures)

Σημασιολογικός Ιστός (Semantic Web) - XML

TMA4115 Matematikk 3

6.3 Forecasting ARMA processes

b. Use the parametrization from (a) to compute the area of S a as S a ds. Be sure to substitute for ds!

Numerical Analysis FMN011

Example Sheet 3 Solutions

Every set of first-order formulas is equivalent to an independent set

Approximation of distance between locations on earth given by latitude and longitude

ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ. Ψηφιακή Οικονομία. Διάλεξη 7η: Consumer Behavior Mαρίνα Μπιτσάκη Τμήμα Επιστήμης Υπολογιστών

Fractional Colorings and Zykov Products of graphs

Δομές Δεδομένων Ενότητα 5

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

Uniform Convergence of Fourier Series Michael Taylor

ΣΗΜΑΣΙΟΛΟΓΙΚΟΣ ΙΣΤΟΣ - XML

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω

(C) 2010 Pearson Education, Inc. All rights reserved.

Math221: HW# 1 solutions

Partial Differential Equations in Biology The boundary element method. March 26, 2013

ANSWERSHEET (TOPIC = DIFFERENTIAL CALCULUS) COLLECTION #2. h 0 h h 0 h h 0 ( ) g k = g 0 + g 1 + g g 2009 =?

ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΙΑΣ ΤΜΗΜΑ ΠΟΛΙΤΙΚΩΝ ΜΗΧΑΝΙΚΩΝ ΤΟΜΕΑΣ ΥΔΡΑΥΛΙΚΗΣ ΚΑΙ ΠΕΡΙΒΑΛΛΟΝΤΙΚΗΣ ΤΕΧΝΙΚΗΣ. Ειδική διάλεξη 2: Εισαγωγή στον κώδικα της εργασίας

1. Αφετηρία από στάση χωρίς κριτή (self start όπου πινακίδα εκκίνησης) 5 λεπτά µετά την αφετηρία σας από το TC1B KALO LIVADI OUT

Potential Dividers. 46 minutes. 46 marks. Page 1 of 11

Συστήματα Διαχείρισης Βάσεων Δεδομένων

Πανεπιστήµιο Κρήτης - Τµήµα Επιστήµης Υπολογιστών. ΗΥ-570: Στατιστική Επεξεργασία Σήµατος. ιδάσκων : Α. Μουχτάρης. εύτερη Σειρά Ασκήσεων.

Ενότητες 3 & 4: Δένδρα, Σύνολα & Λεξικά Ασκήσεις και Λύσεις

Trigonometric Formula Sheet

SCITECH Volume 13, Issue 2 RESEARCH ORGANISATION Published online: March 29, 2018

On a four-dimensional hyperbolic manifold with finite volume

( y) Partial Differential Equations

Αλγόριθμοι Ταξινόμησης Μέρος 3

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

Bayesian statistics. DS GA 1002 Probability and Statistics for Data Science.

Ευρετήρια. Βάσεις Δεδομένων. Διδάσκων: Μαρία Χαλκίδη

Statistical Inference I Locally most powerful tests

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

Chapter 3: Ordinal Numbers

Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο

«Χρήσεις γης, αξίες γης και κυκλοφοριακές ρυθμίσεις στο Δήμο Χαλκιδέων. Η μεταξύ τους σχέση και εξέλιξη.»

Δημιουργία Λογαριασμού Διαχείρισης Business Telephony Create a Management Account for Business Telephony

MINIMAL CLOSED SETS AND MAXIMAL CLOSED SETS

Nowhere-zero flows Let be a digraph, Abelian group. A Γ-circulation in is a mapping : such that, where, and : tail in X, head in

Notes on the Open Economy

UNIVERSITY OF CALIFORNIA. EECS 150 Fall ) You are implementing an 4:1 Multiplexer that has the following specifications:

Section 9.2 Polar Equations and Graphs

Transcript:

Ονοματεπώνυμο: Αριθμός Μητρώου: Πανεπιστήμιο Κρήτης Τμήμα Επιστήμης Υπολογιστών ΗΥ-561 Διαχείριση Δεδομένων στο Παγκόσμιο Ιστό Ειρήνη Φουντουλάκη Βασίλης Χριστοφίδης Άσκηση 1 (8 μονάδες) Τελική Εξέταση (3 ώρες) Ημερομηνία: Πέμπτη 19 Ιουνίου 2010 Θεωρείστε το παρακάτω XML schema: Consider the following XML schema: <?xml version="1.0" encoding="iso-8859-1"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:simpletype name="stringtype"> <xs:restriction base="xs:string"/> </xs:simpletype> <xs:simpletype name="inttype"> <xs:restriction base="xs:positiveinteger"/> </xs:simpletype> <xs:simpletype name="dectype"> <xs:restriction base="xs:decimal"/> </xs:simpletype> <xs:simpletype name="orderidtype"> <xs:restriction base="xs:string"> <xs:pattern value="[0-9]{6}"/> </xs:restriction> </xs:simpletype> <xs:complextype name="shiptotype"> <xs:sequence> <xs:element name="name" type="stringtype"/> <xs:element name="address" type="stringtype"/> <xs:element name="city" type="stringtype"/> <xs:element name="country" type="stringtype"/> </xs:sequence> </xs:complextype> <xs:complextype name="itemtype"> <xs:sequence> <xs:element name="title" type="stringtype"/> <xs:element name="note" type="stringtype" minoccurs="0"/> <xs:element name="quantity" type="inttype"/> <xs:element name="price" type="dectype"/> </xs:sequence> </xs:complextype> <xs:complextype name="shipordertype">

<xs:sequence> <xs:element name="orderperson" type="stringtype"/> <xs:element name="shipto" type="shiptotype"/> <xs:element name="item" maxoccurs="unbounded" type="itemtype"/> </xs:sequence> <xs:attribute name="orderid" type="orderidtype" use="required"/> </xs:complextype> <xs:element name="shiporderdb"> <xs:complextype> <xs:sequence> <xs:element name="shiporder" maxoccurs="unbounded" type="shipordertype"/> </xs:sequence> </xs:complextype> </xs:element> </xs:schema> Δημιουργείστε ένα έγκυρο (valid) XML έγγραφο για το παραπάνω σχήμα. Η ρίζα (root element) του εγγράφου είναι ένα στοιχείο "shiporderdb" το οποίο έχει δύο στοιχεία "shiporder". Το έγγραφο που περιέχει το σχήμα XML αποθηκεύεται στο αρχείο shiporder.xsd και στον ίδιο φάκελο με το XML έγγραφο που θα δημιουργήσετε. Create a valid XML document with a "shiporderdb" root element and two "shiporder" elements. We assume that the XML schema is stored in the file shiporder.xsd in the same directory as the XML document. <?xml version="1.0" encoding="iso-8859-1"?> <shiporderdb xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="shiporder.xsd"> <shiporder orderid="889923"> <orderperson>irini Fundulaki</orderperson> <shipto> <name>vassilis Christophides</name> <address>1234 Panepistimou St</address> <city>athens</city> <country>greece</country> </shipto> <item> <title>data Base Systems: The Complete Book</title> <note>second Edition</note> <quantity>1</quantity> <price>49.90</price> </item> <item> <title>data Mining: Concepts and Techniques</title> <quantity>1</quantity> <price>59.90</price>

</item> </shiporder> <shiporder orderid="712456"> <orderperson>vassilis Christophides</orderperson> <shipto> <name>irini Fundulaki</name> <address>7890 Panepistimiou St</address> <city>athens</city> <country>greece</country> </shipto> <item> <title>the Kyte Runner</title> <note>christmas sale</note> <quantity>1</quantity> <price>10.50</price> </item> <item> <title>hide your heart</title> <quantity>1</quantity> <price>9.90</price> </item> </shiporder> </shiporderdb> Άσκηση 2 (23 μονάδες) Θεωρείστε το έγγραφο XML ShiporderDB.xml το οποίο ανταποκρίνεται στο XML schema της άσκησης 1. Γράψτε την αντίστοιχη επερώτηση XQuery για κάθε μία από τις ερωτήσεις (a) (d). Εξαλείψτε στις περιπτώσεις που μπορείτε τα αντίγραφα (duplicates) στα αποτελέσματα. Consider an XML document ShiporderDB.xml that conforms to the above XML schema. Formulate the following queries on this XML document in XQuery. Where applicable, eliminate duplicate results. a) (5 μονάδες) Βρείτε τα στοιχεία item τα οποία έχουν αποσταλεί ( shipto ) στην Αθήνα και επιστρέψτε ως ακολουθία εκείνα τα οποία έχουν την μέγιστη χρηματική αξία ( price ). Επιστρέψτε τα στοιχεία αυτά ως ακολουθία. Find the XML element «item» shipped to Athens (shipto) with the maximum price among these items, as a sequence of item elements. let $items := doc( ShiporderDB.xml )/shiporderdb/shiporder [contains(shipto/city, Athens )]/item let $max := max($items/price) for $i in doc( ShiporderDB.xml )/shiporderdb/shiporder [contains(shipto/city, Athens )]/item

where $i/price = $max return $i b) (8 μονάδες) Για όλα τα στοιχεία shiporder τα οποία περιέχουν ένα στοιχείο item με την λέξη Data στο υπο-στοιχείο τους title, επιστρέψτε ένα στοιχείο result το οποίο περιέχει το στοιχείο orderid και τον αριθμό των στοιχείων item του shiporder. For all «shiporder» elements that contain an element «item» that has Data in its subelement «title», produce a «result» element consisting of the orderid and the number of «item» elements of the shiporder element. for $s in doc( ShiporderDB.xml )/shiporderdb/shiporder where some $i in $s/item satisfies contains($i/title, Data ) return <result> {$s/@orderid} {count($s/item)} </result> c) (5 μονάδες) Για όλα τα στοιχεία orderperson που έχουν αποστείλει μία παραγγελία ( order ) στην Ελλάδα, επιστρέψτε το στοιχείο orderperson και μία ακολουθία των item που έχουν αποσταλεί. Να συμπεριλάβετε όλη την πληροφορία σχετικά με ένα στοιχείο orderperson στο ίδιο στοιχείο αποτελέσματος. For all «orderperson» elements who have shipped an order to Greece, find the orderperson and the sequence of all «item» elements that have been shipped. Include all information belonging to the same «orderperson» elements into one result element. for $o in distinctvalues(doc("shiporderdb.xml")/shiporderdb/shiporder[shipto/co untry = "Greece"]/orderperson) return <result> {$o} { for $s in doc("shiporderdb.xml")/shiporderdb/shiporder where $s/child::orderperson = $o return $s/item} </result>

d) (5 μονάδες) Find all «shiporder» elements that contain an «item» element that both has Data in its subelement «title» and has a «price» element with value higher than 50 euros. Επιστρέψτε όλα τα στοιχεία shiporder τα οποία περιέχουν ένα στοιχείο item το οποίο έχει την λέξη Data στο υπο-στοιχείο του title, και αξία ( price ) μεγαλύτερη από 50 euros. for $i1 in doc( ShiporderDB.xml )/shiporderdb/shiporder/item [contains(title, Data )] [price > 50.0] Άσκηση 3 (20 μονάδες) Για το δένδρο Τ το οποίο φαίνεται στην εικόνα, επιστρέψτε το αποτέλεσμα των παρακάτω εκφράσεων XPath χρησιμοποιώντας τον αριθμό κάθε κόμβου. For the tree T on the right, write numbers of nodes selected by the following XPath expressions. a) //a 1,4,5,8,9 b) /*//*//a[preceding::a] c) //*[.//d] 8,9 1,2,4 d) /*[not(a and b)]

1 e) //*[count(.//*)=count(ancestor::*)] 4 f) //c[position() = last()] - g) /descendant:*[position() mod 2 = count(.//*)] 6,8 h) //*[count(*)>1 and not(child::*[not(self::a)])] 7 i) //*[preceding-sibling::b] 4,7 Άσκηση 4 (34 μονάδες) a) (8 μονάδες) Επιστέψτε τον PRE/POST πίνακα για το παρακάτω δένδρο. Give the PRE/POST table for the tree <a> <b> <c/> </b> <c> <d/> <d> <b/> <d/> </d> </c> <d/> <b> <c>

</a> </b> </c> <b/> <b/> <d/> Pre Post Label 1 14 a 2 2 b 3 1 c 4 7 c 5 3 d 6 6 d 7 4 b 8 5 d 9 8 d 10 13 b 11 11 c 12 9 b 13 10 d 14 12 b b) (10 μονάδες) Δώστε τον ψευδοκώδικα του αλγορίθμου ο οποίος υπολογίζει την διάταξη POST ενός δένδρου με έναν επαναληπτικό τρόπο (iteratively), δηλαδή χωρίς αναδρομικές κλήσεις. Μπορείτε να χρησιμοποιήσετε τις συναρτήσεις firstchild(n),nextsibling(n), και parent(n) για ένα κόμβο n. Give pseudo code that computes the POST order of a tree in an iterative way, i.e., without any recursive calls(!). You can use firstchild(n),nextsibling(n), and parent(n) for a node n. int i=1; Node n=root; repeat{ while(firstchild(n)!=null) n=firstchild(n); post(i)=n; i++; while(nextsibling(n)==nil){ n=parent(n); if(n==null) break; post(i)=n; i++; }

n=nextsibling(n); } Χρησιμοποιώντας τις διατάξεις PRE/POST για τους κόμβους ενός δένδρου εξηγήστε πως μπορούμε να βρούμε: Using the PRE/POST-encoding, explain how to obtain c) (4 μονάδες) τους προγόνους ενός κόμβου the ancestors of a node Given (pre, post) of a node, its ancestors are all nodes with pre-value < pre and post-value > post. d) (4 μονάδες) το τελευταίο παιδί ενός κόμβου the last child of a node If there is a node with pre-value > pre and with post-value=post-1, then that is the last child of (pre, post) e) (8 μονάδες) το μέγιστο βάθος του υποδένδρου ενός κόμβου the maximal depth of the subtree at a node. int maxdepth(int pr){ size(int p): int{ int s=0; for(int pr2=p+1; post(pr2)<post(p); pr2++) s++ return s; } int D=0; int u,l; L=pr+size(pr)-post(pr); for(int pr2=pr+1; post(pr2)<post(pr); pr2++){ u=pr2+size(pr2)-post(pr2)-l; if(u>d) D=u; return D; } Άσκηση 5(30 μονάδες) Δεδομένου του πίνακα PRE/POST/SIZE, γράψτε τις SQL επερωτήσεις οι οποίες υπολογίζουν τα αποτελέσματα των παρακάτων XPath επερωτήσεων.

Σημειώστε την εξίσωση level(n) = pre(n) post(n)+size(n), όπου size(n) είναι ο αριθμός των απογόνων του n συμπεριλαμβανομένου του n. Θεωρείστε ότι η ρίζα του XML δέντρου έχει preorder ίσο με 0. Given a PRE/POST/SIZE table, show SQL queries for the XPath queries Recall: level(n) = pre(n) post(n)+size(n), where n denotes the number of the descendents of n, including n. Consider that the root element of the XML tree has preorder equal to 0. a) (4 μονάδες) /* SELECT DISTINCT r1.pre FROM doc_tbl r1 WHERE r1.pre=1 ORDERED BY r1.pr b) (8 μονάδες) /a/b/* SELECT DISTINCT r4.pre FROM doc_tbl r1, r2, r3, r4 WHERE r1.pre=0 AND r2.pre>r1.pre AND r2.post<r1.post AND (r2.pre-r2.post+r2.size)=(r1.pre-r1.post+r1.size)+1 AND r2.tag= a AND r3.pre>r2.pre AND r3.post<r2.post AND (r3.pre-r3.post+r3.size)=(r2.pre-r2.post+r2.size)+1 AND r3.tag= b AND r4.pre>r3.pre AND r4.post<r3.post AND (r4.pre-r4.post+r4.size)=(r3.pre-r3.post+r3.size)+1 ORDERED BY r4.pre c) (8 μονάδες) //a/*//b SELECT DISTINCT r4.pre FROM doc_tbl r1, r2, r3, r4 WHERE r1.pre=0 AND r2.pre>r1.pre AND r2.post<r1.post AND r2.tag= a AND r3.pre>r2.pre AND r3.post<r2.post AND (r3.pre-r3.post+r3.size)=(r2.pre-r2.post+r2.size)+1 AND r4.pre>r3.pre AND r4.post<r3.post AND r4.tag= b ORDERED BY r4.pre d) (10 μονάδες) //a/following-sibling::b

SELECT DISTINCT r4.pre FROM doc_tbl r1, r2, r3, r4 WHERE r1.pre=0 AND r2.pre>r1.pre AND r2.post<r1.post AND r2.tag= a // parent of a-node AND r3.pre<r2.pre AND r3.post>r2.post AND (r3.pre-r3.post+r3.size)=(r2.pre-r2.post+r2.size)-1 // after a-node AND r4.pre>r2.pre // before parent AND r4.post<r3.post // same level as a-node AND (r4.pre-r4.post+r4.size)=(r2.pre-r2.post+r2.size) AND r4.tag= b ORDERED BY r4.pre