Jump to content

User:Franz van Duns/sandbox

From Wikipedia, the free encyclopedia

Templates for Boxes

[edit]
  • 1 {{Commons category|Pocket watches}} ====> Category exists.
  • 2 {{Commons|Pocket watches}} ====> Page does not exist.

Templates for inline text "Media related to ZZZZ at Wikimedia Commons:":

  • 3 Media related to Pocket watches at Wikimedia Commons {{Commons-inline|Pocket watches}} ====> Page does not exist.

Test:

Related media at Wikimedia Commons:

How to Retrieve Data from Wikidata

[edit]

Template: {{Wikidata}}

[edit]

The following examples have been copied from the highly useful page Template:Wikidata#Examples.

These parameters retrieve a literal string value via "entity-ID"

[edit]
  • NL → {{wikidata|property|eid=Q55|P395}}: Netherlands (Q55) | licence plate code (P395)
  • 452 gram → {{wikidata|property|eid=Q21233320|P2067}} : Carl Zeiss Batis Sonnar T* 1.8/85 (Q21233320) | mass (P2067)
  • 452 → Now truncated to numerical value only: → {{Trunc | {{wikidata|property|eid=Q21233320|P2067}} | {{Str find|{{wikidata|property|eid=Q21233320|P2067}}| }} }}


These parameters retrieve a property with its references (see bottom of page)

[edit]
  • A total of 17,942,942[1] people live in the Netherlands.

These parameters return the output in a custom format

[edit]
    • 17,942,942[1]
      • 1 January 2024
    • 17,590,672[2]
      • 1 January 2022
    • 17,407,585[2]
      • 1 January 2020
    • 17,282,163[2]
      • 1 January 2019
    • 17,181,084[2]
      • 1 January 2018
    • 17,081,507[3]
      • 1 January 2017
    • 17,000,000[4]
      • 21 March 2016
    • 16,829,289[5]
      • 26 August 2014
    • 16,779,575[6]
      • 2013
    • 10,026,773[6]
      • 1950

These parameters retrieve a raw date value

[edit]
  • 2014-08-26

Template: {{Wikidata+icon}}

[edit]

String manipulation functions

[edit]

These string manipulation functions are required to alter values from Wikidata to a form suitable for Wikipedia.

  • 10 → {{Str find|Panthera (genus)|(}}
  • 9 → {{Str find|Panthera (genus)| }}
  • Panthera → {{Trunc | Panthera (genus) | {{Str find|Panthera (genus)| }} }}
  • 452

SPARQL-QUERY

[edit]
SPARQL-QUERY: queryStr=SELECT ?WikiData_item_ ?WikiData_item_Label ?value ?valueLabel ?English_WikiPedia_article  #Show data in this order
{
	?WikiData_item_ wdt:P18 ?value . #Collecting all items which have P18 data, from whole WikiData item pages
	OPTIONAL {?English_WikiPedia_article schema:about ?WikiData_item_; schema:isPartOf <https://en.wikipedia.org/> .} #If collected item has link to English WikiPedia, show that
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en"  } #Show label in this language. "en" is  English.   
}
LIMIT 10
  • Note: causes a "java.util.concurrent.TimeoutException" for unknown reasons.

How to display Data Directly Derived from Wikidata within an Infobox

[edit]
  • Wikidata entity: Bill Gates (Q5284)
    image (P18), now thumb-sized and on the right:
    birth name (P1477): William Henry Gates III
    date of birth (P569) : 28 October 1955
    spouse (P26): Melinda Gates
    Commons category (P373): Bill Gates
  • Dutch flag:
  • Infobox as copied from
    Franz van Duns/sandbox
Bill Gates
Head and shoulders photo of Bill Gates
Born
William Henry Gates III

(1955-10-28) October 28, 1955 (age 69)
  • Infobox as above, but some parameters replaced by direct Wikidata calls via template "{{wikidata}}":
Bill Gates
Born
William Henry Gates III

28 October 1955
Seattle
Spouse(s)Melinda Gates, married 1 January 1994
Children3
Parents
  • Bill Gates Sr.
  • Mary Maxwell Gates
Website(invalid!) / ORIG: gatesnotes.org





Remarkable Templates

[edit]

{{unbulleted list|Item one|item two|item three}}

  • Item one
  • item two
  • item three

Linking to other Wiki Projects

[edit]

Wiki Commons

[edit]
  • Image on display including both "ALT text" and an embedded link to Wiki Commons: Passiflora caerulea stereo image - arranged L-R to be viewed with a stereo viewer, image separation approx. 25mm)

POTD attribbution box

[edit]
  • Code to display the POTD attribution box within Wikipedia: {{picture of the day|2021-11-01}}:
  • Note (a): All attempts to summon this Wikipedia template from within Wiki Commons have, alas, as to now, been without avail!
  • Note (b): The Wikipedia template {{Template:POTD/2021-11-01}} displays the POTD image plus caption of an image that has appeared / will appear as Wikipedia:Picture of the day on a Wikipedia page. Extract from template: Use any valid date format for the template parameter. Pages with this template will be automatically placed into Category:Wikipedia Picture of the day files.
Stereoscopy
Stereoscopy is a technique for creating or enhancing the illusion of depth in an image by means of stereopsis for binocular vision.

This image of two Passiflora caerulea flowers is arranged as a stereo image pair; it can be viewed stereoscopically by using the cross-eyed viewing method (parallel version here).Photograph credit: Franz van Duns

  • Note (c): The Wikipedia template {{Template:POTD}}, displays the current POTD image in a box of no more than 600 pixels wide on a Wikipedia page.
Réunion stonechat

TEST CASE 04

[edit]

Interwiki linking:

TEST CASE 05

[edit]

Relations to Commons categories: Media related to Ursus maritimus at Wikimedia Commons

TEST CASE 06

[edit]

Relations to Wikidata:

  • Create an Info box on the right → {{Wikidata property |1= P1164 |2= P2820}}
  • Create an Info box on the right → {{Wikidata property |Q21233320}}

TEST CASE 07

[edit]

Special characters:

TEST CASE 08

[edit]

TEST TEST - TEST TEST

End of Page

[edit]

Note: All references from above templates are displayed below this last line of code.

  1. ^ a b "Bevolking; kerncijfers (1950-2024)". Retrieved 22 August 2024.
  2. ^ a b c d "Bevolking; kerncijfers, 1950-2022".
  3. ^ "Bevolking; kerncijfers, 1950-2022". Retrieved 18 March 2023.
  4. ^ "Nederland telt 17 miljoen inwoners". 21 March 2016.
  5. ^ "CBS StatLine - Bevolking; kerncijfers". Archived from the original on 3 September 2014. Retrieved 26 August 2014.
  6. ^ a b "CBS StatLine - Bevolking; kerncijfers". Statistics Netherlands. Archived from the original on 27 August 2015. Retrieved 22 August 2015.