S
Sebastian Paral
Hi, i got an xml database like this:
<conferencemanager>
<person pid="p1"><name>Sebastian</name></person>
<person pid="p2"><name>Christian</name></person>
<person pid="p3"><name>Maria</name></person>
<person pid="p4"><name>Georg</name></person>
<person pid="p5"><name>Sabine</name></person>
<conference kid="k1">
<name>Conference Nr. 1</name>
<date>10.10.2005</date>
<location>Graz</location>
</conference>
<conference kid="k2">
<name>Conference Nr. 2</name>
<date>10.10.2005</date>
<location>Vienna</location>
</conference>
<conference kid="k3">
<name>Konferenz Nr. 3</name>
<date>10.10.2005</date>
<location>Vienna</location>
</conference>
<lecture vid="v1"><title>DBMS</title></lecture>
<lecture vid="v2"><title>Distributed Systems</title></lecture>
<lecture vid="v3"><title>Computer Science</title></lecture>
<attendance pid="p1" kid="k1" vid="v1" />
<attendance pid="p2" kid="k2" vid="v2" />
<attendance pid="p3" kid="k2" vid="v1" />
<attendance pid="p4" kid="k2" vid="v1" />
<attendance pid="p5" kid="k2" vid="v1" />
<attendance pid="p5" kid="k3" vid="v3" />
<attendance pid="p3" kid="k2" vid="v1" />
</conferencemanager>
my assignment is as follows:
find all names (person) which have ever seen (attendance) conferences
(conference) in "vienna" about the "DBMS" lecture. this query should be
created with xpath.
in xquery it would be:
for $p in /conferencemanager/person,
$k in /conferencemanager/conference,
$v in /conferencemanager/lecture,
$t in /conferencemanager/attendance
where $t/@pid = $p/@pid and $t/@kid = $k/@kid and $t/@vid = $v/@vid
and $v/title = "DBMS" and $k/location = "Vienna"
return string($p/name)
is there a possibility to create an equivalent query only with xpath?
thanks for any help!
regards
<conferencemanager>
<person pid="p1"><name>Sebastian</name></person>
<person pid="p2"><name>Christian</name></person>
<person pid="p3"><name>Maria</name></person>
<person pid="p4"><name>Georg</name></person>
<person pid="p5"><name>Sabine</name></person>
<conference kid="k1">
<name>Conference Nr. 1</name>
<date>10.10.2005</date>
<location>Graz</location>
</conference>
<conference kid="k2">
<name>Conference Nr. 2</name>
<date>10.10.2005</date>
<location>Vienna</location>
</conference>
<conference kid="k3">
<name>Konferenz Nr. 3</name>
<date>10.10.2005</date>
<location>Vienna</location>
</conference>
<lecture vid="v1"><title>DBMS</title></lecture>
<lecture vid="v2"><title>Distributed Systems</title></lecture>
<lecture vid="v3"><title>Computer Science</title></lecture>
<attendance pid="p1" kid="k1" vid="v1" />
<attendance pid="p2" kid="k2" vid="v2" />
<attendance pid="p3" kid="k2" vid="v1" />
<attendance pid="p4" kid="k2" vid="v1" />
<attendance pid="p5" kid="k2" vid="v1" />
<attendance pid="p5" kid="k3" vid="v3" />
<attendance pid="p3" kid="k2" vid="v1" />
</conferencemanager>
my assignment is as follows:
find all names (person) which have ever seen (attendance) conferences
(conference) in "vienna" about the "DBMS" lecture. this query should be
created with xpath.
in xquery it would be:
for $p in /conferencemanager/person,
$k in /conferencemanager/conference,
$v in /conferencemanager/lecture,
$t in /conferencemanager/attendance
where $t/@pid = $p/@pid and $t/@kid = $k/@kid and $t/@vid = $v/@vid
and $v/title = "DBMS" and $k/location = "Vienna"
return string($p/name)
is there a possibility to create an equivalent query only with xpath?
thanks for any help!
regards