|
|
| Line 1: |
Line 1: |
| == Wikibase Sample Data == | | == Wikibase Sample Data == |
| Data fetched '''dynamically''' from [https://wd.hxmn.dev Wikibase] via SPARQL on each page view. | | Data fetched '''dynamically''' from [https://wd.hxmn.dev Wikibase] via SPARQL. |
| | Tables are rendered by [[Module:Wikibase|Module:Wikibase]] (Lua), same pattern as Wikipedia. |
|
| |
|
| === Countries === | | === Countries === |
| {{#get_web_data:url=https://wd.hxmn.dev/query/sparql?format=json|format=json with jsonpath|post data=query=SELECT ?item ?itemLabel ?capitalLabel ?population ?founded ?continentLabel WHERE { ?item <https://wd.hxmn.dev/prop/direct/P1> <https://wd.hxmn.dev/entity/Q1> . ?item <http://www.w3.org/2000/01/rdf-schema#label> ?itemLabel . FILTER(LANG(?itemLabel) = "en") OPTIONAL { ?item <https://wd.hxmn.dev/prop/direct/P5> ?capital . ?capital <http://www.w3.org/2000/01/rdf-schema#label> ?capitalLabel . FILTER(LANG(?capitalLabel) = "en") } OPTIONAL { ?item <https://wd.hxmn.dev/prop/direct/P3> ?population . } OPTIONAL { ?item <https://wd.hxmn.dev/prop/direct/P4> ?founded . } OPTIONAL { ?item <https://wd.hxmn.dev/prop/direct/P6> ?continent . ?continent <http://www.w3.org/2000/01/rdf-schema#label> ?continentLabel . FILTER(LANG(?continentLabel) = "en") } } ORDER BY ?itemLabel|data=item=$.results.bindings[*].item.value,name=$.results.bindings[*].itemLabel.value,capital=$.results.bindings[*].capitalLabel.value,population=$.results.bindings[*].population.value,founded=$.results.bindings[*].founded.value,continent=$.results.bindings[*].continentLabel.value}} | | {{#invoke:Wikibase|countries}} |
| {| class="wikitable sortable"
| |
| ! Country !! Capital !! Population !! Founded !! Continent !! Wikibase Item
| |
| {{#display_external_table:template=Wikibase country row}}
| |
| |}
| |
|
| |
|
| === Cities === | | === Cities === |
| {{#get_web_data:url=https://wd.hxmn.dev/query/sparql?format=json|format=json with jsonpath|post data=query=SELECT ?item ?itemLabel ?countryLabel ?population ?founded WHERE { ?item <https://wd.hxmn.dev/prop/direct/P1> <https://wd.hxmn.dev/entity/Q2> . ?item <http://www.w3.org/2000/01/rdf-schema#label> ?itemLabel . FILTER(LANG(?itemLabel) = "en") OPTIONAL { ?item <https://wd.hxmn.dev/prop/direct/P2> ?country . ?country <http://www.w3.org/2000/01/rdf-schema#label> ?countryLabel . FILTER(LANG(?countryLabel) = "en") } OPTIONAL { ?item <https://wd.hxmn.dev/prop/direct/P3> ?population . } OPTIONAL { ?item <https://wd.hxmn.dev/prop/direct/P4> ?founded . } } ORDER BY ?itemLabel|data=item=$.results.bindings[*].item.value,name=$.results.bindings[*].itemLabel.value,country=$.results.bindings[*].countryLabel.value,population=$.results.bindings[*].population.value,founded=$.results.bindings[*].founded.value}} | | {{#invoke:Wikibase|cities}} |
| {| class="wikitable sortable"
| |
| ! City !! Country !! Population !! Founded !! Wikibase Item
| |
| {{#display_external_table:template=Wikibase city row}}
| |
| |}
| |
|
| |
|
| === SPARQL Queries === | | === SPARQL Queries === |
Wikibase Sample Data[edit]
Data fetched dynamically from Wikibase via SPARQL.
Tables are rendered by Module:Wikibase (Lua), same pattern as Wikipedia.
Countries[edit]
| Country |
Capital |
Population |
Founded |
Continent |
Wikibase
|
| France |
Paris |
67,750,000 |
843 |
Europe |
Q10
|
| Germany |
Berlin |
84,482,000 |
1871 |
Europe |
Q7
|
| Japan |
Tokyo |
125,124,000 |
660 BC |
Asia |
Q8
|
| United States |
Washington, D.C. |
331,449,000 |
1776 |
North America |
Q9
|
| City |
Country |
Population |
Founded |
Wikibase
|
| Berlin |
Germany |
3,748,000 |
1237 |
Q11
|
| Paris |
France |
2,161,000 |
259 BC |
Q14
|
| Tokyo |
Japan |
13,960,000 |
1457 |
Q12
|
| Washington, D.C. |
United States |
689,545 |
1790 |
Q13
|
SPARQL Queries[edit]
Run queries at WDQS Query Service.