Help:Contributing/entities: Difference between revisions

From Wikibase
Jump to navigation Jump to search
docs: migrate contribution guide §2-7 (entities) from docs/contribution-guide.md (via create-page on MediaWiki MCP Server)
 
Rewrite in code-guide style: strip translation markup, <code> for plain tokens (via update-page on MediaWiki MCP Server)
Line 1: Line 1:
<languages/>
This page explains the data model and how to create and edit items and properties. Start at the [[Help:Contributing]] hub if you are new here.


<translate>
== The data model in five minutes ==
<!--T:1-->
This page explains the data model and how to create and edit items and properties. Start at the <tvar name="hub">[[Help:Contributing]]</tvar> hub if you are new here.
</translate>


== <translate><!--T:2--> The data model in five minutes</translate> ==
<translate>
<!--T:3-->
Wikibase is the software behind Wikidata. Two entity types exist on this instance:
Wikibase is the software behind Wikidata. Two entity types exist on this instance:
</translate>


{| class="wikitable" style="width:100%"
{| class="wikitable" style="width:100%"
! Entity !! ID !! URL form !! Example
|-
|-
! <translate><!--T:4--> Entity</translate> !! <translate><!--T:5--> ID</translate> !! <translate><!--T:6--> URL form</translate> !! <translate><!--T:7--> Example</translate>
| Item || <code>Q1</code>, <code>Q2</code>, … || <code>/wiki/Item:Q1</code> || a book, a person, a place
|-
|-
| <translate><!--T:8--> Item</translate> || <syntaxhighlight lang="text" inline>Q1</syntaxhighlight>, <syntaxhighlight lang="text" inline>Q2</syntaxhighlight>, … || <syntaxhighlight lang="text" inline>/wiki/Item:Q1</syntaxhighlight> || <translate><!--T:9--> a book, a person, a place</translate>
| Property || <code>P1</code>, <code>P2</code>, … || <code>/wiki/Property:P1</code> || "instance of", "date"
|-
| <translate><!--T:10--> Property</translate> || <syntaxhighlight lang="text" inline>P1</syntaxhighlight>, <syntaxhighlight lang="text" inline>P2</syntaxhighlight>, … || <syntaxhighlight lang="text" inline>/wiki/Property:P1</syntaxhighlight> || <translate><!--T:11--> "instance of", "date"</translate>
|}
|}


<translate>
<!--T:12-->
Each entity has:
Each entity has:
</translate>


<translate>
* '''Terms''': a multilingual '''label''' (unique per language per type), a '''description''', and optional '''aliases'''.
<!--T:13-->
* '''Statements''': a '''property → value''' pair, optionally with '''qualifiers''' (details) and '''references''' (provenance), and a '''rank''' (preferred, normal, deprecated).
* <b>Terms</b>: a multilingual <b>label</b> (unique per language per type), a <b>description</b>, and optional <b>aliases</b>.
* <b>Statements</b>: a <b>property → value</b> pair, optionally with <b>qualifiers</b> (details) and <b>references</b> (provenance), and a <b>rank</b> (preferred, normal, deprecated).
</translate>


<translate>
Order of work: define '''properties first''' (the schema), then create '''items''' (the data).
<!--T:14-->
Order of work: define <b>properties first</b> (the schema), then create <b>items</b> (the data).
</translate>


== <translate><!--T:15--> Before you create anything</translate> ==
== Before you create anything ==


<translate>
<!--T:16-->
<ol>
<ol>
<li><b>Search first</b> — use the search box or <tvar name="search">[[Special:Search]]</tvar>; do not create a duplicate item or property.</li>
<li>'''Search first''' — use the search box or [[Special:Search]]; do not create a duplicate item or property.</li>
<li><b>Reuse existing properties</b> — browse <tvar name="listprops">[[Special:ListProperties]]</tvar> (sidebar → <b>Semantic tools</b> <b>Browse properties</b>) before proposing a new one. A property is expensive: its datatype is permanent.</li>
<li>'''Reuse existing properties''' — browse [[Special:ListProperties]] (sidebar → '''Semantic tools''' '''Browse properties''') before proposing a new one. A property is expensive: its datatype is permanent.</li>
<li><b>Labels are unique per language</b> — an item cannot have two labels in the same language. Use the description to disambiguate.</li>
<li>'''Labels are unique per language''' — an item cannot have two labels in the same language. Use the description to disambiguate.</li>
</ol>
</ol>
</translate>


