Difference between revisions of "Template:Dump/doc"

From blackwiki
Jump to navigation Jump to search
imported>Was a bee
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
{{Lua|Module:Wikidata|Module:ResolveEntityId}}
+
{{Lua|Module:Sandbox/Was a bee/Dump|Module:ResolveEntityId}}
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 
This is wrapper template which provides easy access to <code>Dump</code> function defined in [[Module:Wikidata]].
 
This is wrapper template which provides easy access to <code>Dump</code> function defined in [[Module:Wikidata]].
 +
 +
== Usage ==
 +
<code><nowiki>{{Dump}}</nowiki></code>
 +
 +
<code><nowiki>{{Dump|id=Q42}}</nowiki></code>
 +
 +
<code><nowiki>{{Dump|title=Douglas Adams}}</nowiki></code>
 +
 +
<code><nowiki>{{Dump|title=Douglas Adams|claims|P856|1|mainsnak}}</nowiki></code>
  
 
== Function ==
 
== Function ==
This template shows raw data of Wikidata page in [[JSON]] format.
+
This template renders raw data of Wikidata item page in [[JSON]]-like format (for details, see [[:mw:Wikibase/DataModel/JSON]]) by using Lua function [[:mw:Extension:Scribunto/Lua_reference_manual#mw.dumpObject|mw.dumpObject]].
 
{| class="wikitable"
 
{| class="wikitable"
! Browser interface of [[:d:Q42|Q42]]
+
! style ="width:400px;" | Browser interface for [[:d:Q42|Q42]]
 
! style ="width:500px;" | Raw data of [[:d:Q42|Q42]]
 
! style ="width:500px;" | Raw data of [[:d:Q42|Q42]]
 
|-
 
|-
| style ="width:400px;"|[[File:Wikidata Q42 screenshot 2018-06-10.png|400px]]
+
| style ="width:400px; vertical-align: top;"|[[File:Wikidata Q42 screenshot 2018-06-10.png|400px]]
| style ="width:500px;"|{{Dump|title=Douglas Adams|width=500px|height=400px}}
+
| style ="width:500px; vertical-align: top;"|{{Dump|id=Q42|width=500px|height=400px}}
 
|-
 
|-
|Wikidata item page interface displayed when accessed by browser. The example item is {{Q|Q42}}.
+
| style ="width:400px; vertical-align: top;"|Wikidata item page interface displayed when accessed by browser. The example item is {{Q|Q42}}.
| style ="width:500px;"|Raw data of the item page. Shown by <code><nowiki>{{Dump|id=Q42}}</nowiki></code>. JSON data is also accessble through URL https://www.wikidata.org/wiki/Special:EntityData/Q42.json.
+
| style ="width:500px; vertical-align: top;"|Raw data of the same item page in [[JSON]]-like format (for details, see [[:mw:Wikibase/DataModel/JSON]]) rendered by the code <code><nowiki>{{Dump|id=Q42}}</nowiki></code>. Real JSON format data is accessible through URL https://www.wikidata.org/wiki/Special:EntityData/Q42.json.
 +
|}
 +
 
 +
Whole raw data is very long. So it is useful to render certain part of the whole tree.
 +
{| class="wikitable"
 +
! style ="width:500px;" | Template syntax
 +
! style ="width:400px;" | Usage
 +
|-
 +
| style ="width:500px; vertical-align: top;"|[[File:Wikidata_Dump_function.svg|500px]]
 +
| style ="width:400px; vertical-align: top;"|
 +
;Input
 +
<code><nowiki>{{Dump|id=Q42|claims|P856|1|mainsnak}}</nowiki></code>
 +
;Output
 +
{{Dump|id=Q42|claims|P856|1|mainsnak|width=400px}}
 +
|-
 +
| style ="width:500px; vertical-align: top;"|Template syntax.
 +
| style ="width:400px; vertical-align: top;"|Partial tree.
 
|}
 
|}
  
Line 23: Line 48:
 
{{Dump|title=Douglas Adams|claims|P856|1|mainsnak}}
 
{{Dump|title=Douglas Adams|claims|P856|1|mainsnak}}
  
== Usage ==
+
== Test area ==
<code><nowiki>{{Dump}}</nowiki></code>
+
The following data tree is current status of {{Q|P31}} section of {{Q|Q4115189}}.
  
<code><nowiki>{{Dump|id=Q42}}</nowiki></code>
+
You can check how data is represented through this template, by editing [[:d:Q4115189#P31|target section at Wikidata]]. (After editing, {{Purge|purge this page}} to update.)
  
<code><nowiki>{{Dump|title=Douglas Adams}}</nowiki></code>
+
<code><nowiki>{{Dump|id=Q4115189|claims|P31|height=400px}}</nowiki></code>
 +
{{Dump|id=Q4115189|claims|P31|height=400px}}
  
 +
== See also ==
 +
* {{tl|Examine}}
 +
* [[Module:Wikidata]]
 +
* [[:d:Wikidata:Data access]]
 +
* [[:mw:Wikibase/DataModel/JSON]]
  
 
<includeonly>{{sandbox other||
 
<includeonly>{{sandbox other||
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
+
[[Category:Wikidata templates]]
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 18:51, 20 December 2019

This is wrapper template which provides easy access to Dump function defined in Module:Wikidata.

Usage

{{Dump}}

{{Dump|id=Q42}}

{{Dump|title=Douglas Adams}}

{{Dump|title=Douglas Adams|claims|P856|1|mainsnak}}

Function

This template renders raw data of Wikidata item page in JSON-like format (for details, see mw:Wikibase/DataModel/JSON) by using Lua function mw.dumpObject.

Browser interface for Q42 Raw data of Q42
400px Lua error in Module:Sandbox/Was_a_bee/Dump at line 13: attempt to index field 'wikibase' (a nil value).
Wikidata item page interface displayed when accessed by browser. The example item is Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q42). Raw data of the same item page in JSON-like format (for details, see mw:Wikibase/DataModel/JSON) rendered by the code {{Dump|id=Q42}}. Real JSON format data is accessible through URL https://www.wikidata.org/wiki/Special:EntityData/Q42.json.

Whole raw data is very long. So it is useful to render certain part of the whole tree.

Template syntax Usage
500px
Input

{{Dump|id=Q42|claims|P856|1|mainsnak}}

Output

Lua error in Module:Sandbox/Was_a_bee/Dump at line 13: attempt to index field 'wikibase' (a nil value).

Template syntax. Partial tree.

Example

Input

{{Dump|title=Douglas Adams|claims|P856|1|mainsnak}}

Output

Lua error in Module:Sandbox/Was_a_bee/Dump at line 13: attempt to index field 'wikibase' (a nil value).

Test area

The following data tree is current status of Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (P31) section of Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q4115189).

You can check how data is represented through this template, by editing target section at Wikidata. (After editing, Script error: No such module "Purge". to update.)

{{Dump|id=Q4115189|claims|P31|height=400px}} Lua error in Module:Sandbox/Was_a_bee/Dump at line 13: attempt to index field 'wikibase' (a nil value).

See also