<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://qawiki.org/w/index.php?action=history&amp;feed=atom&amp;title=QAWiki%3AGuide%2FQueries</id>
	<title>QAWiki:Guide/Queries - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://qawiki.org/w/index.php?action=history&amp;feed=atom&amp;title=QAWiki%3AGuide%2FQueries"/>
	<link rel="alternate" type="text/html" href="https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;action=history"/>
	<updated>2026-05-01T10:21:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10058&amp;oldid=prev</id>
		<title>Aidan at 05:50, 6 December 2022</title>
		<link rel="alternate" type="text/html" href="https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10058&amp;oldid=prev"/>
		<updated>2022-12-06T05:50:05Z</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 05:50, 6 December 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-l5&quot;&gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&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 are some tips to ensure high-quality and more uniform queries.&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 are some tips to ensure high-quality and more uniform queries.&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;== Return what is asked for ==&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;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=&lt;/ins&gt;== Return what is asked for &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=&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;If the query asks for a count, you can simply return a number. If the query rather asks for an entity or a list of entities, return their IDs/URLs on Wikidata (applications can then decide what data about entities to return, such as labels, images, etc.). Return distinct results. Though it might be tempting to return more background, this can be done automatically, or otherwise, it can form a different question.&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;If the query asks for a count, you can simply return a number. If the query rather asks for an entity or a list of entities, return their IDs/URLs on Wikidata (applications can then decide what data about entities to return, such as labels, images, etc.). Return distinct results. Though it might be tempting to return more background, this can be done automatically, or otherwise, it can form a different question.&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;== Try to keep queries general / Use elemental entities ==&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;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=&lt;/ins&gt;== Try to keep queries general / Use elemental entities &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=&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;The best queries work for a wide selection of entities. For example, consider the query for the question &amp;quot;[[Item:Q68|&amp;#039;&amp;#039;Who is the president of Poland?&amp;#039;&amp;#039;]]&amp;quot;. One option would be to query for the value of the Wikidata property [https://www.wikidata.org/wiki/Property:P35 P35 (&amp;#039;&amp;#039;head of state&amp;#039;&amp;#039;)] for [https://www.wikidata.org/wiki/Q36 Poland], which will give us the correct answer. But if we swap Poland with the United Kingdom, we would get the answer of &amp;#039;&amp;#039;&amp;#039;Charles III&amp;#039;&amp;#039;&amp;#039; as the head of state of that country is a king, not a president. We could alternatively look for the value for [https://www.wikidata.org/wiki/Property:P1308 P1308 (&amp;#039;&amp;#039;officeholder&amp;#039;&amp;#039;)] on the [https://www.wikidata.org/wiki/Q1054799 President of the Republic of Poland], but this query is difficult to re-use for other entities due to the compound nature of this entity; rather we&amp;#039;d like to build the query from simpler, more elemental entities like [https://www.wikidata.org/wiki/Q30461 president] and [https://www.wikidata.org/wiki/Q36 Poland] that are more easily interchanged to generate new queries. Hence the most general form of the query looks for [https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fobj%20WHERE%20%7B%20%3Fsbj%20wdt%3AP31%2a%2Fwdt%3AP279%2a%20wd%3AQ30461%20.%20%3Fsbj%20wdt%3AP1001%20wd%3AQ36%20.%20%3Fsbj%20wdt%3AP1308%20%3Fobj%20%7D officeholders of positions that are instance or sub-class of president, and whose jurisdiction is Poland.] Though a bit more complex, this query avoids conflating monarchs with presidents, generalises to other positions such as ministers, and generalises also to other countries.&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 best queries work for a wide selection of entities. For example, consider the query for the question &amp;quot;[[Item:Q68|&amp;#039;&amp;#039;Who is the president of Poland?&amp;#039;&amp;#039;]]&amp;quot;. One option would be to query for the value of the Wikidata property [https://www.wikidata.org/wiki/Property:P35 P35 (&amp;#039;&amp;#039;head of state&amp;#039;&amp;#039;)] for [https://www.wikidata.org/wiki/Q36 Poland], which will give us the correct answer. But if we swap Poland with the United Kingdom, we would get the answer of &amp;#039;&amp;#039;&amp;#039;Charles III&amp;#039;&amp;#039;&amp;#039; as the head of state of that country is a king, not a president. We could alternatively look for the value for [https://www.wikidata.org/wiki/Property:P1308 P1308 (&amp;#039;&amp;#039;officeholder&amp;#039;&amp;#039;)] on the [https://www.wikidata.org/wiki/Q1054799 President of the Republic of Poland], but this query is difficult to re-use for other entities due to the compound nature of this entity; rather we&amp;#039;d like to build the query from simpler, more elemental entities like [https://www.wikidata.org/wiki/Q30461 president] and [https://www.wikidata.org/wiki/Q36 Poland] that are more easily interchanged to generate new queries. Hence the most general form of the query looks for [https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fobj%20WHERE%20%7B%20%3Fsbj%20wdt%3AP31%2a%2Fwdt%3AP279%2a%20wd%3AQ30461%20.%20%3Fsbj%20wdt%3AP1001%20wd%3AQ36%20.%20%3Fsbj%20wdt%3AP1308%20%3Fobj%20%7D officeholders of positions that are instance or sub-class of president, and whose jurisdiction is Poland.] Though a bit more complex, this query avoids conflating monarchs with presidents, generalises to other positions such as ministers, and generalises also to other countries.&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;== Write the best query possible (even if not perfect) ==&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;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=&lt;/ins&gt;== Write the best query possible (even if not perfect) &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=&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;Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&amp;#039;&amp;#039;issue&amp;#039;&amp;#039;)]], which can be used to indicate [https://tinyurl.com/2klcg89g a variety of such issues].&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;Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&amp;#039;&amp;#039;issue&amp;#039;&amp;#039;)]], which can be used to indicate [https://tinyurl.com/2klcg89g a variety of such issues].&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;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &amp;quot;[AUTO_LANGUAGE],en&amp;quot;. } } --&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;&amp;lt;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &amp;quot;[AUTO_LANGUAGE],en&amp;quot;. } } --&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-10057:rev-10058:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Aidan</name></author>
	</entry>
	<entry>
		<id>https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10057&amp;oldid=prev</id>
		<title>Aidan: /* Return only what is asked for */</title>
		<link rel="alternate" type="text/html" href="https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10057&amp;oldid=prev"/>
		<updated>2022-12-06T05:49:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Return only what is asked for&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 05:49, 6 December 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-l5&quot;&gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&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 are some tips to ensure high-quality and more uniform queries.&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 are some tips to ensure high-quality and more uniform queries.&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;== Return &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;only &lt;/del&gt;what is asked for ==&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;== Return what is asked for ==&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;If the query asks for a count, you can simply return a number. If the query rather asks for an entity or a list of entities, return their IDs/URLs on Wikidata (applications can then decide what data about entities to return, such as labels, images, etc.). Return distinct results. Though it might be tempting to return more background, this can be done automatically, or otherwise, it can form a different question.&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;If the query asks for a count, you can simply return a number. If the query rather asks for an entity or a list of entities, return their IDs/URLs on Wikidata (applications can then decide what data about entities to return, such as labels, images, etc.). Return distinct results. Though it might be tempting to return more background, this can be done automatically, or otherwise, it can form a different question.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-10053:rev-10057:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Aidan</name></author>
	</entry>
	<entry>
		<id>https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10053&amp;oldid=prev</id>
		<title>Aidan: /* Write the best query possible (even if not perfect) */</title>
		<link rel="alternate" type="text/html" href="https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10053&amp;oldid=prev"/>
		<updated>2022-12-06T05:43:28Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Write the best query possible (even if not perfect)&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 05:43, 6 December 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-l16&quot;&gt;Line 16:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 16:&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;Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&amp;#039;&amp;#039;issue&amp;#039;&amp;#039;)]], which can be used to indicate [https://tinyurl.com/2klcg89g a variety of such issues].&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;Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&amp;#039;&amp;#039;issue&amp;#039;&amp;#039;)]], which can be used to indicate [https://tinyurl.com/2klcg89g a variety of such issues].&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;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &quot;[AUTO_LANGUAGE],en&quot;. } } --&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Others might later work to improve on your query (if necessary).&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;&amp;lt;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &quot;[AUTO_LANGUAGE],en&quot;. } } --&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-10052:rev-10053:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Aidan</name></author>
	</entry>
	<entry>
		<id>https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10052&amp;oldid=prev</id>
		<title>Aidan: /* Write the best query possible (even if not perfect) */</title>
		<link rel="alternate" type="text/html" href="https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10052&amp;oldid=prev"/>
		<updated>2022-12-06T05:43:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Write the best query possible (even if not perfect)&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 05:43, 6 December 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-l16&quot;&gt;Line 16:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 16:&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;Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&amp;#039;&amp;#039;issue&amp;#039;&amp;#039;)]], which can be used to indicate [https://tinyurl.com/2klcg89g a variety of such issues].&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;Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&amp;#039;&amp;#039;issue&amp;#039;&amp;#039;)]], which can be used to indicate [https://tinyurl.com/2klcg89g a variety of such issues].&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;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &quot;[AUTO_LANGUAGE],en&quot;. } } --&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;&amp;lt;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &quot;[AUTO_LANGUAGE],en&quot;. } } --&amp;gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Others might later work to improve on your query (if necessary).&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-10051:rev-10052:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Aidan</name></author>
	</entry>
	<entry>
		<id>https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10051&amp;oldid=prev</id>
		<title>Aidan: /* Write the best query possible (even if not perfect) */</title>
		<link rel="alternate" type="text/html" href="https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10051&amp;oldid=prev"/>
		<updated>2022-12-06T05:42:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Write the best query possible (even if not perfect)&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 05:42, 6 December 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-l15&quot;&gt;Line 15:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 15:&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;== Write the best query possible (even if not perfect) ==&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;== Write the best query possible (even if not perfect) ==&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;Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&#039;&#039;issue&#039;&#039;)]], which can be used to indicate [https://tinyurl.com/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2fkxzw6b &lt;/del&gt;a variety of such issues].&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;Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&#039;&#039;issue&#039;&#039;)]], which can be used to indicate [https://tinyurl.com/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2klcg89g &lt;/ins&gt;a variety of such issues].&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;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &amp;quot;[AUTO_LANGUAGE],en&amp;quot;. } } --&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;&amp;lt;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &amp;quot;[AUTO_LANGUAGE],en&amp;quot;. } } --&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-10050:rev-10051:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Aidan</name></author>
	</entry>
	<entry>
		<id>https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10050&amp;oldid=prev</id>
		<title>Aidan: /* Write the best query possible */</title>
		<link rel="alternate" type="text/html" href="https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10050&amp;oldid=prev"/>
		<updated>2022-12-06T05:41:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Write the best query possible&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 05:41, 6 December 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-l13&quot;&gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&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 best queries work for a wide selection of entities. For example, consider the query for the question &amp;quot;[[Item:Q68|&amp;#039;&amp;#039;Who is the president of Poland?&amp;#039;&amp;#039;]]&amp;quot;. One option would be to query for the value of the Wikidata property [https://www.wikidata.org/wiki/Property:P35 P35 (&amp;#039;&amp;#039;head of state&amp;#039;&amp;#039;)] for [https://www.wikidata.org/wiki/Q36 Poland], which will give us the correct answer. But if we swap Poland with the United Kingdom, we would get the answer of &amp;#039;&amp;#039;&amp;#039;Charles III&amp;#039;&amp;#039;&amp;#039; as the head of state of that country is a king, not a president. We could alternatively look for the value for [https://www.wikidata.org/wiki/Property:P1308 P1308 (&amp;#039;&amp;#039;officeholder&amp;#039;&amp;#039;)] on the [https://www.wikidata.org/wiki/Q1054799 President of the Republic of Poland], but this query is difficult to re-use for other entities due to the compound nature of this entity; rather we&amp;#039;d like to build the query from simpler, more elemental entities like [https://www.wikidata.org/wiki/Q30461 president] and [https://www.wikidata.org/wiki/Q36 Poland] that are more easily interchanged to generate new queries. Hence the most general form of the query looks for [https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fobj%20WHERE%20%7B%20%3Fsbj%20wdt%3AP31%2a%2Fwdt%3AP279%2a%20wd%3AQ30461%20.%20%3Fsbj%20wdt%3AP1001%20wd%3AQ36%20.%20%3Fsbj%20wdt%3AP1308%20%3Fobj%20%7D officeholders of positions that are instance or sub-class of president, and whose jurisdiction is Poland.] Though a bit more complex, this query avoids conflating monarchs with presidents, generalises to other positions such as ministers, and generalises also to other countries.&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 best queries work for a wide selection of entities. For example, consider the query for the question &amp;quot;[[Item:Q68|&amp;#039;&amp;#039;Who is the president of Poland?&amp;#039;&amp;#039;]]&amp;quot;. One option would be to query for the value of the Wikidata property [https://www.wikidata.org/wiki/Property:P35 P35 (&amp;#039;&amp;#039;head of state&amp;#039;&amp;#039;)] for [https://www.wikidata.org/wiki/Q36 Poland], which will give us the correct answer. But if we swap Poland with the United Kingdom, we would get the answer of &amp;#039;&amp;#039;&amp;#039;Charles III&amp;#039;&amp;#039;&amp;#039; as the head of state of that country is a king, not a president. We could alternatively look for the value for [https://www.wikidata.org/wiki/Property:P1308 P1308 (&amp;#039;&amp;#039;officeholder&amp;#039;&amp;#039;)] on the [https://www.wikidata.org/wiki/Q1054799 President of the Republic of Poland], but this query is difficult to re-use for other entities due to the compound nature of this entity; rather we&amp;#039;d like to build the query from simpler, more elemental entities like [https://www.wikidata.org/wiki/Q30461 president] and [https://www.wikidata.org/wiki/Q36 Poland] that are more easily interchanged to generate new queries. Hence the most general form of the query looks for [https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fobj%20WHERE%20%7B%20%3Fsbj%20wdt%3AP31%2a%2Fwdt%3AP279%2a%20wd%3AQ30461%20.%20%3Fsbj%20wdt%3AP1001%20wd%3AQ36%20.%20%3Fsbj%20wdt%3AP1308%20%3Fobj%20%7D officeholders of positions that are instance or sub-class of president, and whose jurisdiction is Poland.] Though a bit more complex, this query avoids conflating monarchs with presidents, generalises to other positions such as ministers, and generalises also to other countries.&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;== Write the best query possible ==&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;== Write the best query possible &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(even if not perfect) &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;Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&amp;#039;&amp;#039;issue&amp;#039;&amp;#039;)]], which can be used to indicate [https://tinyurl.com/2fkxzw6b a variety of such issues].&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;Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&amp;#039;&amp;#039;issue&amp;#039;&amp;#039;)]], which can be used to indicate [https://tinyurl.com/2fkxzw6b a variety of such issues].&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;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &amp;quot;[AUTO_LANGUAGE],en&amp;quot;. } } --&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;&amp;lt;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &amp;quot;[AUTO_LANGUAGE],en&amp;quot;. } } --&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-10049:rev-10050:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Aidan</name></author>
	</entry>
	<entry>
		<id>https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10049&amp;oldid=prev</id>
		<title>Aidan: adding initial set of guidelines</title>
		<link rel="alternate" type="text/html" href="https://qawiki.org/w/index.php?title=QAWiki:Guide/Queries&amp;diff=10049&amp;oldid=prev"/>
		<updated>2022-12-06T05:41:41Z</updated>

		<summary type="html">&lt;p&gt;adding initial set of guidelines&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Guide to creating queries to answer questions ==&lt;br /&gt;
&lt;br /&gt;
The current focus is on generating SPARQL queries to answer questions over the [https://query.wikidata.org/ Wikidata Query Service]. You can write the query such that copying and pasting it into the service, it will generate the desired response; thus, for example, you can assume that Wikidata prefixes are defined, that features specific to the Wikidata Query Service are available, etc.&lt;br /&gt;
&lt;br /&gt;
The following are some tips to ensure high-quality and more uniform queries.&lt;br /&gt;
&lt;br /&gt;
== Return only what is asked for ==&lt;br /&gt;
&lt;br /&gt;
If the query asks for a count, you can simply return a number. If the query rather asks for an entity or a list of entities, return their IDs/URLs on Wikidata (applications can then decide what data about entities to return, such as labels, images, etc.). Return distinct results. Though it might be tempting to return more background, this can be done automatically, or otherwise, it can form a different question.&lt;br /&gt;
&lt;br /&gt;
== Try to keep queries general / Use elemental entities ==&lt;br /&gt;
&lt;br /&gt;
The best queries work for a wide selection of entities. For example, consider the query for the question &amp;quot;[[Item:Q68|&amp;#039;&amp;#039;Who is the president of Poland?&amp;#039;&amp;#039;]]&amp;quot;. One option would be to query for the value of the Wikidata property [https://www.wikidata.org/wiki/Property:P35 P35 (&amp;#039;&amp;#039;head of state&amp;#039;&amp;#039;)] for [https://www.wikidata.org/wiki/Q36 Poland], which will give us the correct answer. But if we swap Poland with the United Kingdom, we would get the answer of &amp;#039;&amp;#039;&amp;#039;Charles III&amp;#039;&amp;#039;&amp;#039; as the head of state of that country is a king, not a president. We could alternatively look for the value for [https://www.wikidata.org/wiki/Property:P1308 P1308 (&amp;#039;&amp;#039;officeholder&amp;#039;&amp;#039;)] on the [https://www.wikidata.org/wiki/Q1054799 President of the Republic of Poland], but this query is difficult to re-use for other entities due to the compound nature of this entity; rather we&amp;#039;d like to build the query from simpler, more elemental entities like [https://www.wikidata.org/wiki/Q30461 president] and [https://www.wikidata.org/wiki/Q36 Poland] that are more easily interchanged to generate new queries. Hence the most general form of the query looks for [https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fobj%20WHERE%20%7B%20%3Fsbj%20wdt%3AP31%2a%2Fwdt%3AP279%2a%20wd%3AQ30461%20.%20%3Fsbj%20wdt%3AP1001%20wd%3AQ36%20.%20%3Fsbj%20wdt%3AP1308%20%3Fobj%20%7D officeholders of positions that are instance or sub-class of president, and whose jurisdiction is Poland.] Though a bit more complex, this query avoids conflating monarchs with presidents, generalises to other positions such as ministers, and generalises also to other countries.&lt;br /&gt;
&lt;br /&gt;
== Write the best query possible ==&lt;br /&gt;
&lt;br /&gt;
Sometimes a query might provide incomplete results. Or if a query features negation, it might return incorrect results due to incomplete data. We recommend adding the query in any case, and hopefully when Wikidata becomes more complete/correct, the query will provide good results. For such cases, QAWiki also provides the qualifier/property [[Property:P36|P36 (&amp;#039;&amp;#039;issue&amp;#039;&amp;#039;)]], which can be used to indicate [https://tinyurl.com/2fkxzw6b a variety of such issues].&lt;br /&gt;
&amp;lt;!-- SELECT DISTINCT ?o ?oLabel WHERE { ?s wdt:P36|pq:P36 ?o . SERVICE wikibase:label { bd:serviceParam wikibase:language &amp;quot;[AUTO_LANGUAGE],en&amp;quot;. } } --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aidan</name></author>
	</entry>
</feed>