== <translate><!--T:17--> Creating a property</translate> ==
== Creating a property ==


<translate>
<!--T:18-->
<ol>
<ol>
<li>Go to <tvar name="newprop">[[Special:NewProperty]]</tvar> (also in the sidebar → <b>Semantic tools</b> <b>Create new property</b>).</li>
<li>Go to [[Special:NewProperty]] (also in the sidebar → '''Semantic tools''' '''Create new property''').</li>
<li>Fill in at least a <b>label</b> (for example <tvar name="lbl"><syntaxhighlight lang="text" inline>instance of</syntaxhighlight></tvar>) and a <b>description</b> (for example <tvar name="desc"><syntaxhighlight lang="text" inline>that class of which this subject is a particular example and member</syntaxhighlight></tvar>). Add aliases (for example <tvar name="al1"><syntaxhighlight lang="text" inline>is-a</syntaxhighlight></tvar>, <tvar name="al2"><syntaxhighlight lang="text" inline>isa</syntaxhighlight></tvar>).</li>
<li>Fill in at least a '''label''' (for example <code>instance of</code>) and a '''description''' (for example <code>that class of which this subject is a particular example and member</code>). Add aliases (for example <code>is-a</code>, <code>isa</code>).</li>
<li>Choose the <b>datatype</b> — the most important decision, and it <b>cannot be changed after creation</b>:</li>
<li>Choose the '''datatype''' — the most important decision, and it '''cannot be changed after creation''':</li>
</ol>
</ol>
</translate>


{| class="wikitable" style="width:100%"
{| class="wikitable" style="width:100%"
! Datatype !! Use for !! Example value
|-
|-
! <translate><!--T:19--> Datatype</translate> !! <translate><!--T:20--> Use for</translate> !! <translate><!--T:21--> Example value</translate>
| Item || link to another entity || <code>Q5</code> (a person)
|-
| <translate><!--T:22--> Item</translate> || <translate><!--T:23--> link to another entity</translate> || <syntaxhighlight lang="text" inline>Q5</syntaxhighlight> (a person)
|-
|-
| <translate><!--T:24--> Property</translate> || <translate><!--T:25--> link to another property</translate> || <syntaxhighlight lang="text" inline>P1</syntaxhighlight>
| Property || link to another property || <code>P1</code>
|-
|-
| <translate><!--T:26--> String</translate> || <translate><!--T:27--> free text</translate> || <syntaxhighlight lang="text" inline>"ISBN-13"</syntaxhighlight>
| String || free text || <code>"ISBN-13"</code>
|-
|-
| <translate><!--T:28--> External identifier</translate> || <translate><!--T:29--> identifier in another system</translate> || <syntaxhighlight lang="text" inline>Q1234</syntaxhighlight> → <syntaxhighlight lang="text" inline>https://www.wikidata.org/wiki/Q1234</syntaxhighlight>
| External identifier || identifier in another system || <code>Q1234</code> → <code>https://www.wikidata.org/wiki/Q1234</code>
|-
|-
| <translate><!--T:30--> URL</translate> || <translate><!--T:31--> web address</translate> || <syntaxhighlight lang="text" inline>https://example.org</syntaxhighlight>
| URL || web address || <code>https://example.org</code>
|-
|-
| <translate><!--T:32--> Monolingual text</translate> || <translate><!--T:33--> text with a language tag</translate> || <syntaxhighlight lang="text" inline>"hello"@en</syntaxhighlight>
| Monolingual text || text with a language tag || <code>"hello"@en</code>
|-
|-
| <translate><!--T:34--> Quantity</translate> || <translate><!--T:35--> numbers with units</translate> || <syntaxhighlight lang="text" inline>3</syntaxhighlight> (unit <syntaxhighlight lang="text" inline>Q11573</syntaxhighlight>, kg)
| Quantity || numbers with units || <code>3</code> (unit <code>Q11573</code>, kg)
|-
|-
| <translate><!--T:36--> Time</translate> || <translate><!--T:37--> dates</translate> || <syntaxhighlight lang="text" inline>2026-08-15T00:00:00Z</syntaxhighlight>
| Time || dates || <code>2026-08-15T00:00:00Z</code>
|-
|-
| <translate><!--T:38--> Globe coordinate</translate> || <translate><!--T:39--> latitude and longitude</translate> || <syntaxhighlight lang="text" inline>48.85N 2.35E</syntaxhighlight>
| Globe coordinate || latitude and longitude || <code>48.85N 2.35E</code>
|-
|-
| <translate><!--T:40--> Commons media</translate> || <translate><!--T:41--> a file name</translate> || <syntaxhighlight lang="text" inline>File:Foo.jpg</syntaxhighlight>
| Commons media || a file name || <code>File:Foo.jpg</code>
|}
|}


