User:Pigsonthewing/2017-10
Jump to navigation
Jump to search
Try it!
Wikidata basics
[edit]- File:Wikidata-in-brief-1.0.pdf
- Wikidata:Status updates (weekly newsletter)
- Wikidata:Data donation
- Wikidata:Wikidata for authority control
- Wikidata:WikiProject Ontology
Babel
[edit]Put a Babel template on your user page, to control the language of labels and descriptions which Wikidata shows by default.
If you natively read and write Arabic, but also use English the code would be:
{{#babel:ar|en-4}}
(note the hyphen), where "ar" is the ISO 639-1, ISO 639-2 or ISO 639-3 code for the Arabic language, and "5" indicates your level of proficiency on a scale of 1-5 (or "N" for another native language).
You can add more languages, like this:
{{#babel:ar|en-4|es-3|fr-4}}
Tools
[edit]To do
[edit]Properties
[edit]- List of
{{Egypt properties}}
- Tunisian geographic code (P4274)
SPARQL
[edit]Basics
[edit]- https://query.wikidata.org/
- Wikidata:SPARQL query service/A gentle introduction to the Wikidata Query Service
- Wikidata:SPARQL query service/Query Helper
- Wikidata:SPARQL tutorial
- Wikidata:SPARQL query service/Wikidata Query Help
- Help:SPARQL/Building a query
- Terms
- wdt = property (PNN)
- wd = item (QNN)
- triple (subject, predicate, object)
- e.g.
- "The sky has the colour blue"
- subject ("the sky"), predicate ("has the colour"), object ("blue")
- sky:colour=blue
- sky (Q527):color (P462)=blue (Q1088)
- e.g.
- person:educatedAt='Edinburgh Unversity'
- ?person wdt:P69 wd:Q169302.
- e.g.
- mw:Wikidata query service/User Manual
- File:Wikidata Sparql Query Tutorial.webm - video intro (also Histeropedia intro)
- Wikidata:Request a query
- Wikidata:SPARQL query service/Federated queries
Examples
[edit]- Example tab on the Query Service page
Visualisations
[edit]Mangled URLs in Firefox
[edit]Run the query in the Chrome browser to get the "fixed" version:
- https://query.wikidata.org/embed.html#%23Uses of P496%3A%09as property (any rank%2Fbest rank%2Fnormal rank%2Fpreferred rank%2Fdeprecated rank)%0A%23%09%09%09%09as qualifier%0A%23%09%09%09%09in references%0A%23by Jura1%2C rev 2016-03-03%0ASELECT%09%3Fuse %3Frank %3Fitems_with_property%09%3Fuses_of_property%0AWHERE{%09{%09%09SELECT %09(wikibase%3AstatementProperty as %3Fuse)%09(COUNT(DISTINCT(%3Fitem)) as %3Fitems_with_property)%09(COUNT(%3Fvalue) as %3Fuses_of_property)%0A%09%09%09%09WHERE%09{%3Fitem p%3AP496 %3Fvalue}}%0AUNION%09{%09%09SELECT %09(wikibase%3AstatementProperty as %3Fuse)%09(wikibase%3ABestRank as %3Frank)%09(COUNT(DISTINCT(%3Fitem))%09as %3Fitems_with_property)%09(COUNT(%3Fbestvalue) as %3Fuses_of_property)%0A %09%09%09WHERE %09{%3Fitem wdt%3AP496 %3Fbestvalue } }%0AUNION %09{%09%09SELECT (wikibase%3AstatementProperty as %3Fuse)%09%3Frank%09(COUNT(DISTINCT(%3Fitem)) as %3Fitems_with_property)%09(COUNT((%3Fstatement)) as %3Fuses_of_property) %0A%09%09%09%09WHERE%09{%3Fitem p%3AP496 %3Fstatement . %0A %3Fstatement wikibase%3Arank %3Frank }%0A%09%09%09%09%09%09GROUP BY %3Frank }%0AUNION%09{%09%09SELECT %09(wikibase%3Areference as %3Fuse)%09%09%09(COUNT(DISTINCT(%3Fitem)) as %3Fitems_with_property)%09(COUNT(%3Fvalue) as %3Fuses_of_property)%0A %09%09%09WHERE %09{%3Fitem pr%3AP496 %3Fvalue }}%0AUNION%09{%09%09SELECT %09(wikibase%3Aqualifier as %3Fuse)%09%09%09(COUNT(DISTINCT(%3Fitem)) as %3Fitems_with_property)%09(COUNT(%3Fvalue) as %3Fuses_of_property)%0A %09%09%09WHERE %09{%3Fitem pq%3AP496 %3Fvalue }}%0A}%0AORDER BY DESC(%3Fuse) DESC(%3Fitems_with_property) %3Frank%0A%0A%23PLEASE NOTE%3A Deleted items appear in counts for some ranks%2C but not in others.
- https://query.wikidata.org/embed.html#%23Uses%20of%20P496%3A%09as%20property%20(any%20rank%2Fbest%20rank%2Fnormal%20rank%2Fpreferred%20rank%2Fdeprecated%20rank)%0A%23%09%09%09%09as%20qualifier%0A%23%09%09%09%09in%20references%0A%23by%20Jura1%2C%20rev%202016-03-03%0ASELECT%09%3Fuse%20%3Frank%20%3Fitems_with_property%09%3Fuses_of_property%0AWHERE%7B%09%7B%09%09SELECT%20%09(wikibase%3AstatementProperty%20as%20%3Fuse)%09(COUNT(DISTINCT(%3Fitem))%20as%20%3Fitems_with_property)%09(COUNT(%3Fvalue)%20as%20%3Fuses_of_property)%0A%09%09%09%09WHERE%09%7B%3Fitem%20p%3AP496%20%3Fvalue%7D%7D%0AUNION%09%7B%09%09SELECT%20%09(wikibase%3AstatementProperty%20as%20%3Fuse)%09(wikibase%3ABestRank%20as%20%3Frank)%09(COUNT(DISTINCT(%3Fitem))%09as%20%3Fitems_with_property)%09(COUNT(%3Fbestvalue)%20as%20%3Fuses_of_property)%0A%20%09%09%09WHERE%20%09%7B%3Fitem%20wdt%3AP496%20%3Fbestvalue%20%7D%20%7D%0AUNION%20%09%7B%09%09SELECT%20(wikibase%3AstatementProperty%20as%20%3Fuse)%09%3Frank%09(COUNT(DISTINCT(%3Fitem))%20as%20%3Fitems_with_property)%09(COUNT((%3Fstatement))%20as%20%3Fuses_of_property)%20%0A%09%09%09%09WHERE%09%7B%3Fitem%20p%3AP496%20%3Fstatement%20.%20%0A%20%3Fstatement%20wikibase%3Arank%20%3Frank%20%7D%0A%09%09%09%09%09%09GROUP%20BY%20%3Frank%20%7D%0AUNION%09%7B%09%09SELECT%20%09(wikibase%3Areference%20as%20%3Fuse)%09%09%09(COUNT(DISTINCT(%3Fitem))%20as%20%3Fitems_with_property)%09(COUNT(%3Fvalue)%20as%20%3Fuses_of_property)%0A%20%09%09%09WHERE%20%09%7B%3Fitem%20pr%3AP496%20%3Fvalue%20%7D%7D%0AUNION%09%7B%09%09SELECT%20%09(wikibase%3Aqualifier%20as%20%3Fuse)%09%09%09(COUNT(DISTINCT(%3Fitem))%20as%20%3Fitems_with_property)%09(COUNT(%3Fvalue)%20as%20%3Fuses_of_property)%0A%20%09%09%09WHERE%20%09%7B%3Fitem%20pq%3AP496%20%3Fvalue%20%7D%7D%0A%7D%0AORDER%20BY%20DESC(%3Fuse)%20DESC(%3Fitems_with_property)%20%3Frank%0A%0A%23PLEASE%20NOTE%3A%20Deleted%20items%20appear%20in%20counts%20for%20some%20ranks%2C%20but%20not%20in%20others.
Display a query on a wiki page
[edit]Use {{SPARQL}}
. For example,
{{SPARQL|query=SELECT ?item WHERE {
?item wdt:P31/wdt:P279* wd:Q33506 .
?item wdt:P2003 ?instagram .
}
}}
renders as:
SELECT ?item WHERE {
?item wdt:P31/wdt:P279* wd:Q33506 .
?item wdt:P2003 ?instagram .
}
That's a prefix of {{SPARQL|query=
and a closing pair of }}
.
Embed
[edit]Add embed.html to give: