Moduuli:Wd:Wikidata/ohje
Siirry navigaatioon
Siirry hakuun
[ muokkaa ]
|
Module permitting basic data retrieval from items. It is mosly useful for other modules or for {{Data}}
A copy is available on test Wikidata
Functions callable from Lua
[muokkaa wikitekstiä]p.getClaims returns claims in a particular item that match a particular query
- item (required): its Qid
- property (required) property that the claims should have
- qualifier = qualifiers that the statement should have
- withrank = rank of the statement ; 'preferred', 'normal', 'deprecated' or 'valid' (ie. normal and preferred). By default = preferred.
- sourceproperty = this property should be used in the source
- withsource = the source that should be provided in the statement (if sourceproperty is not provided, the property used is todettu (P248))
- excludespecial = set to true if you do not want to get "novalue" and "somevalue".
- numval = if you want to set a maximum number of values to be returned
- sorttype = set to "chronological" to get the statements in chronological order using the alkamisajankohta (P580), päättymisajankohta (P582) and ajankohta (P585) qualifiers. Set to "inverted" for chronological order. From a Lua module, you can also define your own sorting criteria.
- showsource = set to "true" if you want the source of the statement to be displayed.
p.formatStatements(args): returns a string containing the statements given in the table args. Same keys as getClaims, plus formatting arguments:
- lang (required) for the desired language
- displayformat = the format in which the args should be returned. For example, for a string-type property displayformat = "weblink" returns a formatted weblink.
- conj = the conjunction separating the statements. For example, conj = '<br />' will make a new line between each statement.
- showqualifiers = the qualifiers that should be shown along with the mainsnak value
p.getLabel get the label of an entity
- entity = entity ID with its Q or P
- lang
Functions callable from wikitext
[muokkaa wikitekstiä]- p.formatStatementsE same as p.formatStatements, except that "lang" is not required. It is most conveniently used from {{Data}} that takes exactly the same arguments.
- p.getLabel get the label of an entity
Examples
[muokkaa wikitekstiä]Code | Render | Comment |
---|---|---|
{{#invoke:Wd:Wikidata|getLabel|entity=Q42}} | Douglas Adams | Douglas Adams (Q42) |
{{#invoke:Wd:Wikidata|getLabel|entity=Q42|link=wikipedia}} | Douglas Adams | |
{{#invoke:Wd:Wikidata|getLabel|entity=Q42|link=-}} | Douglas Adams | |
{{#invoke:Wd:Wikidata|getLabel|entity=Q42|link=wikipedia|lang=ja}} | ダグラス・アダムズ | |
{{#invoke:Wd:Wikidata|getLabel|entity=Q42|link=wikidata}} | Douglas Adams | |
{{#invoke:Wd:Wikidata|getLabel|entity=Q42|link=wikidata|lang=ja}} | ダグラス・アダムズ | |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q42|property=p31}} | ihminen | Douglas Adams (Q42) esiintymä kohteesta (P31) |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q42|property=p31|lang=ja}} | ヒト | |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q42|property=p569}} | Douglas Adams (Q42) syntymäaika (P569) | |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q42|property=p569|lang=ja}} | ||
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q42|property=p569|displayformat=raw}} | +1952-03-11T00:00:00Z | |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q12418|property=p186}} | öljyvärija poppeli puulevy | Mona Lisa (Q12418) materiaali (P186) |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q12418|property=p186|displayformat=raw}} | Q296955ja Q106857865 | |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q12418|property=p186|lang=ja}} | 油絵具 および ポプラ板 | |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q12418|property=p186|rank=valid}} | öljyväri, poppeli puulevyja puuaines | rank = "valid" accepts both "preferred" and "normal" values |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q12418|property=p186|numval=1}} | öljyväri | returns the number of values numval (priority to those with "rank= preferred", if there are not enough of them, also accepts "rank = normal") |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q12418|property=p186|qualifier=p518}} | poppeli puulevy | Mona Lisa (Q12418) materiaali (P186) pätee osalle (P518) should only display values that have a p518 qualifier |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q12418|property=p186|showqualifiers=p518}} | öljyvärija poppeli puulevy (maalauspohja) | shows the value of the p518 qualifier (if any) in addition to the main value |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q83259|property=p669|showqualifiers=p670|delimiter= }} | École normale supérieure (Q83259) katu tai tie (P669) osoitenumero (P670) shows the value of the P670 qualifier (if any) in addition to the main value separated by a space | |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q12418|property=P276|sourceproperty=P854}} | italialaiset maalaukset, sali 6 | Mona Lisa (Q12418) sijainti (P276) lähde-URL (P854) |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q11879536|property=P460|withsource=Q1645493}} | Lisa Gherardini | Mona Lisan esittämä henkilö (Q11879536) sanotaan olevan sama kuin (P460) Taiteilijaelämäkertoja Giottosta Michelangeloon (Q1645493) |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q11879536|property=P460|withsource=Q1645493|showsource=true}} | Lisa Gherardini[1][2] | |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q153|property=P231|showsource=true}} | 64-17-5[3][4][5] | etanoli (Q153) CAS-numero (P231) |
{{#invoke:Wd:Wikidata|formatStatementsE|item=Q205309|property=P793|sorttype=inverted}} | sulkeminen, purkaminen, korjausrakentaminen, korjausrakentaminen, first matchja rakentaminen | Arsenal Stadium (Q205309) merkittävä tapahtuma (P793) |
- ↑ Giorgio Vasari, Le vite de piu eccellenti architetti, pittori, et scultori italiani, da Cimabue insino a' tempi nostri, ja
- ↑ https://web.archive.org/web/20110508121954/http://www.ub.uni-heidelberg.de/Englisch/news/monalisa.html
- ↑ ChEBI (title not provided in Wikidata), European Bioinformatics Institute, Creative Commons Nimeä 4.0 Kansainvälinen
- ↑ Global Substance Registration System (title not provided in Wikidata)
- ↑ CAS Common Chemistry
Tämä on ohjesivu moduulille Moduuli:Wd:Wikidata