Difference between revisions of "Wikidata"
Jump to navigation
Jump to search
(Created page with "= Links = * https://www.mediawiki.org/wiki/API:Presenting_Wikidata_knowledge") |
|||
Line 1: | Line 1: | ||
= Links = | = Links = | ||
+ | = Structure = | ||
+ | https://www.mediawiki.org/wiki/Wikibase/DataModel/Primer | ||
+ | <uml> | ||
+ | hide Circle | ||
+ | class Entity { | ||
+ | } | ||
+ | class Claim { | ||
+ | } | ||
+ | class SnakGroup { | ||
+ | } | ||
+ | class Statement { | ||
+ | } | ||
+ | class Snak { | ||
+ | |||
+ | } | ||
+ | class Value { | ||
+ | } | ||
+ | class PropertyIdValue { | ||
+ | } | ||
+ | class EntityIdValue { | ||
+ | String iri; | ||
+ | String id; | ||
+ | String entityType; | ||
+ | } | ||
+ | Entity -- "statements n" Statement | ||
+ | Statement -- "claim 1" Claim | ||
+ | Claim -- "qualifiers n" SnakGroup | ||
+ | SnakGroup -- "snaks n" Snak | ||
+ | SnakGroup -- "propertyId 1" PropertyIdValue | ||
+ | Claim -- "mainSnak 1" Snak | ||
+ | Snak -- "value 1" Value | ||
+ | Snak -- "propertyId 1" PropertyIdValue | ||
+ | PropertyIdValue -> EntityIdValue | ||
+ | </uml> | ||
+ | [[File:Wikibase_JavaScript_Data_Model_1.0.svg]] | ||
+ | https://upload.wikimedia.org/wikipedia/commons/c/c2/Wikibase_JavaScript_Data_Model_1.0.svg | ||
+ | = Example = | ||
+ | Æthelstan King of the English - 927-939 | ||
+ | * https://www.wikidata.org/wiki/Q170017 | ||
+ | Position Held | ||
+ | * https://www.wikidata.org/wiki/Property:P39 | ||
+ | |||
+ | |||
+ | == Queen Victoria == | ||
+ | * https://en.wikipedia.org/wiki/Queen_Victoria | ||
+ | * https://www.wikidata.org/wiki/Q9439 | ||
+ | * http://royal-family.bitplan.com/index.php/Queen_Victoria | ||
+ | |||
+ | == Entity:Queen Victoria == | ||
+ | {| class="wikitable" | ||
+ | !colspan="2" | Statements | ||
+ | |- | ||
+ | ! PropertyId/name !! value | ||
+ | |- | ||
+ | | [https://www.wikidata.org/wiki/Property:P18 P18/image] || https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Queen_Victoria_by_Bassano.jpg/250px-Queen_Victoria_by_Bassano.jpg | ||
+ | |- | ||
+ | | [https://www.wikidata.org/wiki/Property:P569 P569/date of birth] || 24 May 1819 | ||
+ | |- | ||
+ | | [https://www.wikidata.org/wiki/Property:P39 P39/position held] || [https://www.wikidata.org/wiki/Q9134365 Q9134365/Monarch of the United Kingdom ] qualifiers -> start:20 June 1837, end:22 January 1901, replaced by:https://www.wikidata.org/wiki/Q20875 | ||
+ | |- | ||
+ | | [https://www.wikidata.org/wiki/Property:P570 P570/date of death] || 22 January 1901 | ||
+ | |- | ||
+ | | [https://www.wikidata.org/wiki/Property:P20 P20/place of death] || Osborne House | ||
+ | |- | ||
+ | | [https://www.wikidata.org/wiki/Property:P21 P21/sex or gender]] || [https://www.wikidata.org/wiki/Q6581072 Q6581072/female] | ||
+ | |} | ||
+ | = Descendants of Queen Victoria = | ||
+ | <source lang='sparql'> | ||
+ | # WikiData SPARQL Query | ||
+ | # | ||
+ | # Wolfgang Fahl 2018-01-06 | ||
+ | # | ||
+ | # get childen of queen victoria | ||
+ | SELECT ?child ?childLabel ?genderLabel ?dob | ||
+ | WHERE { | ||
+ | # | ||
+ | # child | ||
+ | # https://www.wikidata.org/wiki/Property:P40 | ||
+ | # Queen Victoria | ||
+ | # https://www.wikidata.org/wiki/Q9439 | ||
+ | wd:Q9439 wdt:P40+ ?child. | ||
+ | # gender | ||
+ | # https://www.wikidata.org/wiki/Property:P21 | ||
+ | ?child wdt:P21 ?gender. | ||
+ | # date of birth | ||
+ | # https://www.wikidata.org/wiki/Property:P569 | ||
+ | ?child wdt:P569 ?dob | ||
+ | SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } | ||
+ | } | ||
+ | ORDER BY ?dob | ||
+ | </source> | ||
+ | [https://query.wikidata.org/#%23%20WikiData%20SPARQL%20Query%0A%23%0A%23%20Wolfgang%20Fahl%202018-01-06%0A%23%0A%23%20get%20childen%20of%20queen%20victoria%0ASELECT%20%3Fchild%20%3FchildLabel%20%3FgenderLabel%20%3Fdob%0AWHERE%20%7B%0A%23%20%20%0A%23%20child%0A%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP40%0A%23%20Queen%20Victoriy%0A%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FQ9439%0A%20%20wd%3AQ9439%20wdt%3AP40%2B%20%3Fchild.%0A%23%20gender%0A%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP21%0A%20%20%3Fchild%20wdt%3AP21%20%3Fgender.%0A%23%20date%20of%20birth%0A%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP569%20%20%20%20%20%20%20%20%20%0A%20%20%3Fchild%20wdt%3AP569%20%3Fdob%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%7D%0AORDER%20BY%20%3Fdob%0A try it!] | ||
+ | |||
+ | = Import = | ||
+ | * https://www.wikidata.org/wiki/Wikidata:Data_Import_Guide | ||
+ | * https://www.wikidata.org/wiki/Q2140665 | ||
+ | * https://github.com/maxlath/wikidata-cli | ||
+ | * https://www.wikidata.org/wiki/Wikidata:Tools/External_tools | ||
+ | = Tools = | ||
+ | * https://github.com/maxlath/wikidata-cli/blob/master/docs/write_operations.md#wd-create-item | ||
+ | |||
+ | = What Links Here = | ||
+ | {{WhatLinksHere}} | ||
+ | [[Category:SiGNaL]] | ||
+ | |||
* https://www.mediawiki.org/wiki/API:Presenting_Wikidata_knowledge | * https://www.mediawiki.org/wiki/API:Presenting_Wikidata_knowledge |
Revision as of 12:59, 10 January 2018
Links
Structure
https://www.mediawiki.org/wiki/Wikibase/DataModel/Primer
https://upload.wikimedia.org/wikipedia/commons/c/c2/Wikibase_JavaScript_Data_Model_1.0.svg
Example
Æthelstan King of the English - 927-939
Position Held
Queen Victoria
- https://en.wikipedia.org/wiki/Queen_Victoria
- https://www.wikidata.org/wiki/Q9439
- http://royal-family.bitplan.com/index.php/Queen_Victoria
Entity:Queen Victoria
Statements | |
---|---|
PropertyId/name | value |
P18/image | |
P569/date of birth | 24 May 1819 |
P39/position held | Q9134365/Monarch of the United Kingdom qualifiers -> start:20 June 1837, end:22 January 1901, replaced by:https://www.wikidata.org/wiki/Q20875 |
P570/date of death | 22 January 1901 |
P20/place of death | Osborne House |
P21/sex or gender] | Q6581072/female |
Descendants of Queen Victoria
# WikiData SPARQL Query
#
# Wolfgang Fahl 2018-01-06
#
# get childen of queen victoria
SELECT ?child ?childLabel ?genderLabel ?dob
WHERE {
#
# child
# https://www.wikidata.org/wiki/Property:P40
# Queen Victoria
# https://www.wikidata.org/wiki/Q9439
wd:Q9439 wdt:P40+ ?child.
# gender
# https://www.wikidata.org/wiki/Property:P21
?child wdt:P21 ?gender.
# date of birth
# https://www.wikidata.org/wiki/Property:P569
?child wdt:P569 ?dob
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?dob
Import
- https://www.wikidata.org/wiki/Wikidata:Data_Import_Guide
- https://www.wikidata.org/wiki/Q2140665
- https://github.com/maxlath/wikidata-cli
- https://www.wikidata.org/wiki/Wikidata:Tools/External_tools