XML-QL Beispiele unter Anwendung von http://cheops.cis.upenn.edu/~adeutsch/xmlql-demo/html/

Beispiel-Dokumente

bookstore.xml
rekurs.xml
aerzte.xml
patienten.xml

construct <titel>$a</titel>
where <bookstore><book><title>$a</></></>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <titel>Trenton Today, Trenton Tomorrow</titel>
  <titel>Seven Years in Trenton</titel>
  <titel>History of Trenton</titel>
</XML>

construct <titel> $a </titel>
where <bookstore><magazine><title>$a</></></>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"

<?xml version="1.0"?>
<titel ID="out.genoid_0">
  <titel>Tracking Trenton</titel>
</titel>

construct <titel>$a</titel>
where <bookstore><*><title>$a</></></>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <titel>Trenton Today, Trenton Tomorrow</titel>
  <titel>Seven Years in Trenton</titel>
  <titel>History of Trenton</titel>
  <titel>Tracking Trenton</titel>
</XML>

construct <titel>$a</titel>
where <bookstore.(book|magazine).title>$a</>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <titel>Trenton Today, Trenton Tomorrow</titel>
  <titel>Seven Years in Trenton</titel>
  <titel>History of Trenton</titel>
  <titel>Tracking Trenton</titel>
</XML>

construct <titel>$a</titel><titel>$b</titel>
where 
<bookstore.book.title>$a</>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml",
<bookstore.magazine.title>$b</>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <titel>Trenton Today, Trenton Tomorrow</titel>
  <titel>Seven Years in Trenton</titel>
  <titel>History of Trenton</titel>
  <titel>Tracking Trenton</titel>
</XML>

construct <titel>$a</titel>
where <*.title>$a</>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <titel>Trenton Today, Trenton Tomorrow</titel>
  <titel>Seven Years in Trenton</titel>
  <titel>History of Trenton</titel>
  <titel>Tracking Trenton</titel>
</XML>

{
   construct <titel>$a</titel>
   where <bookstore><book><title>$a</></></>
   in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"
}
{
   construct <titel>$a</titel>
   where <bookstore><magazine><title>$a</></></>
   in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"
}

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <titel>Trenton Today, Trenton Tomorrow</titel>
  <titel>Seven Years in Trenton</titel>
  <titel>History of Trenton</titel>
  <titel>Tracking Trenton</titel>
</XML>

construct <autor>$a</autor>
where <bookstore><book><author>$a</></></>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <autor>
    <first-name>Joe</first-name>
    <last-name>Bob</last-name>
    <award>Trenton Literary Review Honorable Mention</award>
  </autor>
  <autor>
    <award>Pulizer</award>
    <last-name>Bob</last-name>
    <publication>Trenton Forever</publication>
    <degree>Ph.D.</degree>
    <degree>B.A.</degree>
    <first-name>Toni</first-name>
    <publication>Still in Trenton</publication>
  </autor>
  <autor>
    <publication>
        Selected Short Stories of
        <last-name>Bob</last-name>
      <first-name>Mary</first-name>
    </publication>
    <last-name>Bob</last-name>
    <first-name>Mary</first-name>
  </autor>
</XML>

construct <autor_detail>$a</autor_detail>
where <bookstore><book><author><*>$a</></></></>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <autor_detail>Joe</autor_detail>
  <autor_detail>Still in Trenton</autor_detail>
  <autor_detail>B.A.</autor_detail>
  <autor_detail>Mary</autor_detail>
  <autor_detail>Pulizer</autor_detail>
  <autor_detail>Ph.D.</autor_detail>
  <autor_detail>Trenton Forever</autor_detail>
  <autor_detail>Toni</autor_detail>
  <autor_detail>
    <award>Pulizer</award>
    <last-name>Bob</last-name>
    <publication>Trenton Forever</publication>
    <degree>Ph.D.</degree>
    <degree>B.A.</degree>
    <first-name>Toni</first-name>
    <publication>Still in Trenton</publication>
  </autor_detail>
  <autor_detail>
        Selected Short Stories of
        </autor_detail>
  <autor_detail>Bob</autor_detail>
  <autor_detail>
    <first-name>Joe</first-name>
    <last-name>Bob</last-name>
    <award>Trenton Literary Review Honorable Mention</award>
  </autor_detail>
  <autor_detail>
    <publication ID="bookstore.n11">
        Selected Short Stories of
        <last-name>Bob</last-name>
      <first-name>Mary</first-name>
    </publication>
    <last-name>Bob</last-name>
    <first-name>Mary</first-name>
  </autor_detail>
  <autor_detail IDREF="bookstore.n11"/>
  <autor_detail>Trenton Literary Review Honorable Mention</autor_detail>
</XML>

construct <buch>$a</buch>
where <bookstore><book style="novel">$a</></>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore.xml"

