Testwiki:Data model

From testwiki
Jump to navigation Jump to search

<languages/> Template:Information page

<translate> Wikidata represents Template:Wikipedia as data itemsTemplate:Anchor (e.g. Template:Q and Template:Q are data items). Knowledge about data items is represented via statementsTemplate:Anchor, whose basic structure consists of a subject, a predicate and an object. For example, Template:Statement. </translate>

  • <translate> The subject of a statement is usually a data item — in this case, Template:Q.</translate>
  • <translate> The predicate of a statement is always a property — in this case, Template:P.</translate>
  • <translate> The object of a statement is a value of the data type of the property — in this case, an item, Template:Q.</translate>

<translate> The property used in a statement determines both the meaning of the statement (i.e. the nature of the relationship between the subject and the object), as well as which values may be used, as specified by its data type.</translate>

<translate> For example, in the example above we used the property Template:P, whose values must have the data type Template:Datatype, allowing a data item to be set as the object of the statement (in the case of our example, Template:Q).</translate>

<translate> An example of a property with a different data type is Template:P, whose values must be of data type Template:Datatype, so it can only be used to state a point in time.</translate>

Template:Anchor <translate> Wikidata also allows statements to be qualified with further properties, which are called {{<tvar name="1">ll|Help:Qualifiers</tvar>|qualifiers}}. For example, we might state Template:Statement.</translate>

<translate> The information on this page is not required to contribute to Wikidata or to consume Wikidata. To learn about contributing/consuming Wikidata, please refer to the pages <tvar name="1">Template:Ll</tvar> and <tvar name="2">Template:Ll</tvar> respectively.</translate>

<translate>

Three levels of data models