<translate>
The dropdown in [[Special:NewProperty]] shows the full set of datatypes available here.
<!--T:42-->
The dropdown in <tvar name="newprop">[[Special:NewProperty]]</tvar> shows the full set of datatypes available here.
</translate>


<translate>
For '''External identifier''', also set the '''formatter URL''' (formatter-url field), for example <code>https://www.wikidata.org/wiki/$1</code> — it makes values dereferenceable URIs in RDF.
<!--T:43-->
For <tvar name="extid"><syntaxhighlight lang="text" inline>External identifier</syntaxhighlight></tvar>, also set the <b>formatter URL</b> (formatter-url field), for example <tvar name="fmt"><syntaxhighlight lang="text" inline>https://www.wikidata.org/wiki/$1</syntaxhighlight></tvar> — it makes values dereferenceable URIs in RDF.
</translate>


<translate>
Save: the property gets its permanent ID (<code>P1</code>, <code>P2</code>, …). Other editors can now use it in statements.
<!--T:44-->
Save: the property gets its permanent ID (<tvar name="pid"><syntaxhighlight lang="text" inline>P1</syntaxhighlight></tvar>, <tvar name="pid2"><syntaxhighlight lang="text" inline>P2</syntaxhighlight></tvar>, …). Other editors can now use it in statements.
</translate>


== <translate><!--T:45--> Creating an item</translate> ==
== Creating an item ==


<translate>
<!--T:46-->
<ol>
<ol>
<li>Go to <tvar name="newitem">[[Special:NewItem]]</tvar> (also in the sidebar → <b>Semantic tools</b> <b>Create new item</b>).</li>
<li>Go to [[Special:NewItem]] (also in the sidebar → '''Semantic tools''' '''Create new item''').</li>
<li>Fill in a <b>label</b> (English at minimum — <tvar name="en"><syntaxhighlight lang="text" inline>en</syntaxhighlight></tvar>; other languages welcome), a <b>description</b>, and optional aliases.</li>
<li>Fill in a '''label''' (English at minimum — <code>en</code>; other languages welcome), a '''description''', and optional aliases.</li>
<li>Save: the item gets its permanent ID (<tvar name="qid"><syntaxhighlight lang="text" inline>Q1</syntaxhighlight></tvar>, <tvar name="qid2"><syntaxhighlight lang="text" inline>Q2</syntaxhighlight></tvar>, …).</li>
<li>Save: the item gets its permanent ID (<code>Q1</code>, <code>Q2</code>, …).</li>
<li>Add statements (next section). An item with no statements is just a stub.</li>
<li>Add statements (next section). An item with no statements is just a stub.</li>
</ol>
</ol>
</translate>


== <translate><!--T:47--> Adding and editing statements</translate> ==
== Adding and editing statements ==


<translate>
On an item page ([[Special:EntityPage/Q1]]):
<!--T:48-->
On an item page (<tvar name="q1">[[Special:EntityPage/Q1]]</tvar>):
</translate>


