Changes

Jump to navigation Jump to search
6,818 bytes added ,  11:07, 1 September 2021
Line 1: Line 1:  +
[[Category:Global Taxonomies]]
   −
== Introduction ==
+
'''Open Food Facts''' uses '''global taxonomies''' for fields such as '''categories''', '''brands''', '''labels''' and '''countries'''. This page explains how taxonomies work in Open Food Facts and how they can be updated and enhanced.
   −
Open Food Facts uses global taxonomies for fields such as categories, brands, labels and countries. This page explains how taxonomies work in Open Food Facts and how they can be updated and enhanced.
+
== Quick presentation ==
 +
[https://docs.google.com/presentation/d/1zL2fA3d_fuPvKKKmCGJ5aV_Ug-R-gXQbwSCcxf3dbo4/edit?usp=sharing Quick presentation of the taxonomies]
    
== Features ==
 
== Features ==
Line 13: Line 15:  
== Generalities ==
 
== Generalities ==
    +
=== Taxonomy term ===
 +
A taxonomy term is the main object of a taxonomy. Its simple form is the term itself with its language as a prefix. Example: <code>en:Authentic Trappist Product</code> is a term in the labels' taxonomy.
 +
 +
==== Languages ====
 
Each language has a 2-letter prefix. e.g. "en" for English and "fr" for French.
 
Each language has a 2-letter prefix. e.g. "en" for English and "fr" for French.
    
Whenever possible, the canonical language for each field value should be English. e.g. en:soups is the canonical value for the Soups category.
 
Whenever possible, the canonical language for each field value should be English. e.g. en:soups is the canonical value for the Soups category.
A value can be defined in another language (which becomes the canonical language), e.g. fr:soupes-a-l-oignon could be the canonical value for "Onion Soups" if we don't have an English tranlsation yet. Before December 2013, the taxonomies were defined for each language, with most definitions for French, but English translations will be added progressively.
+
A value can be defined in another language (which becomes the canonical language), e.g. <code>fr:soupes-a-l-oignon</code> could be the canonical value for "Onion Soups" if we don't have an English translation yet.
    
New values (e.g. categories that do not exist yet) should have an English canonical value.
 
New values (e.g. categories that do not exist yet) should have an English canonical value.
Line 24: Line 30:  
When a field value needs to be translated to a target language, if the translation does not exist yet, English is shown (or the canonical language if the English translation does not exist either).
 
When a field value needs to be translated to a target language, if the translation does not exist yet, English is shown (or the canonical language if the English translation does not exist either).
    +
===== Remarks =====
 +
* Which standard is used for the codes?  It can be the [https://en.wikipedia.org/wiki/ISO_639-1 ISO-639-1] standard, eventually this can be extended the 3-letter codes.
 +
 +
==== Singular or plural? ====
 +
Generally, we use the plural for categories but some of them are in singular. We don't put the plural form when it has a different meaning. For example Beef and Beefs. We are talking of the meat and not the animal, so there is no "s". But "Rillettes" in french (and others languages) doesn't have a singular form.
 +
 +
Sometimes plural or singular depends on the language. The situation for dutch is described in [[Dutch translation issues]].
 +
 +
If the category is in plural form, the translations should be in the plural form.
 +
 +
<pre>
 +
@stephane new proposal (not yet adopted, to be discussed)
 +
In the categories taxonomy, always use the plural (en:beers, fr:bières).
 +
Then add the singular (especially if it's not a simple rule like removing the final s) in a property:
 +
singular:en:beer
 +
singular:fr:bière
 +
For the ingredients taxonomy, do the reverse:
 +
always use the singular for the main entry, and then add the plural:
 +
en:tomato
 +
plural:en:tomatoes
 +
</pre>
 +
 +
=== Synonyms ===
 
In each language, each value can have a number of synonyms.
 
In each language, each value can have a number of synonyms.
    
Simple synonyms (simple singular) are done automatically when possible.
 
Simple synonyms (simple singular) are done automatically when possible.
   −
Synonyms are recursive: if en:yoghurt is a synonym of en:yogurt, then en:banana_yoghurt will automatically be added as a synonym of en:banana_yogurt
+
Synonyms are recursive: if <code>en:yoghurt</code> is a synonym of <code>en:yogurt</code>, then <code>en:banana_yoghurt</code> will automatically be added as a synonym of <code>en:banana_yogurt</code>.
 +
 
 +
==== Remarks ====
 +
* What are the simple synonym rules? How does translate to other languages?
 +
* Not that recursion does not work for languages, where the adjectives change based on gender.
    +
=== Stopwords ===
 
Stopwords can be used to further extend synonyms. e.g. if "à" and "la" are stopwords for French, then "Yaourts fraise" will automatically be mapped to "Yaourts à la fraise".
 
Stopwords can be used to further extend synonyms. e.g. if "à" and "la" are stopwords for French, then "Yaourts fraise" will automatically be mapped to "Yaourts à la fraise".
    +
In the ingredients taxonomy, stopwords are also words that can be ignored. For instance ''contains'' is not an ingredient.
 +
 +
=== Description ===
 +
The <code>description:</code> prefix allows to describe the term. Example:
 +
en:Fair trade
 +
description:en:Fair trade is an arrangement designed to help producers in developing countries achieve sustainable and equitable trade relationships. Members of the fair trade movement add the payment of higher prices to exporters, as well as improved social and environmental standards.
 +
The description is reused on Open Food Facts website. Example: https://world.openfoodfacts.org/label/fair-trade
 +
 +
=== Image (logo) ===
 +
The <code>image:</code> prefix allows to add an image/logo related to the term.
 +
<en:Organic
 +
en:Bio Austria
 +
de:Bio Austria
 +
country:en:Austria
 +
image:en:bio-austria.67x90.svg
 +
The description is reused on Open Food Facts website. Example: https://world.openfoodfacts.org/label/bio-austria
 +
 +
=== Wikidata ===
 +
The <code>wikidata:</code> prefix allows to link the term with its equivalent on Wikidata database. Example:
 +
fr:Label Rouge
 +
xx:Label Rouge
 +
wikidata:en:Q3214309
 +
The description is reused on Open Food Facts website. Example: https://world.openfoodfacts.org/label/label-rouge
 +
 +
=== Opposite ===
 +
"we use "opposite" for imports (e.g. when there is a column "Organic" with values like "No")
 +
 +
en:Non-fair trade, Not fair trade
 +
 +
fr:Non issu du commerce équitable
 +
 +
opposite:en: en:fair-trade"
 +
 +
=== Wikipedia ===
 +
The <code>wikipedia:</code> prefix allows to link the term with its equivalent on Wikipedia. Example:
 +
<en:Fair trade
 +
en:Fairtrade USA
 +
xx:Fairtrade USA
 +
wikipedia:en:<nowiki>https://en.wikipedia.org/wiki/Fair_Trade_USA</nowiki>
 +
The wikipedia: property is not reused on Open Food Facts website.
 +
 +
=== Unused properties ===
 +
Some people have added more properties in the different taxonomies. They are not used for the moment, but they can lead to interesting usages:
 +
 +
* give more information for the contributor who is editing the taxonomy
 +
* prepare new usages or features
 +
 +
Here is a list of properties already used in the taxonomies:
 +
 +
* wikipedia:
 +
* country:
 +
* label_categories:
 +
* eu_groups:
 +
* auth_name:
 +
* auth_address:
 +
* auth_url:
 +
* exceptions:
 +
 +
=== Taxonomy architecture ===
 
The taxonomy is not a strict hierarchy: values can have multiple parents. But cycles are not allowed.
 
The taxonomy is not a strict hierarchy: values can have multiple parents. But cycles are not allowed.
 +
 +
=== Finding new opportunities for taxonomization ===
 +
* A good trick to find candidates for taxonomization is
 +
  * https://world.openfoodfacts.org/categories?filter=-
 +
  * https://world.openfoodfacts.org/labels?filter=-
 +
  * https://world.openfoodfacts.org/origins?filter=-
 +
  * https://world.openfoodfacts.org/ingredients?filter=-
 +
* Everything in italics is up for grabs
    
== Format ==
 
== Format ==
Line 68: Line 169:  
</pre>
 
</pre>
   −
== Taxonomies ==
+
== List of taxonomies ==
   −
The definitions can be edited on this wiki, they are periodically synchronized on the Open Food Facts database and web site.
+
The definitions can be edited on [https://github.com/openfoodfacts/openfoodfacts-server/tree/master/taxonomies GitHub], they are periodically synchronized on the Open Food Facts database and web site.
    
=== Taxonomies ===
 
=== Taxonomies ===
 
+
'''(on Github, account and VCS knowledge needed)'''
* [[Test taxonomy]] showing the basic taxonomy definition features
+
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/test.txt Test taxonomy] showing the basic taxonomy definition features
* [[Global categories taxonomy]]
+
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/ingredients.txt Ingredients taxonomy]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/categories.txt Global categories taxonomy]
 
* [[Global brands and companies taxonomy]]
 
* [[Global brands and companies taxonomy]]
* [[Global labels taxonomy]]
+
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/labels.txt Global labels taxonomy]
* [[Global countries taxonomy]]
+
* [[Global labels taxonomy logos]]
* [[Global additives taxonomy]]
+
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/languages.txt Global languages taxonomy]
* [[Global allergens taxonomy]]
+
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/countries.txt Global countries taxonomy]
* [[Global states taxonomy]]
+
* [[Global origins taxonomy]]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/additives.txt Global additives taxonomy]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/additives_classes.txt Global additives classes taxonomy]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/vitamins.txt Global vitamins taxonomy]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/minerals.txt Global minerals taxonomy]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/amino_acids.txt Global amino acids taxonomy]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/nucleotides.txt Global nucleotides taxonomy]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/other_nutritional_substances.txt Global other nutritional substances taxonomy]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/allergens.txt Global allergens taxonomy]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/states.txt Global states taxonomy]
 +
* [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/nova_groups.txt Global NOVA groups taxonomy]
    
=== Draft Taxonomies ===
 
=== Draft Taxonomies ===
* [[Packaging_taxonomy]]
+
* [[Global packaging taxonomy]]
 +
* [[Global stores taxonomy]]
 
* [[Global Religious Certification taxonomy]]
 
* [[Global Religious Certification taxonomy]]
* [[Food_Preparation_taxonomy]] (related to [[Project:Microwave]])
+
* [[Global Food Preparation taxonomy]] (related to [[Project:Microwave]])
 +
* [[Global IGP taxonomy]]
 +
* [[Global EC marks taxonomy]]
 +
 
 +
== Building and deploying taxonomies ==
 +
 
 +
Changes to taxonomies on GitHub are not deployed instantly, the need to be built, deployed, and products need to be re-processed with the new taxonomy.
 +
 
 +
* [[How to build and deploy taxonomies]]
 +
 
 +
== More info ==
 +
For detailed information specific for the ingredients taxonomy see [[Project:Ingredients ontology|Ingredients Ontology]].

Navigation menu