<?xml version="1.0"?>
<buch ID="out.genoid_0">
  <buch ID="bookstore.n20" style="novel" id="myfave">
    <price>6.50</price>
    <excerpt>
      <p> have.<emph>I</emph>But then all nights in Trenton seem dark and
      stormy to someone who has gone through what
      </p>
      <p>It was a dark and stormy night.</p>
      <definition-list>
        <term>Trenton</term>
        <definition>misery</definition>
      </definition-list>
    </excerpt>
    <author>
      <award>Pulizer</award>
      <last-name>Bob</last-name>
      <publication>Trenton Forever</publication>
      <degree>Ph.D.</degree>
      <degree>B.A.</degree>
      <first-name>Toni</first-name>
      <publication>Still in Trenton</publication>
    </author>
    <title>Trenton Today, Trenton Tomorrow</title>
  </buch>
</buch>

construct <autor>$a</autor><titel>$t</titel>
where <bookstore><book><author><first_name>$a</></><title>$t</></></>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore2.xml"

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <titel>Trenton Today, Trenton Tomorrow</titel>
  <autor>Toni</autor>
  <titel>Seven Years in Trenton</titel>
  <titel>History of Trenton</titel>
  <autor>Joe</autor>
  <autor>Mary</autor>
</XML>

construct <buch><autor>$a</autor><titel>$t</titel></buch>
where <bookstore><book><author><first_name>$a</></><title>$t</></></>
in "http://www.med.uni-giessen.de/akkk/xml/bookstore2.xml"

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <buch>
    <autor>Mary</autor>
    <titel>History of Trenton</titel>
  </buch>
  <buch>
    <titel>Trenton Today, Trenton Tomorrow</titel>
    <autor>Toni</autor>
  </buch>
  <buch>
    <titel>Seven Years in Trenton</titel>
    <autor>Joe</autor>
  </buch>
</XML>

construct <buch><autor>$a</autor>
  construct <titel>$t</titel> 
    where <title>$t</>
       in $p
</buch>
where <bookstore><book>$p</></>
  in "http://www.med.uni-giessen.de/akkk/xml/bookstore2.xml",
  <author><first_name>$a</></> in $p

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <buch>
    <autor>Mary</autor>
    <titel>History of Trenton</titel>
  </buch>
  <buch>
    <titel>Trenton Today, Trenton Tomorrow</titel>
    <autor>Toni</autor>
  </buch>
  <buch>
    <titel>Seven Years in Trenton</titel>
    <autor>Joe</autor>
  </buch>
</XML

construct <resultat>$s</resultat>
where <*.sohn>$s</>
in "http://www.med.uni-giessen.de/akkk/xml/rekurs.xml"

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <resultat>1
<sohn ID="sohn.n1">
      <sohn ID="sohn.n2">
        <sohn ID="sohn.n3">4
<sohn ID="sohn.n4">5
<sohn ID="sohn.n5">
              <sohn>7
</sohn>6
</sohn>
          </sohn>
        </sohn>3
</sohn>2
</sohn>
  </resultat>
  <resultat IDREF="sohn.n1"/>
  <resultat IDREF="sohn.n2"/>
  <resultat IDREF="sohn.n3"/>
  <resultat IDREF="sohn.n4"/>
  <resultat IDREF="sohn.n5"/>
  <resultat>7
</resultat>
</XML>

construct <titel>$t</titel>
where
 <bookstore>
   <magazine>
      <title>$t</>
      <author>
         <last_name>$l</>
     </>
   </>
 </> 
in "http://www.med.uni-giessen.de/akkk/xml/bookstore2.xml",
<bookstore>
   <book>
     <author>
        <last_name>$l</>
     </>
   </>
</> 
in "http://www.med.uni-giessen.de/akkk/xml/bookstore2.xml"

<?xml version="1.0"?>
<titel ID="out.genoid_0">
  <titel>Tracking Trenton</titel>
</titel>

construct <ap><arzt>$a</arzt>
   construct <patient>$p</patient>
   where
   <patienten.patient>$p</> 
   in "http://www.med.uni-giessen.de/akkk/xml/patienten.xml",
   <arzt_id>$i</> in $p
</ap>
where
<aerzte.arzt>$a</> in "http://www.med.uni-giessen.de/akkk/xml/aerzte.xml",
<arzt_id>$i</> in $a

<?xml version="1.0"?>
<XML ID="out.genoid_0">
  <ap>
    <arzt>
      <arzt_id>4</arzt_id>Schiller
	</arzt>
  </ap>
  <ap>
    <patient ID="patienten.n1">
      <arzt_id>1</arzt_id>
      <arzt_id>2</arzt_id>
      <arzt_id>3</arzt_id>Mueller
	</patient>
    <patient ID="patienten.n3">Meier
	<arzt_id>1</arzt_id>
      <arzt_id>2</arzt_id>
    </patient>
    <arzt IDREF="aerzte.n1"/>
  </ap>
  <ap>
    <patient ID="patienten.n2">Maier
	<arzt_id>2</arzt_id>
      <arzt_id>3</arzt_id>
    </patient>
    <patient IDREF="patienten.n3"/>
    <arzt IDREF="aerzte.n2"/>
    <patient IDREF="patienten.n1"/>
  </ap>
  <ap>
    <patient IDREF="patienten.n1"/>
    <patient IDREF="patienten.n2"/>
    <arzt IDREF="aerzte.n3"/>
  </ap>
</XML>