Hi,

You can fix the query by replacing the following SPARQL statement:

?country wdt:P31 wd:Q6256.

...with the following 2 statements:

?country p:P31 ?countryStatement.
?countryStatement ps:P31 wd:Q6256.

As Nicolas mentions, the original "simple" triple in your query takes into account Wikidata statement rankings. So in order to ignore rankings, just use the roundabout way that goes directly through the RDF statements.

Another solution would be to also include sovereign state into your query. So replace the same SPARQL statement above with the following 2 statements:

VALUES ?countryish { wd:Q6256 wd:Q3624078 }
?country wdt:P31 ?countryish.

Regards,
Eugene


On Wed, May 8, 2019 at 4:54 AM Nicolas VIGNERON <vigneron.nicolas@gmail.com> wrote:
Hi,

This query only search for "country" (Q6256) but Italy, like many other items, has a preferred ranking on the value "sovereign state" (Q3624078), so by default, Italy doesn't appears as a country (which is strange but not totally illogical "country" is a quite broad term).

Cheers, ~nicolas

Le mar. 7 mai 2019 à 22:11, Fabrizio Carrai <fabrizio.carrai@gmail.com> a écrit :
Can anybody explain why Italy is not shown in the results of the "Wikidata Query Service" example "Continents, countries, regions and capitals" [1] ?
I suppose because Italy is belonging to two different continents (Europe and Africa). If this is the case I'm not able to fix the query.

Thanks

--
Fabrizio

[1] https://query.wikidata.org/#%23Continents%2C%20countries%2C%20regions%20and%20capitals%0A%23defaultView%3ATree%0ASELECT%20%3Fcontinent%20%3FcontinentFlag%20%3FcontinentLabel%20%3Fcountry%20%3FcountryLabel%20%3FcountryFlag%20%3Fregion%20%3FregionLabel%20%3FregionFlag%20%3Fcity%20%3FcityLabel%20%3FcityImage%20%3Fproperty%20%3FpropertyLabel%20%3Fvalue%20%3FvalueLabel%20WHERE%20%7B%0A%20%20%7B%0A%20%20%20%20SELECT%20%2a%20WHERE%20%7B%0A%20%20%20%20%20%20%3Fcontinent%20wdt%3AP31%20wd%3AQ5107.%0A%20%20%20%20%20%20%3Fcountry%20wdt%3AP30%20%3Fcontinent.%0A%20%20%20%20%20%20%3Fcountry%20wdt%3AP31%20wd%3AQ6256.%0A%20%20%20%20%20%20%3Fcountry%20wdt%3AP150%20%3Fregion.%0A%20%20%20%20%20%20OPTIONAL%20%7B%0A%20%20%20%20%20%20%20%20%3Fcontinent%20wdt%3AP242%20%3FcontinentFlag.%0A%20%20%20%20%20%20%20%20%3Fcountry%20wdt%3AP41%20%3FcountryFlag.%0A%20%20%20%20%20%20%20%20%3Fregion%20wdt%3AP41%20%3FregionFlag.%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20OPTIONAL%20%7B%0A%20%20%20%20%20%20%20%20%3Fregion%20wdt%3AP36%20%3Fcity.%0A%20%20%20%20%20%20%20%20%3Fcity%20wdt%3AP31%20wd%3AQ515.%0A%20%20%20%20%20%20%20%20%3Fcity%20wdt%3AP18%20%3FcityImage.%0A%20%20%20%20%20%20%20%20OPTIONAL%20%7B%0A%20%20%20%20%20%20%20%20%20%20VALUES%20%28%3Fprop%29%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%28wdt%3AP1082%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%28wdt%3AP6%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%28wdt%3AP190%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%28wdt%3AP31%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%28wdt%3AP571%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%28wdt%3AP150%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%28wdt%3AP206%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%28wdt%3AP527%29%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%3Fcity%20%3Fprop%20%3Fvalue.%0A%20%20%20%20%20%20%20%20%20%20%3Fproperty%20%3Fref%20%3Fprop.%0A%20%20%20%20%20%20%20%20%20%20%3Fproperty%20rdf%3Atype%20wikibase%3AProperty.%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D

_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata
_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata