<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://binding-time.co.uk/index.php?action=history&amp;feed=atom&amp;title=XML_Query_Use_Cases_with_xml.pl</id>
	<title>XML Query Use Cases with xml.pl - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://binding-time.co.uk/index.php?action=history&amp;feed=atom&amp;title=XML_Query_Use_Cases_with_xml.pl"/>
	<link rel="alternate" type="text/html" href="https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;action=history"/>
	<updated>2026-08-27T01:24:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.4</generator>
	<entry>
		<id>https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=253&amp;oldid=prev</id>
		<title>John: /* XMP link updated to https */</title>
		<link rel="alternate" type="text/html" href="https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=253&amp;oldid=prev"/>
		<updated>2022-08-01T19:11:09Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;XMP link updated to https&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:11, 1 August 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l7&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====test( +QueryId )====&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====test( +QueryId )====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;lt;code&amp;gt;test/1&amp;lt;/code&amp;gt; predicate is the entry-point of the program and  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;lt;code&amp;gt;test/1&amp;lt;/code&amp;gt; predicate is the entry-point of the program and  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;executes a Prolog implementation of a Query from [&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;http&lt;/del&gt;://www.w3.org/TR/xquery-use-cases/#xmp Use Case &amp;amp;ldquo;XMP&amp;amp;rdquo;: Experiences and Exemplars], in the W3C&#039;s XML Query Use Cases, which &amp;amp;ldquo;contains several example queries that illustrate requirements gathered from the database and document communities&amp;amp;rdquo;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;executes a Prolog implementation of a Query from [&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;https&lt;/ins&gt;://www.w3.org/TR/xquery-use-cases/#xmp Use Case &amp;amp;ldquo;XMP&amp;amp;rdquo;: Experiences and Exemplars], in the W3C&#039;s XML Query Use Cases, which &amp;amp;ldquo;contains several example queries that illustrate requirements gathered from the database and document communities&amp;amp;rdquo;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;var&amp;gt;QueryId&amp;lt;/var&amp;gt; is one of &amp;lt;code&amp;gt;q1&amp;lt;/code&amp;gt;...&amp;lt;code&amp;gt;q12&amp;lt;/code&amp;gt; selecting which of the 12 use cases is executed.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;var&amp;gt;QueryId&amp;lt;/var&amp;gt; is one of &amp;lt;code&amp;gt;q1&amp;lt;/code&amp;gt;...&amp;lt;code&amp;gt;q12&amp;lt;/code&amp;gt; selecting which of the 12 use cases is executed.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>John</name></author>
	</entry>
	<entry>
		<id>https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=203&amp;oldid=prev</id>
		<title>John: /* input_document( +File, ?XML ) */</title>
		<link rel="alternate" type="text/html" href="https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=203&amp;oldid=prev"/>
		<updated>2018-01-13T20:31:09Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;input_document( +File, ?XML )&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:31, 13 January 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>John</name></author>
	</entry>
	<entry>
		<id>https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=179&amp;oldid=prev</id>
		<title>John: Remove broken syntax highlighting</title>
		<link rel="alternate" type="text/html" href="https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=179&amp;oldid=prev"/>
		<updated>2017-01-05T23:01:06Z</updated>

		<summary type="html">&lt;p&gt;Remove broken syntax highlighting&lt;/p&gt;
&lt;a href=&quot;https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;amp;diff=179&amp;amp;oldid=122&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>John</name></author>
	</entry>
	<entry>
		<id>https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=122&amp;oldid=prev</id>
		<title>John at 16:01, 14 June 2015</title>
		<link rel="alternate" type="text/html" href="https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=122&amp;oldid=prev"/>
		<updated>2015-06-14T16:01:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:01, 14 June 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following is a complete example to illustrate how the xml.pl module can be used.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following is a complete example to illustrate how the xml.pl module can be used.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It exercises both the input and output parsing modes of &amp;lt;code&amp;gt;xml_parse/[2,3]&amp;lt;/code&amp;gt;, and illustrates&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It exercises both the input and output parsing modes of &amp;lt;code&amp;gt;xml_parse/[2,3]&amp;lt;/code&amp;gt;, and illustrates&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;the use of &amp;lt;code&amp;gt;xml_subterm/2&amp;lt;/code&amp;gt; to access the nodes of a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;document value model&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;the use of &amp;lt;code&amp;gt;xml_subterm/2&amp;lt;/code&amp;gt; to access the nodes of a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;document value model&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo;&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It&amp;#039;s written for Quintus Prolog, but should port to other Prologs easily.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It&amp;#039;s written for Quintus Prolog, but should port to other Prologs easily.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====test( +QueryId )====&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====test( +QueryId )====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;lt;code&amp;gt;test/1&amp;lt;/code&amp;gt; predicate is the entry-point of the program and  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;lt;code&amp;gt;test/1&amp;lt;/code&amp;gt; predicate is the entry-point of the program and  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;executes a Prolog implementation of a Query from [http://www.w3.org/TR/xquery-use-cases/#xmp Use Case &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;XMP&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;: Experiences and Exemplars], in the W3C&#039;s XML Query Use Cases, which &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;contains several example queries that illustrate requirements gathered from the database and document communities&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;executes a Prolog implementation of a Query from [http://www.w3.org/TR/xquery-use-cases/#xmp Use Case &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;XMP&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo;&lt;/ins&gt;: Experiences and Exemplars], in the W3C&#039;s XML Query Use Cases, which &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;contains several example queries that illustrate requirements gathered from the database and document communities&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo;&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;var&amp;gt;QueryId&amp;lt;/var&amp;gt; is one of &amp;lt;code&amp;gt;q1&amp;lt;/code&amp;gt;...&amp;lt;code&amp;gt;q12&amp;lt;/code&amp;gt; selecting which of the 12 use cases is executed.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;var&amp;gt;QueryId&amp;lt;/var&amp;gt; is one of &amp;lt;code&amp;gt;q1&amp;lt;/code&amp;gt;...&amp;lt;code&amp;gt;q12&amp;lt;/code&amp;gt; selecting which of the 12 use cases is executed.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The XML output is written to the file [QueryId].xml in the current directory.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The XML output is written to the file [QueryId].xml in the current directory.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;xml_pp/1&amp;lt;/code&amp;gt; is used to display the resulting &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;document value model&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/del&gt;data-structures on the user output (stdout) stream.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;xml_pp/1&amp;lt;/code&amp;gt; is used to display the resulting &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;document value model&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo; &lt;/ins&gt;data-structures on the user output (stdout) stream.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;test( Query ) :-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;test( Query ) :-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     xml_query( Query, ResultElement ),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     xml_query( Query, ResultElement ),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l27&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====xml_query( +QueryNo, ?OutputXML )====&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====xml_query( +QueryNo, ?OutputXML )====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;when &amp;lt;var&amp;gt;OutputXML&amp;lt;/var&amp;gt; is an XML Document Value Model produced by running an example, identified by &amp;lt;var&amp;gt;QueryNo&amp;lt;/var&amp;gt;, taken from the XML Query &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;XMP&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/del&gt;use case.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;when &amp;lt;var&amp;gt;OutputXML&amp;lt;/var&amp;gt; is an XML Document Value Model produced by running an example, identified by &amp;lt;var&amp;gt;QueryNo&amp;lt;/var&amp;gt;, taken from the XML Query &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;XMP&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo; &lt;/ins&gt;use case.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q1===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q1===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l52&quot;&gt;Line 52:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 52:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q2===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q2===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Create a flat list of all the title-author pairs, with each pair enclosed in a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;result&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/del&gt;element.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Create a flat list of all the title-author pairs, with each pair enclosed in a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;result&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo; &lt;/ins&gt;element.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q2, element(results, [], Results) ) :-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q2, element(results, [], Results) ) :-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l69&quot;&gt;Line 69:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 69:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q3===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q3===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For each book in the bibliography, list the title and authors, grouped inside a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;result&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/del&gt;element.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For each book in the bibliography, list the title and authors, grouped inside a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;result&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo; &lt;/ins&gt;element.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q3, element(results, [], Results) ) :-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q3, element(results, [], Results) ) :-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l86&quot;&gt;Line 86:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 86:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q4===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q4===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For each author in the bibliography, list the author&#039;s name and the titles of all books by that author, grouped inside a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;result&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/del&gt;element.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For each author in the bibliography, list the author&#039;s name and the titles of all books by that author, grouped inside a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;result&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo; &lt;/ins&gt;element.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q4, element(results, [], Results) ) :-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q4, element(results, [], Results) ) :-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l135&quot;&gt;Line 135:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 135:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q6===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q6===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For each book that has at least one author, list the title and first two authors, and an empty &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;et-al&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/del&gt;element if the book has additional authors.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For each book that has at least one author, list the title and first two authors, and an empty &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;et-al&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo; &lt;/ins&gt;element if the book has additional authors.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q6, element(bib, [], Results) ) :-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q6, element(bib, [], Results) ) :-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l176&quot;&gt;Line 176:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 176:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q8===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q8===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Find books in which the name of some element ends with the string &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;or&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/del&gt;and the same element contains the string &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;Suciu&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/del&gt;somewhere in its content. For each such book, return the title and the qualifying element.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Find books in which the name of some element ends with the string &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;or&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo; &lt;/ins&gt;and the same element contains the string &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;Suciu&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo; &lt;/ins&gt;somewhere in its content. For each such book, return the title and the qualifying element.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q8, element(bib, [], Books) ) :-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q8, element(bib, [], Books) ) :-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l199&quot;&gt;Line 199:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 199:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q9===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q9===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the document &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;books.xml&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;, find all section or chapter titles that contain the word &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;XML&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;, regardless of the level of nesting.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the document &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;books.xml&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo;&lt;/ins&gt;, find all section or chapter titles that contain the word &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;XML&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo;&lt;/ins&gt;, regardless of the level of nesting.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q9, element(results, [], Titles) ) :-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q9, element(results, [], Titles) ) :-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l216&quot;&gt;Line 216:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 216:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q10===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Q10===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the document &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;prices.xml&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;, find the minimum price for each book, in the form of a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;minprice&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/del&gt;element with the book title as its title attribute.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the document &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;prices.xml&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo;&lt;/ins&gt;, find the minimum price for each book, in the form of a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;minprice&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo; &lt;/ins&gt;element with the book title as its title attribute.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q10, element(results, [], MinPrices) ) :-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q10, element(results, [], MinPrices) ) :-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     element_name( Title, title ),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l334&quot;&gt;Line 334:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 334:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     minimum1( T, Min1, Min ).&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     minimum1( T, Min1, Min ).&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====input_document( +File, ?XML )====&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====input_document( +File, ?XML )====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;reads &amp;lt;var&amp;gt;File&amp;lt;/var&amp;gt; and parses the input into the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/del&gt;Document Value Model&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/del&gt;&amp;lt;var&amp;gt;XML&amp;lt;/var&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;reads &amp;lt;var&amp;gt;File&amp;lt;/var&amp;gt; and parses the input into the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;ldquo;&lt;/ins&gt;Document Value Model&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;rdquo; &lt;/ins&gt;&amp;lt;var&amp;gt;XML&amp;lt;/var&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;input_document( File, XML ) :-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;input_document( File, XML ) :-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     % Read InputFile as a list of chars&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     % Read InputFile as a list of chars&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>John</name></author>
	</entry>
	<entry>
		<id>https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=86&amp;oldid=prev</id>
		<title>John at 18:32, 8 November 2014</title>
		<link rel="alternate" type="text/html" href="https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=86&amp;oldid=prev"/>
		<updated>2014-11-08T18:32:04Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:32, 8 November 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l4&quot;&gt;Line 4:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 4:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;the use of &amp;lt;code&amp;gt;xml_subterm/2&amp;lt;/code&amp;gt; to access the nodes of a &amp;quot;document value model&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;the use of &amp;lt;code&amp;gt;xml_subterm/2&amp;lt;/code&amp;gt; to access the nodes of a &amp;quot;document value model&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It&amp;#039;s written for Quintus Prolog, but should port to other Prologs easily.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It&amp;#039;s written for Quintus Prolog, but should port to other Prologs easily.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the &amp;lt;code&amp;gt;test/1&amp;lt;/code&amp;gt; predicate is the entry-point of the program.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====test( +QueryId )====&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====test( +QueryId )====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The &amp;lt;code&amp;gt;test/1&amp;lt;/code&amp;gt; predicate is the entry-point of the program and &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;executes a Prolog implementation of a Query from [http://www.w3.org/TR/xquery-use-cases/#xmp Use Case &amp;quot;XMP&amp;quot;: Experiences and Exemplars], in the W3C&amp;#039;s XML Query Use Cases, which &amp;quot;contains several example queries that illustrate requirements gathered from the database and document communities&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;executes a Prolog implementation of a Query from [http://www.w3.org/TR/xquery-use-cases/#xmp Use Case &amp;quot;XMP&amp;quot;: Experiences and Exemplars], in the W3C&amp;#039;s XML Query Use Cases, which &amp;quot;contains several example queries that illustrate requirements gathered from the database and document communities&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>John</name></author>
	</entry>
	<entry>
		<id>https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=75&amp;oldid=prev</id>
		<title>John: Created page with &quot;__NOTOC__ The following is a complete example to illustrate how the xml.pl module can be used. It exercises both the input and output parsing modes of &lt;code&gt;xml_parse/[2,3]&lt;/c...&quot;</title>
		<link rel="alternate" type="text/html" href="https://binding-time.co.uk/index.php?title=XML_Query_Use_Cases_with_xml.pl&amp;diff=75&amp;oldid=prev"/>
		<updated>2014-05-04T23:32:09Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ The following is a complete example to illustrate how the xml.pl module can be used. It exercises both the input and output parsing modes of &amp;lt;code&amp;gt;xml_parse/[2,3]&amp;lt;/c...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
The following is a complete example to illustrate how the xml.pl module can be used.&lt;br /&gt;
It exercises both the input and output parsing modes of &amp;lt;code&amp;gt;xml_parse/[2,3]&amp;lt;/code&amp;gt;, and illustrates&lt;br /&gt;
the use of &amp;lt;code&amp;gt;xml_subterm/2&amp;lt;/code&amp;gt; to access the nodes of a &amp;quot;document value model&amp;quot;.&lt;br /&gt;
It&amp;#039;s written for Quintus Prolog, but should port to other Prologs easily.&lt;br /&gt;
the &amp;lt;code&amp;gt;test/1&amp;lt;/code&amp;gt; predicate is the entry-point of the program.&lt;br /&gt;
====test( +QueryId )====&lt;br /&gt;
executes a Prolog implementation of a Query from [http://www.w3.org/TR/xquery-use-cases/#xmp Use Case &amp;quot;XMP&amp;quot;: Experiences and Exemplars], in the W3C&amp;#039;s XML Query Use Cases, which &amp;quot;contains several example queries that illustrate requirements gathered from the database and document communities&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;var&amp;gt;QueryId&amp;lt;/var&amp;gt; is one of &amp;lt;code&amp;gt;q1&amp;lt;/code&amp;gt;...&amp;lt;code&amp;gt;q12&amp;lt;/code&amp;gt; selecting which of the 12 use cases is executed.&lt;br /&gt;
&lt;br /&gt;
The XML output is written to the file [QueryId].xml in the current directory.&lt;br /&gt;
&amp;lt;code&amp;gt;xml_pp/1&amp;lt;/code&amp;gt; is used to display the resulting &amp;quot;document value model&amp;quot; data-structures on the user output (stdout) stream.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;test( Query ) :-&lt;br /&gt;
    xml_query( Query, ResultElement ),&lt;br /&gt;
    % Parse output XML into the Output chars&lt;br /&gt;
    xml_parse( Output, xml([], [ResultElement]) ),&lt;br /&gt;
    absolute_file_name( Query, [extensions(xml)], OutputFile ),&lt;br /&gt;
    % Write OutputFile from the Output list of chars&lt;br /&gt;
    tell( OutputFile ),&lt;br /&gt;
    put_chars( Output ),&lt;br /&gt;
    told,&lt;br /&gt;
    % Pretty print OutputXML&lt;br /&gt;
    write( &amp;#039;Output XML&amp;#039; ), nl,&lt;br /&gt;
    xml_pp( xml([], [ResultElement]) ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====xml_query( +QueryNo, ?OutputXML )====&lt;br /&gt;
when &amp;lt;var&amp;gt;OutputXML&amp;lt;/var&amp;gt; is an XML Document Value Model produced by running an example, identified by &amp;lt;var&amp;gt;QueryNo&amp;lt;/var&amp;gt;, taken from the XML Query &amp;quot;XMP&amp;quot; use case.&lt;br /&gt;
&lt;br /&gt;
===Q1===&lt;br /&gt;
&lt;br /&gt;
List books published by Addison-Wesley after 1991, including their year and title.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q1, element(bib, [], Books) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    element_name( Publisher, publisher ),&lt;br /&gt;
    input_document( &amp;#039;bib.xml&amp;#039;, Bibliography ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(book, [year=Year], [Title]),&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Bibliography, element(book, Attributes, Content) ),&lt;br /&gt;
        xml_subterm( Content, Publisher ),&lt;br /&gt;
        xml_subterm( Publisher, Text ),&lt;br /&gt;
        text_value( Text, &amp;quot;Addison-Wesley&amp;quot; ),&lt;br /&gt;
        member( year=Year, Attributes ),&lt;br /&gt;
        number_codes( YearNo, Year ),&lt;br /&gt;
        YearNo &amp;gt; 1991,&lt;br /&gt;
        xml_subterm( Content, Title )&lt;br /&gt;
        ),&lt;br /&gt;
        Books&lt;br /&gt;
    ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q2===&lt;br /&gt;
&lt;br /&gt;
Create a flat list of all the title-author pairs, with each pair enclosed in a &amp;quot;result&amp;quot; element.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q2, element(results, [], Results) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    element_name( Author, author ),&lt;br /&gt;
    element_name( Book, book ),&lt;br /&gt;
    input_document( &amp;#039;bib.xml&amp;#039;, Bibliography ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(result, [], [Title,Author]),&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Bibliography, Book ),&lt;br /&gt;
        xml_subterm( Book, Title ),&lt;br /&gt;
        xml_subterm( Book, Author )&lt;br /&gt;
        ),&lt;br /&gt;
        Results&lt;br /&gt;
    ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q3===&lt;br /&gt;
&lt;br /&gt;
For each book in the bibliography, list the title and authors, grouped inside a &amp;quot;result&amp;quot; element.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q3, element(results, [], Results) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    element_name( Author, author ),&lt;br /&gt;
    element_name( Book, book ),&lt;br /&gt;
    input_document( &amp;#039;bib.xml&amp;#039;, Bibliography ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(result, [], [Title|Authors]),&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Bibliography, Book ),&lt;br /&gt;
        xml_subterm( Book, Title ),&lt;br /&gt;
        findall( Author, xml_subterm(Book, Author), Authors )&lt;br /&gt;
        ),&lt;br /&gt;
        Results&lt;br /&gt;
    ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q4===&lt;br /&gt;
&lt;br /&gt;
For each author in the bibliography, list the author&amp;#039;s name and the titles of all books by that author, grouped inside a &amp;quot;result&amp;quot; element.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q4, element(results, [], Results) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    element_name( Author, author ),&lt;br /&gt;
    element_name( Book, book ),&lt;br /&gt;
    input_document( &amp;#039;bib.xml&amp;#039;, Bibliography ),&lt;br /&gt;
    findall( Author, xml_subterm(Bibliography, Author), AuthorBag ),&lt;br /&gt;
    sort( AuthorBag, Authors ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(result, [], [Author|Titles]),&lt;br /&gt;
        (&lt;br /&gt;
        member( Author, Authors ),&lt;br /&gt;
        findall( Title, (&lt;br /&gt;
            xml_subterm( Bibliography, Book ),&lt;br /&gt;
            xml_subterm( Book, Author ),&lt;br /&gt;
            xml_subterm( Book, Title )&lt;br /&gt;
            ),&lt;br /&gt;
            Titles&lt;br /&gt;
            )&lt;br /&gt;
        ),&lt;br /&gt;
        Results&lt;br /&gt;
    ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q5===&lt;br /&gt;
&lt;br /&gt;
For each book found at both bn.com and amazon.com, list the title of the book and its price from each source.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q5, element(&amp;#039;books-with-prices&amp;#039;, [], BooksWithPrices) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    element_name( Book, book ),&lt;br /&gt;
    element_name( Review, entry ),&lt;br /&gt;
    input_document( &amp;#039;bib.xml&amp;#039;, Bibliography ),&lt;br /&gt;
    input_document( &amp;#039;reviews.xml&amp;#039;, Reviews ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(&amp;#039;book-with-prices&amp;#039;, [], [&lt;br /&gt;
            Title,&lt;br /&gt;
            element(&amp;#039;price-bn&amp;#039;,[], BNPrice ),&lt;br /&gt;
            element(&amp;#039;price-amazon&amp;#039;,[], AmazonPrice )&lt;br /&gt;
            ] ),&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Bibliography, Book ),&lt;br /&gt;
        xml_subterm( Book, Title ),&lt;br /&gt;
        xml_subterm( Reviews, Review ),&lt;br /&gt;
        xml_subterm( Review, Title ),&lt;br /&gt;
        xml_subterm( Book, element(price,_, BNPrice) ),&lt;br /&gt;
        xml_subterm( Review, element(price,_, AmazonPrice) )&lt;br /&gt;
        ),&lt;br /&gt;
        BooksWithPrices&lt;br /&gt;
    ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q6===&lt;br /&gt;
&lt;br /&gt;
For each book that has at least one author, list the title and first two authors, and an empty &amp;quot;et-al&amp;quot; element if the book has additional authors.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q6, element(bib, [], Results) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    element_name( Author, author ),&lt;br /&gt;
    element_name( Book, book ),&lt;br /&gt;
    input_document( &amp;#039;bib.xml&amp;#039;, Bibliography ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(book, [], [Title,FirstAuthor|Authors]),&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Bibliography, Book ),&lt;br /&gt;
        xml_subterm( Book, Title ),&lt;br /&gt;
        findall( Author, xml_subterm(Book, Author), [FirstAuthor|Others] ),&lt;br /&gt;
        other_authors( Others, Authors )&lt;br /&gt;
        ),&lt;br /&gt;
        Results&lt;br /&gt;
    ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q7===&lt;br /&gt;
&lt;br /&gt;
List the titles and years of all books published by Addison-Wesley after 1991, in alphabetic order.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q7, element(bib, [], Books) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    element_name( Publisher, publisher ),&lt;br /&gt;
    input_document( &amp;#039;bib.xml&amp;#039;, Bibliography ),&lt;br /&gt;
    findall(&lt;br /&gt;
        Title-element(book, [year=Year], [Title]),&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Bibliography, element(book, Attributes, Book) ),&lt;br /&gt;
        xml_subterm( Book, Publisher ),&lt;br /&gt;
        xml_subterm( Publisher, Text ),&lt;br /&gt;
        text_value( Text, &amp;quot;Addison-Wesley&amp;quot; ),&lt;br /&gt;
        member( year=Year, Attributes ),&lt;br /&gt;
        number_codes( YearNo, Year ),&lt;br /&gt;
        YearNo &amp;gt; 1991,&lt;br /&gt;
        xml_subterm( Book, Title )&lt;br /&gt;
        ),&lt;br /&gt;
        TitleBooks&lt;br /&gt;
    ),&lt;br /&gt;
    keysort( TitleBooks, TitleBookSet ),&lt;br /&gt;
    range( TitleBookSet, Books ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q8===&lt;br /&gt;
&lt;br /&gt;
Find books in which the name of some element ends with the string &amp;quot;or&amp;quot; and the same element contains the string &amp;quot;Suciu&amp;quot; somewhere in its content. For each such book, return the title and the qualifying element.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q8, element(bib, [], Books) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    element_name( Book, book ),&lt;br /&gt;
    element_name( QualifyingElement, QualifyingName ),&lt;br /&gt;
    append( &amp;quot;Suciu&amp;quot;, _Back, Suffix ),&lt;br /&gt;
    input_document( &amp;#039;bib.xml&amp;#039;, Bibliography ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(book, [], [Title,QualifyingElement]),&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Bibliography, Book ),&lt;br /&gt;
        xml_subterm( Book, QualifyingElement ),&lt;br /&gt;
        atom_codes( QualifyingName, QNChars ),&lt;br /&gt;
        append( _QNPrefix, &amp;quot;or&amp;quot;, QNChars ),&lt;br /&gt;
        xml_subterm( QualifyingElement, TextItem ),&lt;br /&gt;
        text_value( TextItem, TextValue ),&lt;br /&gt;
        append( _Prefix, Suffix, TextValue ),&lt;br /&gt;
        xml_subterm( Book, Title )&lt;br /&gt;
        ),&lt;br /&gt;
        Books&lt;br /&gt;
    ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q9===&lt;br /&gt;
&lt;br /&gt;
In the document &amp;quot;books.xml&amp;quot;, find all section or chapter titles that contain the word &amp;quot;XML&amp;quot;, regardless of the level of nesting.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q9, element(results, [], Titles) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    append( &amp;quot;XML&amp;quot;, _Back, Suffix ),&lt;br /&gt;
    input_document( &amp;#039;books.xml&amp;#039;, Books ),&lt;br /&gt;
    findall(&lt;br /&gt;
        Title,&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Books, Title ),&lt;br /&gt;
        xml_subterm( Title, TextItem ),&lt;br /&gt;
        text_value( TextItem, TextValue ),&lt;br /&gt;
        append( _Prefix, Suffix, TextValue )&lt;br /&gt;
        ),&lt;br /&gt;
        Titles&lt;br /&gt;
    ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q10===&lt;br /&gt;
&lt;br /&gt;
In the document &amp;quot;prices.xml&amp;quot;, find the minimum price for each book, in the form of a &amp;quot;minprice&amp;quot; element with the book title as its title attribute.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q10, element(results, [], MinPrices) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    element_name( Price, price ),&lt;br /&gt;
    input_document( &amp;#039;prices.xml&amp;#039;, Prices ),&lt;br /&gt;
    findall( Title, xml_subterm(Prices, Title), TitleBag ),&lt;br /&gt;
    sort( TitleBag, TitleSet ),&lt;br /&gt;
    element_name( Book, book ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(minprice, [title=TitleString], [MinPrice]),&lt;br /&gt;
        (&lt;br /&gt;
        member( Title, TitleSet ),&lt;br /&gt;
        xml_subterm( Title, TitleText ),&lt;br /&gt;
        text_value( TitleText, TitleString ),&lt;br /&gt;
        findall( PriceValue-Price, (&lt;br /&gt;
            xml_subterm( Prices, Book ),&lt;br /&gt;
            xml_subterm( Book, Title ),&lt;br /&gt;
            xml_subterm( Book, Price ),&lt;br /&gt;
            xml_subterm( Price, Text ),&lt;br /&gt;
            text_value( Text, PriceChars ),&lt;br /&gt;
            number_codes( PriceValue, PriceChars )&lt;br /&gt;
            ),&lt;br /&gt;
            PriceValues&lt;br /&gt;
            ),&lt;br /&gt;
        minimum( PriceValues, PriceValue-MinPrice )&lt;br /&gt;
        ),&lt;br /&gt;
        MinPrices&lt;br /&gt;
    ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q11===&lt;br /&gt;
&lt;br /&gt;
For each book with an author, return the book with its title and authors. For each book with an editor, return a reference with the book title and the editor&amp;#039;s affiliation.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q11, element(bib, [], Results) ) :-&lt;br /&gt;
    element_name( Title, title ),&lt;br /&gt;
    element_name( Author, author ),&lt;br /&gt;
    element_name( Book, book ),&lt;br /&gt;
    element_name( Editor, editor ),&lt;br /&gt;
    element_name( Affiliation, affiliation ),&lt;br /&gt;
    input_document( &amp;#039;bib.xml&amp;#039;, Bibliography ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(book, [], [Title,FirstAuthor|Authors]),&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Bibliography, Book ),&lt;br /&gt;
        xml_subterm( Book, Title ),&lt;br /&gt;
        findall( Author, xml_subterm(Book, Author), [FirstAuthor|Authors] )&lt;br /&gt;
        ),&lt;br /&gt;
        Books&lt;br /&gt;
    ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(reference, [], [Title,Affiliation]),&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Bibliography, Book ),&lt;br /&gt;
        xml_subterm( Book, Title ),&lt;br /&gt;
        xml_subterm( Book, Editor ),&lt;br /&gt;
        xml_subterm( Editor, Affiliation )&lt;br /&gt;
        ),&lt;br /&gt;
        References&lt;br /&gt;
    ),&lt;br /&gt;
    append( Books, References, Results ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Q12===&lt;br /&gt;
&lt;br /&gt;
Find pairs of books that have different titles but the same set of authors (possibly in a different order).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;xml_query( q12, element(bib, [], Pairs) ) :-&lt;br /&gt;
    element_name( Author, author ),&lt;br /&gt;
    element_name( Book1, book ),&lt;br /&gt;
    element_name( Book2, book ),&lt;br /&gt;
    element_name( Title1, title ),&lt;br /&gt;
    element_name( Title2, title ),&lt;br /&gt;
    input_document( &amp;#039;bib.xml&amp;#039;, Bibliography ),&lt;br /&gt;
    findall(&lt;br /&gt;
        element(&amp;#039;book-pair&amp;#039;, [], [Title1,Title2]),&lt;br /&gt;
        (&lt;br /&gt;
        xml_subterm( Bibliography, Book1 ),&lt;br /&gt;
        findall( Author, xml_subterm(Book1, Author), AuthorBag1 ),&lt;br /&gt;
        sort( AuthorBag1, AuthorSet ),&lt;br /&gt;
        xml_subterm( Bibliography, Book2 ),&lt;br /&gt;
        Book2 @&amp;lt; Book1,&lt;br /&gt;
        findall( Author, xml_subterm(Book2, Author), AuthorBag2 ),&lt;br /&gt;
        sort( AuthorBag2, AuthorSet ),&lt;br /&gt;
        xml_subterm( Book1, Title1 ),&lt;br /&gt;
        xml_subterm( Book2, Title2 )&lt;br /&gt;
        ),&lt;br /&gt;
        Pairs&lt;br /&gt;
    ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Auxiliary Predicates ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;other_authors( [], [] ).&lt;br /&gt;
other_authors( [Author|Authors], [Author|EtAl] ) :-&lt;br /&gt;
    et_al( Authors, EtAl ).&lt;br /&gt;
&lt;br /&gt;
et_al( [], [] ).&lt;br /&gt;
et_al( [_|_], [element(&amp;#039;et-al&amp;#039;,[],[])] ).&lt;br /&gt;
&lt;br /&gt;
text_value( [pcdata(Text)], Text ).&lt;br /&gt;
text_value( [cdata(Text)], Text ).&lt;br /&gt;
&lt;br /&gt;
element_name( element(Name, _Attributes, _Content), Name ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====range( +Pairs, ?Range )====&lt;br /&gt;
when &amp;lt;var&amp;gt;Pairs&amp;lt;/var&amp;gt; is a list of key-datum pairs and &amp;lt;var&amp;gt;Range&amp;lt;/var&amp;gt; is the list of data.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;range( [], [] ).&lt;br /&gt;
range( [_Key-Datum|Pairs], [Datum|Data] ) :-&lt;br /&gt;
    range( Pairs, Data ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====minimum( +List, ?Min )====&lt;br /&gt;
is true if &amp;lt;var&amp;gt;Min&amp;lt;/var&amp;gt; is the least member of &amp;lt;var&amp;gt;List&amp;lt;/var&amp;gt; in the standard order.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;minimum( [H|T], Min ):-&lt;br /&gt;
    minimum1( T, H, Min ).&lt;br /&gt;
&lt;br /&gt;
minimum1( [], Min, Min ).&lt;br /&gt;
minimum1( [H|T], Min0, Min ) :-&lt;br /&gt;
    compare( Relation, H, Min0 ),&lt;br /&gt;
    minimum2( Relation, H, Min0, T, Min ).&lt;br /&gt;
&lt;br /&gt;
minimum2( &amp;#039;=&amp;#039;, Min0, Min0, T, Min ) :-&lt;br /&gt;
    minimum1( T, Min0, Min ).&lt;br /&gt;
minimum2( &amp;#039;&amp;lt;&amp;#039;, Min0, _Min1, T, Min ) :-&lt;br /&gt;
    minimum1( T, Min0, Min ).&lt;br /&gt;
minimum2( &amp;#039;&amp;gt;&amp;#039;, _Min0, Min1, T, Min ) :-&lt;br /&gt;
    minimum1( T, Min1, Min ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====input_document( +File, ?XML )====&lt;br /&gt;
reads &amp;lt;var&amp;gt;File&amp;lt;/var&amp;gt; and parses the input into the &amp;quot;Document Value Model&amp;quot; &amp;lt;var&amp;gt;XML&amp;lt;/var&amp;gt;.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;input_document( File, XML ) :-&lt;br /&gt;
    % Read InputFile as a list of chars&lt;br /&gt;
    see( File ),&lt;br /&gt;
    get_chars( Input ),&lt;br /&gt;
    seen,&lt;br /&gt;
    % Parse the Input chars into the term XML&lt;br /&gt;
    xml_parse( Input, XML ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Load the [[XML Module]].&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;:- use_module( xml ).&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Load a small library of [[Puzzle Utilities]].&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;prolog&amp;quot;&amp;gt;&lt;br /&gt;
:- ensure_loaded( misc ).&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a 5Kb tar.gz format [https://binding-time.co.uk/download/xml_example.tar.gz file containing this program with input and output data].&lt;/div&gt;</summary>
		<author><name>John</name></author>
	</entry>
</feed>