You are on page 1of 38

,


.


.



, .


:
y
y
y
y
y
y

),
(
),
(
).

,

:
y

(.. ),
y

(.. ).

:
y

.

.

y ,


,
-

.

:
y
,

.
y


,
.

:
y

,

10


:
y




.

,
. ,
.


.
y
.

.

11


:
y
,

,
.. (price) .
y
.. (address), ..
y ( )
( ..
).
y

12

Lorel
L
l

.
Lore

.
y


(edges) .
(label) .

Lorel SQL OQL


SELECT
FROM WHERE.

14

Lorel OQL
.


SELECT FROM WHERE.
WHERE

: 92310
select R
f
from
G id
Guide.restaurant
R
where exists A in R.address:
exists Z in A.zipcode : Z = 92310

15

XML
Lorel
XML
.
W3C (World Wide Web
Consortium) (http://www.w3c.org)
(http://www w3c org)
XML, :
y XPATH
y XQUERY

16

/
:

1992

1994

1997

1999

2007

RDBMS

OODBMS

SEMISTRUC
TURED

ORDBMS

XML

SQL2

OQL

LOREL

SQL3

XQUERY

17

Xpath W3C.

y Xquery Xpath

Xquery XPath.
XPath

19

XPath


XML .

()

.
,

/,




UNIX URLs.
:
y XML
y
Boolean
,
.

20

XPath XML
.
XPath , XML


(
(

):
)

1.
2.
3.
4.
5.
6.
7.

(root nodes),

(element
(
nodes),
)
(text nodes),
(attribute nodes),
(namespace nodes),
(processing instruction nodes)
(comment nodes).

21


XML .




.

. :
y (axis), ( )
y (node test)

(
::),
:: )
y (predicates).

22

y (abbreviated)



(unabbreviated)
(
bb i t d)

y

y
,
,
,
,
,
,
..

23


/.
:

y *, .

, ,

y node()
d () ,



, ,
, , .
y @
@*, .

| OR
.
.. -
// (context
)
)
node

24

Boolean
.
XP th



XPath

.

.

[]
[].
:
//person[@id=p1825]
id = p1825

25


. Xpath :
Child axis: .
Descendant axis:
.
.
Parent axis: ,
.
Ancestor axis:



.

.
g
g axis:

Following-sibling

( ).
Preceding-sibling axis:
.
.

26

Following axis:

,
.

Preceding axis:

,

Attribute axis: .
Namespace axis: .
Self axis: .
Descendant-or-self axis:
.
Ancestor-or-self axis:
.

27

ancestor::
following::

preceding::

self::

preceding-sibling::

f ll i
following-sibling::
ibli
descendant::

28

XPath :
y =, <, >, <=, >=, !=.


+ -, *, div,
div mod.
mod
y +,

and or,
y

//person[@born<=1920
p
[@
and @
@born>=1910].
]

,
y :

/people/person[@born>1950]/name[firstname=Alan]
(people),

(person)

(
)


1950
( born 1950),
(name) - firstname
Alan.

29

XPath
(location path expression).

(location
(l
ti path)
th)

XML
.


/
/






.


((attribute node))


@.

30

XPath
.

:
y (node set),
set)
y (numeric),
y (string),
y (Boolean).

31

:
y (string),
y (numeric)
(numeric),
y (Booleans),
y

((node node-sets).
)

32

XPath
if , then else.
:


f ( )
th
then

else

:
if ($part/@discounted)
$
then $part/wholesale
.

33


(existential universal
quantification)
quantification).
y true false.

some every Boolean


.
y :
some $
$
in
i

satisfies
ti fi

( every)

34

XML :
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<
<year>2005</year>
>2005</
>
<price>29.99</price>
</book>
</b k t >
</bookstore>
, ,
<bookstore>


b k t

<author> J K. Rowling</author>
lang="en" .

36

:
Nodename

/

//


.

..

@

//book
book

bookstore//book
book bookstore ,

bookstore
//@lang
lang

37

/bookstore/book[0]
[ ]
book
bookstore
/bookstore/book[position()<3]
book
bookstore
/bookstore/book[price>35 000]/title
/bookstore/book[price>35.000]/title
title book,
bookstore, price
35
35.000
000
//book/title | //book/price
title price book.
.

38

You might also like