RDF

From Open Food Facts wiki
Jump to navigation Jump to search

We started to "play" with the OFF data to see how to express them in RDF.

The data on ingredients and nutrients are described by an ontology food that we are creating with François Scharffe of the Laboratory of Informatics, Robotics and Microelectronics of Montpellier LIRMM and Emmanuel Nauer of the Lorraine Laboratory of Research in Computer Science and its LORIA applications. The idea is to use the same vocabulary to describe a recipe (like those used by the project Taaable in which Emmanuel participates), or a manufactured food product.

The RDF export is here: http://en.openfoodfacts.org/data/en.openfoodfacts.org.products.rdf (in XML / RDF)

And it is referenced on The Data Hub to facilitate the discovery of the Open Food Facts dataset.

The ingredients are parsed from the list of ingredients in text.

The product and ingredient URLs currently return the HTML webpage, but I'm going to add the content negotiation to return the RDF.

François generated equivalences between the Open Food Facts ingredients and the same ingredients on DBPedia. They are indicated by the owl: sameAs property, for example:

<food:name>Sorbate de potassium</food:name>
<owl:sameAs rdf:resource="http://fr.dbpedia.org/resource/Sorbate_de_potassium"/>
</rdf:Description>

There is currently no SPARQL endpoint. You can instead load the RDF export into a tool like Datalift to execute SPARQL queries. As an example, here is one of my first queries (to find products whose main ingredient is sugar):

PREFIX food: <http://data.lirmm.fr/ontologies/food#>
SELECT ?s ?code WHERE {
   ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> food:FoodProduct .
   ?s food:containsIngredient ?i .
   ?i food:food <http://fr.openfoodfacts.org/ingredient/sucre> .
   ?i food:rank "1"
   OPTIONAL { ?s food:code ?code } .
}

This is of course a work in progress, there is still a lot of data missing in the RDF export (brands, categories etc.). They will be added gradually.

Your ideas, comments, suggestions etc. are welcome to improve these data, better link them, better represent them etc. Moreover if you use the data, it would be nice to tell us. Thank you in advance !