Wikidata and DBpedia Fr

The integration of a part of Wikidata into DBpedia Fr is one of the particularities of the last French release. We are hosting data related to the extraction process made by the DBpedia association

As you understood in the article dedicated to the structure of DBpedia Fr, these data are available in the following graphs :

  • http://fr.dbpedia.org/graph/dbpedia_wikidata_description
  • http://fr.dbpedia.org/graph/dbpedia_wikidata_geo-coordinates
  • http://fr.dbpedia.org/graph/dbpedia_wikidata_instance-types
  • http://fr.dbpedia.org/graph/dbpedia_wikidata_labels
  • http://fr.dbpedia.org/graph/dbpedia_wikidata_mappingbased-literals
  • http://fr.dbpedia.org/graph/dbpedia_wikidata_mappingbased-objects-uncleaned
  • http://fr.dbpedia.org/graph/dbpedia_wikidata_ontology-subclassof
  • http://fr.dbpedia.org/graph/dbpedia_wikidata_sameas-all-wikis
  • http://fr.dbpedia.org/graph/dbpedia_wikidata_sameas-external

Remind that the properties of these graph were aligned during the exctraction process (as described here) with the DBpedia ontology properties. This translation is based on the values defined as owl:equivalentProperty in DBpedia wiki (see the example of BNFid here), but also on that mapping file.

Transformations performed

To allow access to Wikidata on the same line as the rest of the DBpedia knowledge, we perform several transformations on them. We illustrate this through the example of the DBpedia Paris resource.

Tagging triples

The graphe <http://fr.dbpedia.org/graph/dbpedia_wikidata_sameas-all-wikis> is listing all the correspondences bteween the Wikidata resource with the DBpedia resources in every chapter, under the shape :

<http://wikidata.dbpedia.org/resource/$ID_WIKIDATA> owl:sameAs <http://$lang.dbpedia.org/resource/$ID_DBPEDIA>


  • For carrying our transformation, we firstly search the triple related to DBpedia Fr resource. We annoted these founded resources with a tag of the class dbo:frResource, which is not existing in the DBpedia ontology. This tag will locally allow us to quickly find all the triple that we need to update in the future.

  • Thus the Dbpedia Fr resource of Paris appears in the named graph as being linked to a Wikidata resource:

    <http://wikidata.dbpedia.org/resource/Q90> owl:sameAs <http://fr.dbpedia.org/resource/Paris>


  • So we have flaged this resource as follow :

    <http://fr.dbpedia.org/resource/Paris> rdf:type dbo:frResource

Subject update

The last step allows us to quickly find the triples we need to translate in all the other named graphs related to Wikidata. So we update all Wikidata subjects with their corresponding DBpedia Fr resource if have one. Let's focus on the graph <http://fr.dbpedia.org/graph/dbpedia_wikidata_mappingbased-objects-uncleaned> :

  • The Wikidata resource of Paris was attached to another resource via the dbo:country property :

    <http://wikidata.dbpedia.org/resource/Q90> dbo:country<http://wikidata.dbpedia.org/resource/Q142>


  • As we know Q90 resource is equivalent to a DBpedia FR resource (Paris), we update this one as follow :

    <http://fr.dbpedia.org/resource/Paris> dbo:country<http://wikidata.dbpedia.org/resource/Q142>

Objects update

Then, we apply that translation in the objects side, by browsing all the Wikidata named graph.

  • The following triple that we have already updated on the subject side during last step in the graph <http://fr.dbpedia.org/graph/dbpedia_wikidata_mappingbased-objects-uncleaned> :

    <http://fr.dbpedia.org/resource/Paris> dbo:country<http://wikidata.dbpedia.org/resource/Q142>
  • Will appears now as related to a DBpedia Fr resource :

    <http://fr.dbpedia.org/resource/Paris> dbo:country<http://fr.dbpedia.org/resource/France>

Inter-language links update

The named graph <http://fr.dbpedia.org/graph/dbpedia_wikidata_sameas-all-wikis> do not contains only the list of the link between Wikidata > DBpedia FR, but also all the links related to other linguistic chapter of DBpedia.
For being able to access them via the DBpedia resource we needed to transform the triple shaped as :

