We are looking for an expert to build custom queries on Wikidata and Wikipedia, is this the right place to be or if not any other suggestion?
Topic on Talk:Quarry
w:en:WP:Request a query for Wikipedia-related queries and d:WD:Request a query for Wikidata-related queries.
Thanks
I hang out here helping people with their queries. :) What are you looking to query?
Getting info for category Daily Newspaper (Q1110794)
Hi can I ask here some help in writing a query? Actually I need to query Wikidata to get the title, description, all the "In more languages" items, all statements label, statement descriptions and links to some wikipedia languages pages for the category "Daily Newspaper"...
Is this possible? Thanks for a feedback!
SELECT ?newspaper ?newspaperLabel ?countryLabel ?publisherLabel ?siteLabel WHERE {
?newspaper wdt:P31 wd:Q1110794.
OPTIONAL { ?newspaper wdt:P495 ?country. }
OPTIONAL { ?newspaper wdt:P123 ?publisher. }
OPTIONAL { ?newspaper wdt:P856 ?site. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
<nowiki>}</nowiki>
- This is what I could get in ten minutes work. Maybe you want some more information, please let me know. Q.Zanden questions? 11:04, 13 April 2017 (UTC)
- @Mdeninno:, this is some more information. Do you still need more?
SELECT DISTINCT ?newspaperLabel ?newspaperDescription ?countryLabel ?publisherLabel ?site ?logo ?creationdate ?founder ?title ?popLabel ?lowLabel ?award WHERE {
?newspaper wdt:P31 wd:Q1110794.
OPTIONAL { ?newspaper wdt:P495 ?country. }
OPTIONAL { ?newspaper wdt:P123 ?publisher. }
OPTIONAL { ?newspaper wdt:P856 ?site. }
OPTIONAL { ?newspaper wdt:P154 ?logo. }
OPTIONAL { ?newspaper wdt:P571 ?creationdate. }
OPTIONAL { ?newspaper wdt:P112 ?founder. }
OPTIONAL { ?newspaper wdt:P1476 ?title. }
OPTIONAL { ?newspaper wdt:P291 ?pop. } #place of publication
OPTIONAL { ?newspaper wdt:P364 ?low. } #language of original work
OPTIONAL { ?newspaper wdt:P166 ?award. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,nl,de,it,es". }
<nowiki>}</nowiki>
- PS. please sign your message with four tildes (~~~~) Q.Zanden questions? 16:35, 13 April 2017 (UTC)
- ~~~~ @QZanden: This is good thanks a lot!
- Last question: do you know how can I get the pointer to the en Wikipedia page for each record?
- M
- Here is it:
SELECT DISTINCT ?newspaperLabel ?newspaperDescription ?countryLabel ?publisherLabel ?site ?logo ?creationdate ?founder ?title ?popLabel ?lowLabel ?award ?article WHERE {
?newspaper wdt:P31 wd:Q1110794.
OPTIONAL { ?newspaper wdt:P495 ?country. }
OPTIONAL { ?newspaper wdt:P123 ?publisher. }
OPTIONAL { ?newspaper wdt:P856 ?site. }
OPTIONAL { ?newspaper wdt:P154 ?logo. }
OPTIONAL { ?newspaper wdt:P571 ?creationdate. }
OPTIONAL { ?newspaper wdt:P112 ?founder. }
OPTIONAL { ?newspaper wdt:P1476 ?title. }
OPTIONAL { ?newspaper wdt:P291 ?pop. } #place of publication
OPTIONAL { ?newspaper wdt:P364 ?low. } #language of original work
OPTIONAL { ?newspaper wdt:P166 ?award. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,nl,de,it,es". }
Optional { ?article schema:about ?newspaper.
?article schema:isPartOf <https://en.wikipedia.org/>.}
<nowiki>}</nowiki>
- Q.Zanden questions? 23:50, 13 April 2017 (UTC)
- ~~~~ @QZanden: Fantastic!
- I just tried to remove the other languages but still getting multiple istances for some records.. didn't understood why...
- M