Wikidata is powered by the <tvar name="1">Template:Ll software. While Wikibase defines Template:Data data types by default, it does not come with any {{<tvar name="2">ll|Help:Properties</tvar>|property}} out of the box. Wikidata, however, has [[<tvar name="3">Special:ListProperties|Template:Pages in namespace</tvar> properties]], which have all been created specifically for Wikidata and are defined within Wikidata itself. (Don't worry about that large number, <tvar name="income">Expression error: Unrecognized punctuation character "[".</tvar>% of these properties are just <tvar name="4">Template:Ll, i.e. links to items in other databases.) </translate>

<translate> When we speak of a "{{<tvar name="1">wikipedia|Q1172480</tvar>|data model}}" in the context of Wikidata, it can actually refer to one of three things:</translate>

  • <translate> the data model of the Wikibase software (which is actually more elaborate than just semantic triples</translate>[1])
  • <translate> the fundamental data model that Wikidata establishes on top of the Wikibase model, which includes the core properties such as Template:P, Template:P and Template:P</translate>
  • <translate> any of the topic-specific data models (e.g. for instances of Template:Q, there are the properties Template:P and Template:P)</translate>

<translate> All of these different data models are described on different pages:</translate>

  • <translate> the data model of the Wikibase software is described on mediawiki.org very technically in [[<tvar name="1">mw:Special:MyLanguage/Wikibase/DataModel</tvar>|the specification]] and more accessibly in the [[<tvar name="2">mw:Special:MyLanguage/Wikibase/DataModel/Primer</tvar>|primer to the Wikibase data model]]</translate>
  • <translate> the fundamental data model of Wikidata is not strictly defined, nonetheless this page attempts to describe it</translate>
  • <translate> the various topic-specific data models are loosely described via Template:P and more formally via [[<tvar name="1">#Entity schemas</tvar>|entity schemas]].</translate>

<translate> Note that Wikidata has no central authority that decides how data should be modeled, instead that question is decided collaboratively by <tvar name="1">Template:Ll through public discussion. The data model of Wikidata has evolved over time and is very much still evolving: new data types can be introduced, new properties are being proposed and created, problematic properties get deprecated and there is an ongoing effort to better describe how properties are meant to be used via property constraints and entity schemas. </translate>

<translate>

Data model of Wikibase

</translate> Template:Properties by datatype

<translate> The data model of Wikidata is based on the data model of <tvar name="1">Template:Ll, which is described very technically in [[<tvar name="2">mw:Special:MyLanguage/Wikibase/DataModel</tvar>|the specification]] and more accessibly in the [[<tvar name="3">mw:Special:MyLanguage/Wikibase/DataModel/Primer</tvar>|primer to the Wikibase data model]].</translate>

<translate> Wikidata extends the Wikibase data model via extensions. Most notably [[<tvar name="1">mw:Special:MyLanguage/Extension:WikibaseLexeme</tvar>|WikibaseLexeme]] adds three entity types for Template:Ll (Lexeme, Form and Sense), as described in the [[<tvar name="2">mw:Special:MyLanguage/Extension:WikibaseLexeme/Data Model</tvar>|WikibaseLexeme data model]]. Wikidata uses several extensions to add more data types to Wikibase, as described in <tvar name="3">Template:Ll</tvar>.</translate>

<translate>

Data types

The data types of Wikidata are described at <tvar name="1">Template:Ll</tvar> and listed at <tvar name="2">Special:ListDatatypes</tvar>. Wikidata extends the [[<tvar name="3">mw:Special:MyLanguage/Wikibase/DataModel#Datatypes and their Values</tvar>|data types of Wikibase]] via the following three extensions:</translate>

  • <translate> [[<tvar name="1">mw:Special:MyLanguage/Extension:WikibaseLexeme</tvar>|WikibaseLexeme]] adds the Template:Datatype, Template:Datatype and Template:Datatype data types to refer to its introduced entity types</translate>
  • <translate> [[<tvar name="1">mw:Special:MyLanguage/Extension:Math</tvar>|Math]] adds the {{<tvar name="2">ll|Help:Data_type#math</tvar>|Mathematical expression data type}}</translate>
  • <translate> [[<tvar name="1">mw:Special:MyLanguage/Extension:Score</tvar>|Score]] adds the {{<tvar name="2">ll|Help:Data_type#musical-notation</tvar>|Musical Notation data type}}</translate>

<translate> This is possible because the data types of Wikibase [[<tvar name="1">mw:Special:MyLanguage/Wikibase/Developing extensions#new-datatype</tvar>|are extensible]]. The introduction of more data types can be [<tvar name="2">https://phabricator.wikimedia.org/tag/datatypes/</tvar> proposed on Phabricator]. </translate>

<translate> The Wikibase data model has a [<tvar name="1">https://doc.wikimedia.org/Wikibase/master/php/docs_topics_json.html</tvar> canonical representation in JSON], which is further described at <tvar name="2">Template:Ll</tvar>.</translate>

<translate> Note that several data types have limitations, which are listed at {{<tvar name="1">ll|Help:Data type#limitations</tvar>|Help:Data type}}.</translate>

<translate> Also note that there is no clear semantical difference between Template:Datatype and Template:Datatype ... several string properties are external identifiers and Template:P works for both.</translate>

<translate>

Ranks

Every statement in Wikibase has one of three ranks (normal, deprecated or preferred). For the semantics of these ranks please refer to <tvar name="1">Template:Ll</tvar>.</translate>

<translate>

No value and unknown value

Template:See also </translate>

  • Template:Statement <translate> means that no such value exists</translate> (≡ ¬∃ X (Template:Statement))
  • Template:Statement <translate> can mean any of the following:</translate>
    • <translate> the value was once known but has been lost to time</translate> (e.g. Template:Statement)
    • <translate> the exact value has never been known and might not ever be known</translate> (e.g. Template:Statement)
    • <translate> the Wikidata contributor who made the statement knows the value exists but doesn't know it personally</translate>
    • <translate> the value is a known object, but there's no Wikidata item about the object (perhaps because it's not notable).</translate>

<translate>

Order of values

While Wikibase always stores values in a specific order (insertion order by default), the order of values generally does not imply any semantics. Semantic order is instead expressed via qualifiers, for example:

<translate> Note that the order expressed via qualifiers does not necessarily match the order of values in the user interface or the API because these interfaces simply return values in the serialization order, which may or may not match the semantic order expressed by the qualifiers.</translate>[2]

<translate>

Fundamental entities

The fundamental properties of Wikidata are described in <tvar name="1">Template:Ll</tvar>.

For more information and people interested in the <tvar name="2">Template:Wikipedia of Wikidata, please refer to the [[<tvar name="3">Special:MyLanguage/Wikidata:WikiProject Ontology</tvar>|Ontology WikiProject]].</translate>

<translate>

Fundamental properties

Note: This section assumes that you are familiar with <tvar name="1">Template:Wikipedia, for a less technical explanation please refer to <tvar name="2">Template:Ll</tvar>. </translate> <translate> The three arguably most important properties of Wikidata are based on <tvar name="1">{{Wikipedia</tvar>|Q1751819}}, which is described in the [<tvar name="2">https://www.w3.org/TR/rdf-schema/</tvar> RDF Schema specification]. </translate>

<translate> These properties have the following semantics:</translate>

<translate> Please note that Template:P and Template:P are both transitive properties:</translate>

Template:Ombox

<translate> Another important property is Template:P, which is equivalent to [<tvar name="1">https://www.w3.org/TR/owl-ref/#inverseOf-def</tvar> owl:inverseOf] and carries the following semantics:</translate>

<translate>

Restrictiveness of qualifiers

{{<tvar name="1">ll|Testwiki:Data model|anchor=qualifiers</tvar>|Qualifiers}} can be either restrictive or non-restrictive. Restrictive qualifiers change the meaning or scope of a statement, they have to be taken into account by data consumers that want to correctly interpret Wikidata statements. Non-restrictive qualifiers on the other hand just add additional information that can be safely disregarded without changing the meaning or scope of the statement.</translate>

<translate> Examples for restrictive qualifiers are:

<translate> The restrictiveness of properties when used as a qualifier is currently modeled via Template:Statement and Template:Statement (note that you as always have to take the transitivity of Template:P into account).</translate>

<translate> Unfortunately some properties aren't clear-cut and can be both restrictive as well as non-restrictive when used as a qualifier, so we can group qualifier properties into four categories:</translate>

  • <translate>

{{<tvar name="1">quickquery|?prop wdt:P31/wdt:P279* wd:Q61719275 FILTER NOT EXISTS { ?prop wdt:P31/wdt:P279* wd:Q61719274 }|description=yes|</tvar>properties that are clearly restrictive}} when used as a qualifier

[<tvar name="1">https://query.wikidata.org/embed.html#SELECT%20DISTINCT%20%3Fprop%20%3FpropLabel%20%3FpropDescription%20WHERE%20%7B%0A%20%20%20%20%7B%20%3Fprop%20wdt%3AP31%2Fwdt%3AP279%2A%20wd%3AQ15720608%20%7D%0A%20%20%20%20UNION%20%7B%20%3Fprop%20p%3AP2302%20%5B%20ps%3AP2302%20wd%3AQ53869507%3B%20pq%3AP5314%20wd%3AQ54828449%20%5D%20%7D%0A%20%20%20%20FILTER%20NOT%20EXISTS%20%7B%20%3Fprop%20wdt%3AP31%2Fwdt%3AP279%2A%20wd%3AQ61719274%20%7D%0A%20%20%20%20FILTER%20NOT%20EXISTS%20%7B%20%3Fprop%20wdt%3AP31%2Fwdt%3AP279%2A%20wd%3AQ61719275%20%7D%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D</tvar> properties that have not been classified at all regarding their restrictiveness] when used as a qualifier</translate>

<translate>

Negation

Wikibase does not have built-in support for Template:Wikipedia, negation therefore has to be modeled with separate properties. For example Template:P can be negated with Template:P. Such negating properties only exist for {{<tvar name="1">quickquery|?prop wdt:P11317 ?other FILTER NOT EXISTS { ?prop wdt:P31 wd:Q115449020 }</tvar>|a few properties}}. When the need for a new negating property arises, it {{<tvar name="2"> ll|Wikidata:Property proposal</tvar>|may be proposed}}.</translate>

<translate> The semantics of negating properties are modeled via Template:P, as follows:</translate>

<translate> Whether or not a property expresses the absence of something is currently modeled via Template:Statement.</translate>

<translate>

Differences from OOP

Contrary to Template:Wikipedia there is nothing preventing an entity from being both an instance as well as a class.</translate>

<translate> Furthermore an entity can be an instance of multiple classes, as well as a subclass of multiple classes.</translate>

<translate> Lastly you might expect that an instance automatically inherits all statements from its parent classes, however that is explicitly not the case, as explained in <tvar name="1">Template:Ll</tvar>.</translate>

<translate>

Inferring classes

Properties may specify Template:P which has the semantics: </translate>

<translate> Classes can be defined to be a {{<tvar name="1">wikipedia|Q185359|</tvar>union}} or a {{<tvar name="2">wikipedia|Q842620|</tvar>disjoint union}} of other classes with Template:P and Template:P respectively. Their concrete semantics are as follows:</translate>

<translate> Let's define classesOf(X):={CX is an instance of C}.

Classes may specify Template:P which has the semantics:</translate>

<translate> Classes may specify Template:P which has the semantics:</translate>

<translate>

Inheritance

If you are familiar with Template:Wikipedia, you might expect that instances of a class inherit the statements of a class. This is generally not the case. For example just because Template:Statement and Template:Statement does not mean that Template:Statement. However there are some properties that are likely to be inherited:</translate>

<translate> Property</translate> <translate> Inverse property</translate>
Template:P Template:P
Template:P <translate> none</translate>
Template:P Template:P
Template:P Template:P

<translate> For example Template:Statement and Template:Statement can be used to correctly infer Template:Statement.</translate>

<translate> When attempting to make such inferences don't forget to take ranks, {{<tvar name="1">ll|#restrictiveness-of-qualifiers</tvar>|restrictive qualifiers}} and negation into account, as explained in <tvar name="2">Template:Ll</tvar>.</translate>

<translate>

Does a statement apply?

The following is an attempt at outlining a strategy to decide whether a particular statement applies to a given entity:</translate>

  1. <translate> Statements {{<tvar name="1">ll|Help:Deprecation</tvar>|ranked as deprecated}} have been superseded and therefore no longer apply.</translate>
  2. <translate> Statements with a <tvar name="1">Template:Ll</tvar> only apply with regards to the respective qualifier.</translate>
  3. <translate> Statements of certain properties are likely to be inherited (see <tvar name="1">Template:Ll</tvar>). Note however that instances or intermediary classes may negate statements inherited from a parent class, as described in <tvar name="2">Template:Ll</tvar>.</translate>

<translate>

Reflexive statements

Template:Statement has unclear semantics if A is a class, it could mean:</translate>

  1. <translate> an instance of A has a relation P to another instance of A (which may or may not be the same instance)</translate>
  2. <translate> an instance of A has a relation P to a different instance of A (which cannot be the same instance)</translate>
  3. <translate> an instance of A has a relation P to itself</translate>

<translate> See Template:Pps for a proposal to introduce a qualifier property to differentiate these cases.</translate>

<translate>

Format string properties

Wikidata has several format string properties, such as Template:P, Template:P and Template:P. </translate>

<translate> The formatting mechanism of these properties and what kind of values they produce is currently not stated in a machine-readable manner, however that might change with the introduction of the proposed Template:Pps properties.</translate>

<translate>

Property constraints

Wikidata employs {{<tvar name="1">ll|Help:Property constraints portal</tvar>|property constraints}} to combat property misuse. Property constraints are implemented by [[<tvar name="2">mw:Special:MyLanguage/Extension:WikibaseQualityConstraints</tvar>|Extension:WikibaseQualityConstraints]] and are stated on properties via Template:P since 2017.</translate> [3] <translate> The violation of such property constraints is directly displayed in the Wikidata user interface.</translate>

<translate> More complex property constraints can be implemented as {{<tvar name="1">ll|Wikidata:SPARQL query service</tvar>|SPARQL}} queries and placed with Template:Tl on property talk pages. The violation of such complex constraints is periodically reported by a bot on pages within the Category:Complex constraint violation reports category. </translate>

<translate> For more information about property constraints, please refer to {{<tvar name="1">ll|Help:Property constraints portal</tvar>|the help portal}} and the [[<tvar name="2">Special:MyLanguage/Wikidata:WikiProject property constraints</tvar>|property constraints WikiProject]].</translate>

<translate>

Topic-specific data models

Wikidata covers many topics, such as art, biology, countries, cities, monuments, movies, people, software, websites, writings, etc. All entities of these topics that are {{<tvar name="1">ll|Wikidata:Notability</tvar>|notable}} somehow need to be represented as {{<tvar name="2">ll|#item</tvar>|data items}} with {{<tvar name="3">ll|#statement</tvar>|statements}}. So which statements should be made for a specific entity type and which properties should be used for these statements? The answers to these questions are subject to the topic-specific data model that should be used for the specific topic. So, which data model should be used for a given topic? That is decided collaboratively by the Wikidata community through public discussion. The discussions and efforts about a specific topic in Wikidata are organized via {{<tvar name="4">ll|Wikidata:WikiProjects</tvar>|WikiProjects}}. </translate>

<translate> Where can you find topic-specific data models?</translate>

Template:Ll can be found in the {{<tvar name="1">ll|Wikidata:Database reports/EntitySchema directory</tvar>|EntitySchema directory}}, e.g. Template:E </translate>

<translate>

Entity schemas

An alternative approach to property constraints is using the Template:Wikipedia data modelling language. For Wikidata such schemas can be stored within the EntitySchema:* namespace on the wikidata.org wiki (which is enabled by the [[<tvar name="1">mw:Special:MyLanguage/Extension:EntitySchema</tvar>|EntitySchema]] MediaWiki extension). Note that the effort to establish such schemas for Wikidata is very much ongoing: the [[<tvar name="2">Wikidata:Property proposal/Shape Expression for class</tvar>|Shape Expression for class]] property proposal is currently on hold because the EntitySchema data type is not yet implemented.</translate>[5]

<translate> For more information about Wikidata Schemas, please refer to the [[<tvar name ="1">Special:MyLanguage/Wikidata:WikiProject Schemas</tvar>|Schemas WikiProject]].</translate>

<translate>

See also

  • {{<tvar name="1">ll|Wikidata:Topics/Wikidata</tvar>|Wikidata in Wikidata}}
  • <tvar name="2">Template:Ll</tvar>
  • <tvar name="3">Template:Ll</tvar>

</translate>

<translate>

References

</translate>

  1. <translate> Items can have labels, descriptions, aliases and sitelinks, statements have a rank and can have qualifiers and references, and values can also be specified as no value or unknown value.</translate>
  2. <translate> [[<tvar name="1">phab:T173432</tvar>|Phabricator task T173432: Sort claims of a property in meaningful way]]</translate>
  3. <translate> [[<tvar name="1">phab:T102759</tvar>|Phabricator task T102759: Migrate constraints from property talk pages to statements on properties]]</translate>
  4. <translate> it is possible that such variety will be standardized in the future</translate>
  5. <translate> [[<tvar name="1">phab:T214884</tvar>|Phabricator task T214884: linking Schemas in statements]]</translate>

Template:Translation categories [[Category:Wikidata{{#translation:}}]]