<translate>
<!--T:49-->
<ol>
<ol>
<li>Click <b>+ add statement</b> (or <b>+ add value</b> for more values of one property).</li>
<li>Click '''+ add statement''' (or '''+ add value''' for more values of one property).</li>
<li><b>Property</b>: start typing <tvar name="p1"><syntaxhighlight lang="text" inline>P1</syntaxhighlight></tvar> or its label — autocomplete.</li>
<li>'''Property''': start typing <code>P1</code> or its label — autocomplete.</li>
<li><b>Value</b>: depends on the datatype (item → start typing another entity's label).</li>
<li>'''Value''': depends on the datatype (item → start typing another entity's label).</li>
<li><b>Qualifiers</b> (optional): refine the statement, for example the <tvar name="date"><syntaxhighlight lang="text" inline>date</syntaxhighlight></tvar> property (<tvar name="p8"><syntaxhighlight lang="text" inline>P8</syntaxhighlight></tvar>) on <tvar name="ex"><syntaxhighlight lang="text" inline>population → 2.1 million</syntaxhighlight></tvar>.</li>
<li>'''Qualifiers''' (optional): refine the statement, for example the <code>date</code> property (<code>P8</code>) on <code>population → 2.1 million</code>.</li>
<li><b>References</b> (recommended for facts — this is the provenance layer): <b>Add reference</b>, for example the <tvar name="srcurl"><syntaxhighlight lang="text" inline>source URL</syntaxhighlight></tvar> property (<tvar name="p7"><syntaxhighlight lang="text" inline>P7</syntaxhighlight></tvar>) for a web source, <tvar name="src"><syntaxhighlight lang="text" inline>source</syntaxhighlight></tvar> (<tvar name="p28"><syntaxhighlight lang="text" inline>P28</syntaxhighlight></tvar>) for a book or article, or <tvar name="date2"><syntaxhighlight lang="text" inline>date</syntaxhighlight></tvar> (<tvar name="p8b"><syntaxhighlight lang="text" inline>P8</syntaxhighlight></tvar>) if the fact itself has a date. Every fact should say where it comes from.</li>
<li>'''References''' (recommended for facts — this is the provenance layer): '''Add reference''', for example the <code>source URL</code> property (<code>P7</code>) for a web source, <code>source</code> (<code>P28</code>) for a book or article, or <code>date</code> (<code>P8</code>) if the fact itself has a date. Every fact should say where it comes from.</li>
<li><b>Rank</b>: mark conflicting or outdated values as <b>deprecated</b>, the best value as <b>preferred</b>.</li>
<li>'''Rank''': mark conflicting or outdated values as '''deprecated''', the best value as '''preferred'''.</li>
</ol>
</ol>
</translate>


<translate>
<!--T:50-->
Editing tips:
Editing tips:
* Statement values are editable by clicking them; remove a statement with the ✕ control.
* Statement values are editable by clicking them; remove a statement with the ✕ control.
* Terms (label, description, aliases) are edited directly in the entity header — click the pencil icon and choose the language tab.
* Terms (label, description, aliases) are edited directly in the entity header — click the pencil icon and choose the language tab.
* Undo or roll back via the page <b>history</b> tab — every change is a wiki revision.
* Undo or roll back via the page '''history''' tab — every change is a wiki revision.
</translate>


== <translate><!--T:51--> Deleting and merging</translate> ==
== Deleting and merging ==


<translate>
'''Merge''' two duplicate items: use '''merge''' on the item page (right: <code>item-merge</code>, granted to registered users).
<!--T:52-->
<b>Merge</b> two duplicate items: use <b>merge</b> on the item page (right: <tvar name="merge"><syntaxhighlight lang="text" inline>item-merge</syntaxhighlight></tvar>, granted to registered users).
</translate>


<translate>
'''Delete''' an entity page: [[Special:DeletePage]] (<code>Item:Q12</code>) — admins only. Deleting a property is rare and breaks the statements that use it — prefer deprecating it instead.
<!--T:53-->
<b>Delete</b> an entity page: <tvar name="del">[[Special:DeletePage]]</tvar> (<tvar name="ex"><syntaxhighlight lang="text" inline>Item:Q12</syntaxhighlight></tvar>) — admins only. Deleting a property is rare and breaks the statements that use it — prefer deprecating it instead.
</translate>


== <translate><!--T:54--> See also</translate> ==
== See also ==


<translate>
* [[Help:Contributing]] — the hub
<!--T:55-->
* [[Help:Contributing/access]] — who can do what
* <tvar name="hub">[[Help:Contributing]]</tvar> — the hub
* [[Help:Contributing/query]] — querying with SPARQL
* <tvar name="access">[[Help:Contributing/access]]</tvar> — who can do what
* [[Help:Contributing/house-rules]] — house rules for this instance
* <tvar name="query">[[Help:Contributing/query]]</tvar> — querying with SPARQL
* [[Help:Contributing/import]] — importing from external authorities
* <tvar name="house">[[Help:Contributing/house-rules]]</tvar> — house rules for this instance
* [[Help:Contributing/api]] — API and bulk editing
* <tvar name="import">[[Help:Contributing/import]]</tvar> — importing from external authorities
* <tvar name="api">[[Help:Contributing/api]]</tvar> — API and bulk editing
</translate>

Revision as of 17:26, 19 August 2026

Languages: English · français · Esperanto

This page explains the data model and how to create and edit items and properties. Start at the Help:Contributing hub if you are new here.

The data model in five minutes

Wikibase is the software behind Wikidata. Two entity types exist on this instance:

Entity ID URL form Example
Item Q1, Q2, … /wiki/Item:Q1 a book, a person, a place
Property P1, P2, … /wiki/Property:P1 "instance of", "date"

Each entity has:

  • Terms: a multilingual label (unique per language per type), a description, and optional aliases.
  • Statements: a property → value pair, optionally with qualifiers (details) and references (provenance), and a rank (preferred, normal, deprecated).

Order of work: define properties first (the schema), then create items (the data).

Before you create anything

  1. Search first — use the search box or Special:Search; do not create a duplicate item or property.
  2. Reuse existing properties — browse Special:ListProperties (sidebar → Semantic toolsBrowse properties) before proposing a new one. A property is expensive: its datatype is permanent.
  3. Labels are unique per language — an item cannot have two labels in the same language. Use the description to disambiguate.

Creating a property

  1. Go to Special:NewProperty (also in the sidebar → Semantic toolsCreate new property).
  2. Fill in at least a label (for example instance of) and a description (for example that class of which this subject is a particular example and member). Add aliases (for example is-a, isa).
  3. Choose the datatype — the most important decision, and it cannot be changed after creation:
Datatype Use for Example value
Item link to another entity Q5 (a person)
Property link to another property P1
String free text "ISBN-13"
External identifier identifier in another system Q1234https://www.wikidata.org/wiki/Q1234
URL web address https://example.org
Monolingual text text with a language tag "hello"@en
Quantity numbers with units 3 (unit Q11573, kg)
Time dates 2026-08-15T00:00:00Z
Globe coordinate latitude and longitude 48.85N 2.35E
Commons media a file name File:Foo.jpg

The dropdown in Special:NewProperty shows the full set of datatypes available here.

For External identifier, also set the formatter URL (formatter-url field), for example https://www.wikidata.org/wiki/$1 — it makes values dereferenceable URIs in RDF.

Save: the property gets its permanent ID (P1, P2, …). Other editors can now use it in statements.

Creating an item

  1. Go to Special:NewItem (also in the sidebar → Semantic toolsCreate new item).
  2. Fill in a label (English at minimum — en; other languages welcome), a description, and optional aliases.
  3. Save: the item gets its permanent ID (Q1, Q2, …).
  4. Add statements (next section). An item with no statements is just a stub.

Adding and editing statements

On an item page (Special:EntityPage/Q1):

  1. Click + add statement (or + add value for more values of one property).
  2. Property: start typing P1 or its label — autocomplete.
  3. Value: depends on the datatype (item → start typing another entity's label).
  4. Qualifiers (optional): refine the statement, for example the date property (P8) on population → 2.1 million.
  5. References (recommended for facts — this is the provenance layer): Add reference, for example the source URL property (P7) for a web source, source (P28) for a book or article, or date (P8) if the fact itself has a date. Every fact should say where it comes from.
  6. Rank: mark conflicting or outdated values as deprecated, the best value as preferred.

Editing tips:

  • Statement values are editable by clicking them; remove a statement with the ✕ control.
  • Terms (label, description, aliases) are edited directly in the entity header — click the pencil icon and choose the language tab.
  • Undo or roll back via the page history tab — every change is a wiki revision.

Deleting and merging

Merge two duplicate items: use merge on the item page (right: item-merge, granted to registered users).

Delete an entity page: Special:DeletePage (Item:Q12) — admins only. Deleting a property is rare and breaks the statements that use it — prefer deprecating it instead.

See also