<http://wikidata.dbpedia.org/resource/$ID_WIKIDATA> owl:sameAs <http://$lang.dbpedia.org/resource/$ID_DBPEDIA>

into
<http://fr.dbpedia.org/resource/$ID_DBPEDIA> owl:sameAs <http://$lang.dbpedia.org/resource/$ID_DBPEDIA>


For going back on the Paris example :
  • It exists for example a sameAs link bewteen the Wikidata resource and the DBpedia DE version :
    <http://wikidata.dbpedia.org/resource/Q90> owl:sameAs <http://de.dbpedia.org/resource/Paris>
  • this one will become :
    <http://fr.dbpedia.org/resource/Paris> owl:sameAs <http://de.dbpedia.org/resource/Paris>

The sameAs inversion

We finaly inversed all the relation sameAs linking a Wikidata resources to another DBpedia Fr one in the graph <http://fr.dbpedia.org/graph/dbpedia_wikidata_sameas-all-wikis> :

  • As consequence following the triplet linking Paris in DBpedia Fr to it Wikidata resource :
    <http://wikidata.dbpedia.org/resource/Q90> owl:sameAs <http://fr.dbpedia.org/resource/Paris>
  • Became :
    <http://fr.dbpedia.org/resource/Paris> owl:sameAs <http://wikidata.dbpedia.org/resource/Q90>

Process checks

For understanding better what appends to our Paris resource, you can check the flag of this one with a SPARQL request :

                    
    SELECT ?type FROM <http://fr.dbpedia.org/graph/dbpedia_wikidata_sameas-all-wikis>
    WHERE 
    {
        <http://fr.dbpedia.org/resource/Paris> a    ?type
    }
                    
                

Concerning the inversion of the relations Wikidata > DBpedia Fr, but also the linkage of the other interlingual resources, you can check it with :

                    
    SELECT ?o FROM <http://fr.dbpedia.org/graph/dbpedia_wikidata_sameas-all-wikis>
    WHERE 
    {
        <http://fr.dbpedia.org/resource/Paris> owl:sameAs    ?o
    }
                    
                

Finally you can also check the update of the objects / subjects in the named graphs related to Wikidata (<http://fr.dbpedia.org/graph/dbpedia_wikidata_mappingbased-objects-uncleaned>), let's query the graph. You also free to check it on every graphs given in the list presented in the begining of this article.

                    
SELECT ?p ?o FROM <http://fr.dbpedia.org/graph/dbpedia_wikidata_mappingbased-objects-uncleaned>
WHERE {  <http://fr.dbpedia.org/resource/Paris> ?p    ?o }
                    
                

Consequences

Concretly the transformation process allows you to access to a huge number of informations without using federated query through a unified semantic representation.

                         
SELECT COUNT(DISTINCT(?resource_dbfr)) 
WHERE { ?resource_dbfr rdf:type dbo:frResource }
                
            

As a comparison you can retrieve the total number of resources that DBpedia Fr references, as follows :

                         
SELECT COUNT(DISTINCT(?dbpedia_fr)) as ?nb FROM  <http://fr.dbpedia.org/graph/dbpedia_generic_page>
WHERE { ?dbpedia_fr ?p ?o}
                
            

By looking at the given results you will easily understand the interest of a french linguistic version of DBpedia. Indeed, a lot of entities are not included in Wikidata.

In another hand, you can compute the number of Wikidata entities not referenced into DBpedia Fr (you may have to increase the Execution timeout parameter into the query editor of Virtuoso)

                         
SELECT COUNT(DISTINCT(?wdk)) as ?nb_wdt FROM  <http://fr.dbpedia.org/graph/dbpedia_wikidata_sameas-all-wikis>
WHERE { ?wdk ?p ?o.  FILTER NOT EXISTS {?wdk rdf:type dbo:frResource }}
                
            

The operation offers a large description of DBpedia resources relative to an infobox template not already mapped, or simply incomplete. The Wikidata integration could create duplicates and could create discrepancies but the named graph lets you choose the data source you prefer to enhance. The use of the clause GRAPH as follows returns the origins of a fact :

                
                         
  SELECT ?graph ?o 
  WHERE 
  {
    GRAPH ?graph {
        <http://fr.dbpedia.org/resource/Paris>      dbo:country ?o
    }
  }