Modelling: Difference between revisions
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Modelling navigation}} | |||
==Basic ontology== | ==Basic ontology== | ||
On the top of the Metabase ontology is the following item: | On the top of the Metabase ontology is the following item: | ||
Line 38: | Line 39: | ||
For example: {{P|P9}}, {{P|13}}, {{P|10}}. | For example: {{P|P9}}, {{P|13}}, {{P|10}}. | ||
====Temporary free text fields==== | |||
Occasionally, we might need to temporarily store a piece of information in free text format, e.g. if we're unsure what item to use or if it does not exist yet. | |||
We use the property {{P|P38}} for this. It should be accompanied by the qualifier {{P|P41}} that states what property should replace it. | |||
Compare the property [https://www.wikidata.org/wiki/Property:P2093|Author name string] on Wikidata. | |||
====SPARQL==== | |||
Query to find all internal properties: | Query to find all internal properties: | ||
<SPARQL tryit="1"> | <SPARQL tryit="1"> | ||
Line 53: | Line 62: | ||
} | } | ||
</SPARQL> | </SPARQL> | ||
Query to find all temporary free text fields: | |||
<SPARQL tryit="1"> | |||
PREFIX wb: <https://metabase.wikibase.cloud/entity/> | |||
PREFIX wbt: <https://metabase.wikibase.cloud/prop/direct/> | |||
PREFIX wbp: <https://metabase.wikibase.cloud/prop/> | |||
PREFIX wbpq: <https://metabase.wikibase.cloud/prop/qualifier/> | |||
SELECT DISTINCT ?item ?itemLabel ?val ?qual ?qualLabel | |||
WHERE | |||
{ | |||
?item wbt:P38 ?val. | |||
OPTIONAL {?item wbp:P38 ?statement. | |||
?statement wbpq:P41 ?qual .} | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en". } | |||
} | |||
</SPARQL> | |||
==Metabase vs. Wikidata== | ==Metabase vs. Wikidata== | ||
As we do not aim to duplicate the information on Wikidata, there's a number of item types that '''only''' contain a Wikidata QID, using {{P|P1}}. These are: | As we do not aim to duplicate the information on Wikidata, there's a number of item types that '''only''' contain a Wikidata QID, using {{P|P1}}. These are: | ||
* {{Q|Q8}} and {{Q|Q40}} | * {{Q|Q8}} and {{Q|Q40}} | ||
** Example: {{Q|Q51}} | |||
* {{Q|Q12}} | * {{Q|Q12}} | ||
** Example: {{Q|Q39}} | |||
* {{Q|Q13}} | * {{Q|Q13}} | ||
** Example: {{Q|Q50}} | |||
* {{Q|Q22}} | * {{Q|Q22}} | ||
** Example: {{Q|Q26}} | |||
* {{Q|Q23}} | * {{Q|Q23}} | ||
** Example: {{Q|Q85}} | |||
* {{Q|Q66}} | * {{Q|Q66}} | ||
** Example: {{Q|Q83}} | |||
By using [[:mw:Wikibase/Federation|federated queries]], we can still access information about these types of entities from Wikidata, without hosting the data ourselves. | By using [[:mw:Wikibase/Federation|federated queries]], we can still access information about these types of entities from Wikidata, without hosting the data ourselves. | ||
Line 85: | Line 118: | ||
* '''Organizations''' | * '''Organizations''' | ||
** If not on Wikidata, consider if it might anyway be relevant for Wikidata. | ** If not on Wikidata, consider if it might anyway be relevant for Wikidata and create an item there first! | ||
* '''Locations''' | ** If it's '''not notable for Wikidata''', you can still create an item in Metabase. In this case, it's acceptable to add more information (like {{P|P78}} or {{P|P17}}) to make it easier for other users to understand what it is. Make sure there's a good Label and Description as well. Example: {{Q|Q23587}}. | ||
* '''Locations''' | |||
** It is enough to stay at a town level of granularity, e.g. {{Q|Q78}} rather than ''Norrsken House''. This is enough to get an insight about the geographical spread of activities. | |||
* '''Humans''' | * '''Humans''' | ||
** If not on Wikidata, see [[Modelling/Humans|humans]] for allowed modelling. | ** If not on Wikidata, see [[Modelling/Humans|humans]] for allowed modelling. | ||
Line 102: | Line 137: | ||
===Documents=== | ===Documents=== | ||
See the following: | |||
* [[Modelling/Documents|Modelling of documents in Metabase]] | |||
* Document [[EntitySchema:E4|entity schema]] and [https://metabase.wikibase.cloud/tools/cradle/?#/shex/E4 Cradle] | |||
===Activities and events=== | ===Activities and events=== | ||
See the following: | |||
* [[Modelling/Events and activities|Modelling of events in Metabase]] | |||
* Event [[EntitySchema:E5|entity schema]] and [https://metabase.wikibase.cloud/tools/cradle/?#/shex/E5 Cradle] | |||
==See also== | |||
* Since wikibase.cloud does not support [https://www.mediawiki.org/wiki/Extension:WikibaseQualityConstraints Constraints], these are instead listed on [[Template:Rules|Rules]] and displayed on the talk page of the concerned Properties and items. | |||
[[Category:Documentation]] | [[Category:Documentation|*]] |
Latest revision as of 12:27, 20 August 2024
Basic ontology
On the top of the Metabase ontology is the following item:
Which has the immediate sub-item:
Query to find all items that are instance of (P5) or one or the other:
PREFIX wd: <https://metabase.wikibase.cloud/entity/>
PREFIX wdt: <https://metabase.wikibase.cloud/prop/direct/>
SELECT ?item ?wikidata_iri ?itemLabelEN ?itemLabelSV ?itemDescEN ?itemDescSV
WHERE
{
{?item wdt:P5 wd:Q3.}
UNION
{?item wdt:P5 wd:Q10.}
OPTIONAL {?item wdt:P1 ?wikidataQ}
BIND(URI(concat("http://www.wikidata.org/entity/", ?wikidataQ)) AS ?wikidata_iri)
OPTIONAL {?item rdfs:label ?itemLabelEN filter (lang(?itemLabelEN) = "en")}.
OPTIONAL {?item rdfs:label ?itemLabelSV filter (lang(?itemLabelSV) = "sv")}.
OPTIONAL {?item schema:description ?itemDescEN filter (lang(?itemDescEN) = "en")}.
OPTIONAL {?item schema:description ?itemDescSV filter (lang(?itemDescSV) = "sv")}.
}
Properties
Whenever possible, we aim to create properties whose scope duplicates that of properties in Wikidata. By using same as on Wikidata (P1), we then link to the equivalent Wikidata property. This lowers the threshold for Wikidata editors to start participating.
For example: organizer (P14), language of work or name (P20), number of participants (P28).
Metabase internal properties
We sometimes have a need for properties that do not have direct equivalents on Wikidata. For example when we need to describe the activities of the Wikimedia movement in more detail than what's relevant for Wikidata.
These properties shall have instance of (P5) → Metabase internal property (Q24).
For example: WMSE project ID (P9), Wikimedia platform(s) affected (P13), sorted under programmatic area (P10).
Temporary free text fields
Occasionally, we might need to temporarily store a piece of information in free text format, e.g. if we're unsure what item to use or if it does not exist yet.
We use the property temporary free text field (P38) for this. It should be accompanied by the qualifier replaced by property (P41) that states what property should replace it.
Compare the property name string on Wikidata.
SPARQL
Query to find all internal properties:
PREFIX wd: <https://metabase.wikibase.cloud/entity/>
PREFIX wdt: <https://metabase.wikibase.cloud/prop/direct/>
SELECT ?item ?itemLabelEN ?itemLabelSV ?itemDescEN ?itemDescSV
WHERE
{
?item wdt:P5 wd:Q24.
OPTIONAL {?item rdfs:label ?itemLabelEN filter (lang(?itemLabelEN) = "en")}.
OPTIONAL {?item rdfs:label ?itemLabelSV filter (lang(?itemLabelSV) = "sv")}.
OPTIONAL {?item schema:description ?itemDescEN filter (lang(?itemDescEN) = "en")}.
OPTIONAL {?item schema:description ?itemDescSV filter (lang(?itemDescSV) = "sv")}.
}
Query to find all temporary free text fields:
PREFIX wb: <https://metabase.wikibase.cloud/entity/>
PREFIX wbt: <https://metabase.wikibase.cloud/prop/direct/>
PREFIX wbp: <https://metabase.wikibase.cloud/prop/>
PREFIX wbpq: <https://metabase.wikibase.cloud/prop/qualifier/>
SELECT DISTINCT ?item ?itemLabel ?val ?qual ?qualLabel
WHERE
{
?item wbt:P38 ?val.
OPTIONAL {?item wbp:P38 ?statement.
?statement wbpq:P41 ?qual .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en". }
}
Metabase vs. Wikidata
As we do not aim to duplicate the information on Wikidata, there's a number of item types that only contain a Wikidata QID, using same as on Wikidata (P1). These are:
- activity (Q8) and event (Q40)
- Example: annual general meeting (Q51)
- index term (Q12)
- Example: public art (Q39)
- organization (Q13)
- Example: Wikimedia Foundation (Q50)
- Wikimedia content project (Q22)
- Example: Swedish Wikipedia (Q26)
- human (Q23)
- Example: Josefine Hellroth Larsson (Q85)
- location (Q66)
- Example: Linköping (Q83)
By using federated queries, we can still access information about these types of entities from Wikidata, without hosting the data ourselves.
See some examples of federated queries.
Index terms
An index term (Q12) is a keyword that we use to describe e.g. the topic of a document or the focus area of a project.
For example: museum collection (Q18), public art (Q39), authority control (Q17).
Organizations
An organization (Q13) could be a Wikimedia chapter, a GLAM or any other organized social entity.
For example: Wikimedia Foundation (Q50), Wikimedia Sverige (Q9), Nationalmuseum (Q15).
Humans
We only create items about people when these are needed to describe authorship/speaker/event or project responsibility. And only when this information is already publicly available, any affiliation would also need to have been publicly communicated. Since the main affiliation might not always apply, it can be superseded by a qualifier on an item-by-item basis.
For example: Alicia Fagerving (Q46), André Costa (Q30).
Item types primarily offloaded on Wikidata
For the following item types we expect little or no information on Metabase. Required are only same as on Wikidata (P1) and instance of (P5) if they exist on Wikidata.
- Organizations
- If not on Wikidata, consider if it might anyway be relevant for Wikidata and create an item there first!
- If it's not notable for Wikidata, you can still create an item in Metabase. In this case, it's acceptable to add more information (like official website (P78) or part of (P17)) to make it easier for other users to understand what it is. Make sure there's a good Label and Description as well. Example: Education Policy Center (Q23587).
- Locations
- It is enough to stay at a town level of granularity, e.g. Stockholm (Q78) rather than Norrsken House. This is enough to get an insight about the geographical spread of activities.
- Humans
- If not on Wikidata, see humans for allowed modelling.
Metabase-specific items
Projects
A project could be:
- a formal one officially implemented by an organization (a Wikimedia chapter, a GLAM, or other)
- an informal one implemented by a self-organized group (such as participants in a Wikiproject), or an individual (a volunteer Wikimedian)
See the following:
- Modelling of projects in Metabase
- Generic project entity schema and Cradle
- Wikimedia Sverige project entity schema and Cradle
Documents
See the following:
- Modelling of documents in Metabase
- Document entity schema and Cradle
Activities and events
See the following:
See also
- Since wikibase.cloud does not support Constraints, these are instead listed on Rules and displayed on the talk page of the concerned Properties and items.