<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wandora.org/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wandora.org/w/index.php?action=history&amp;feed=atom&amp;title=Complex_example_queries</id>
		<title>Complex example queries - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wandora.org/w/index.php?action=history&amp;feed=atom&amp;title=Complex_example_queries"/>
		<link rel="alternate" type="text/html" href="http://wandora.org/w/index.php?title=Complex_example_queries&amp;action=history"/>
		<updated>2026-04-18T12:47:35Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.1</generator>

	<entry>
		<id>http://wandora.org/w/index.php?title=Complex_example_queries&amp;diff=7913&amp;oldid=prev</id>
		<title>Olli at 13:14, 13 August 2010</title>
		<link rel="alternate" type="text/html" href="http://wandora.org/w/index.php?title=Complex_example_queries&amp;diff=7913&amp;oldid=prev"/>
				<updated>2010-08-13T13:14:05Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:14, 13 August 2010&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; 20&amp;#160; &amp;#160; &amp;#160; &amp;#160;  )&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; 20&amp;#160; &amp;#160; &amp;#160; &amp;#160;  )&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; 21&amp;#160; &amp;#160;  )&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; 21&amp;#160; &amp;#160;  )&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; 22 ).where(&amp;quot;#trackname&amp;quot;,&amp;quot;=&amp;quot;,&amp;quot;#queenname&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; 22 ).where&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(new Of&lt;/ins&gt;(&amp;quot;#trackname&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;)&lt;/ins&gt;,&amp;quot;=&amp;quot;,&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;new Of(&lt;/ins&gt;&amp;quot;#queenname&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;)&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; 23 .where(&amp;quot;#artist&amp;quot;,&amp;quot;t!=&amp;quot;,&amp;quot;#queen&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; 23 .where&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(new Of&lt;/ins&gt;(&amp;quot;#artist&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;)&lt;/ins&gt;,&amp;quot;t!=&amp;quot;,&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;new Of(&lt;/ins&gt;&amp;quot;#queen&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;)&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This query consists of two main parts which are joined with a ''Join'' query and then the relevant rows are selected with two ''where'' clauses.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This query consists of two main parts which are joined with a ''Join'' query and then the relevant rows are selected with two ''where'' clauses.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Olli</name></author>	</entry>

	<entry>
		<id>http://wandora.org/w/index.php?title=Complex_example_queries&amp;diff=6957&amp;oldid=prev</id>
		<title>Olli at 13:33, 24 August 2009</title>
		<link rel="alternate" type="text/html" href="http://wandora.org/w/index.php?title=Complex_example_queries&amp;diff=6957&amp;oldid=prev"/>
				<updated>2009-08-24T13:33:24Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page contains some more complex example queries (see [[Query language]]).&lt;br /&gt;
&lt;br /&gt;
== FreeDB - Queen cover songs ==&lt;br /&gt;
&lt;br /&gt;
This example is for the FreeDB sample project found in the samples folder. It finds songs that are covers of a Queen song or more specifically songs that have the same name as some Queen song.&lt;br /&gt;
&lt;br /&gt;
 1  importPackage(org.wandora.query2);&lt;br /&gt;
 2  new Join(&lt;br /&gt;
 3      new Players(&amp;quot;http://www.wandora.net/freedb/track&amp;quot;,&lt;br /&gt;
 4                  &amp;quot;http://www.wandora.net/freedb/artist&amp;quot;)&lt;br /&gt;
 5      .as(&amp;quot;#artist&amp;quot;).of(&amp;quot;#track&amp;quot;).from(&lt;br /&gt;
 6          new Regex(&amp;quot;^([^\\(]*).*$&amp;quot;,&amp;quot;$1&amp;quot;,0).as(&amp;quot;#trackname&amp;quot;).from(&lt;br /&gt;
 7              new BaseName().from(&lt;br /&gt;
 8                  new Instances().as(&amp;quot;#track&amp;quot;).from(&amp;quot;http://www.wandora.net/freedb/track&amp;quot;)&lt;br /&gt;
 9              )&lt;br /&gt;
 10         )&lt;br /&gt;
 11     ),&lt;br /&gt;
 12     new Regex(&amp;quot;^([^\\(]*).*$&amp;quot;,&amp;quot;$1&amp;quot;,0).as(&amp;quot;#queenname&amp;quot;).from(&lt;br /&gt;
 13         new BaseName().from(&lt;br /&gt;
 14             new Players(&lt;br /&gt;
 15                 &amp;quot;http://www.wandora.net/freedb/track&amp;quot;,&lt;br /&gt;
 16                 &amp;quot;http://www.wandora.net/freedb/track&amp;quot;&lt;br /&gt;
 17             ).as(&amp;quot;#queentrack&amp;quot;).from(&lt;br /&gt;
 18                 new Topics().as(&amp;quot;#queen&amp;quot;).from(&amp;quot;http://www.wandora.net/freedb/artist/QUEEN&amp;quot;)&lt;br /&gt;
 19             )&lt;br /&gt;
 20         )&lt;br /&gt;
 21     )&lt;br /&gt;
 22 ).where(&amp;quot;#trackname&amp;quot;,&amp;quot;=&amp;quot;,&amp;quot;#queenname&amp;quot;)&lt;br /&gt;
 23 .where(&amp;quot;#artist&amp;quot;,&amp;quot;t!=&amp;quot;,&amp;quot;#queen&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
This query consists of two main parts which are joined with a ''Join'' query and then the relevant rows are selected with two ''where'' clauses.&lt;br /&gt;
&lt;br /&gt;
The first part on lines 3 to 11 selects all tracks (line 8) their base names (line 7) then modifies the basename with a regular expression that removes the id number of the song from the base name (line 6). Finally artist of the track is selected (on lines 3 and 4).&lt;br /&gt;
&lt;br /&gt;
The other part does same thing but only for Queen tracks. It starts with the Queen topic which is also the artist (line 18). Then we get players of track associations, this selects all tracks of Queen (lines 14 to 16). Finally we get the base name (line 13) and modify it with the same regular expression as before (line 12).&lt;br /&gt;
&lt;br /&gt;
Joining these two parts gets us 6 columns, &amp;quot;#track&amp;quot;, &amp;quot;#trackname&amp;quot;, &amp;quot;#artist&amp;quot;, &amp;quot;#queen&amp;quot;, &amp;quot;#queentrack&amp;quot;, &amp;quot;#queenname&amp;quot;. The ''where'' clause on line 22 compares &amp;quot;#trackname&amp;quot; and &amp;quot;#queenname&amp;quot; and only selects rows where these are equal. The final ''where'' clause on line 23 checks that the &amp;quot;#artist&amp;quot; isn't actually queen. All Queen songs are of course selected in the first part of the join and would match the exact same songs on the other part of the join.&lt;/div&gt;</summary>
		<author><name>Olli</name></author>	</entry>

	</feed>