Adding a DBpedia Mapping

Table of Contents

Intro

Outline

Show practical steps to add a mapping:

  1. Preparation
  2. Find a template to map
  3. Generate blank mapping with Chrome plugin
  4. Explore the meaining of each property from the template definition
  5. Pick appropriate ontology properties
  6. Create missing properties
  7. Clean up (or post as issues) any problems you find along the way
  8. Test the mapping

Prepare for Mapping

To work more easily with the mapping wiki info, install some addons

  • CopyURL Chrome Plugin
    • Many URLs in dbpedia are International Resource Identifiers (IRIs)
    • When you copy from the browser's address bar, an IRI is URL-encoded
    • Unreadable ugliness like
      http://bg.dbpedia.org/resource/%D0%9A%D0%BE%D0%BD%D1%81%D1%82%D0%B0%D0%BD%D1%82%D0%B8%D0%BD%D0%B0_%D0%96%D0%B8%D0%B2%D0%BE%D0%B2%D0%B0
      
    • Instead, this plugin allows you to copy & paste IRIs like http://bg.dbpedia.org/resource/Константина_Живова
    • These are readable and allow other editors to see what they represent: it's editorial policy
  • mappings_chrome_extension
    • generates blank mappings by analyzing which template properties are used
    • Download the extension
    • Go to chrome://extensions, enable "Developer mode"
    • "Load unpacked extension" and point to the extension folder
    • Note: mapping-tool is a GUI mapping tool.
    • Potentially much more useful, but is 4y old and I haven't tried it

Prepare for Mapping (2)

Text Editor Anywhere

  • This is a Windows program (not Chrome plugin) that allows you to edit web text with your favorite editor.
  • Map editing may involve significant text operations, so I use this all the time with Emacs
  • It creates a temp file, calls your editor, watches the file for changes, and pastes back into the browser text box
  • You can save the file with your editor many times before you finish
  • This is better than the other similar programs ("edit servers") I've tried

Find Template to Map

mapping-stats.png

Start a Blank Mapping

{{TemplateMapping | mapToClass = 
| mappings = 
        !-- {{ PropertyMapping | templateProperty = imdb | ontologyProperty = }} --
        !-- {{ PropertyMapping | templateProperty = Име | ontologyProperty = }} --

Search for Properties

  • so we first need to map "imdb" (International Movie DataBase id)
  • we search for "imdb" on the mapping wiki. We don't find a property directly
  • then we search for "imdb*" and find the property imdbId: that's the one we need
  • however, it has rdfs:domain = Film while we're mapping a Model, which is a Person
  • So we remove rdfs:domain and replace it with a comment (see the diff):
    |comments=
    {{comment|en|International Movie Database ID. Applies to Films, Actors, etc}}
    

Add A Property

There are a few props we need to add, eg zodiacSign, skinColor

  • We check Wikipedia or Google for the right name, and find that it applies not only to People but also to Planets
  • Go directly to http://mappings.dbpedia.org/index.php?title=OntologyProperty:ZodiacSign&action=edit
  • Entering the prop info is best done from a template
  • We also check the use of this prop in wikipedia and find out that it links to pages, eg [[Телец]] (Taurus). So we need an ObjectProperty
  • Entering an appropriate comment is mandatory: describe the usage in detail:
    {{ObjectProperty
      | labels =
      {{label|en|zodiac sign}}
      |comments=
      {{comment|en|Zodiac Sign. Applies to persons, planets, etc}}
    }}
    

Add a Tracking Issue

Looking for "shoe size", we find two duplicate properties. showSize is the proper English term, so we choose to remove showNumber

Describe the Problem

  • Go to the Discussion tab of the shoeNumber property
  • Add a description of the problem:
    * Duplicate of shoeSize (which is the proper English term).
    * Also, xsd:integer is not appropriate, xsd:string is better.
    * So: delete and replace all usages with shoeSize.
    
    https://github.com/dbpedia/mappings-tracker/issues/34
    --~~~~
    
  • Paste the new issue link that you just created. This way the issue and prop are inter-linked
  • Sign your submission! The –~~~~ at the end is converted to the datetime and your name

Add Another Property

The "vital stats" for a Model include height, weight, eyeColor, hairColor, skinColor, shoeSize, zodiacSign, bustSize (but of course!), waistSize, hipSize

  • enwiki and jawiki have fields bustSize, waistSize, hipSize
    • (An app to sort models by these measures would surely be a commercial success :-)
  • bgwiki uses a composite field bust-waist-hip size (мерки: бюст-талия-ханш)
  • So I made a new composite property, describing in detail its usage vs the 3 separate properties (rdfs:comment):
    {{DatatypeProperty
     |rdfs:label@en=bust-waist-hip Size
     |rdfs:label@bg=размер бюст-талия-ханш
     |rdfs:domain=Person
     |rdfs:range=xsd:string
     |rdfs:comment@en=Use this property if all 3 sizes are given together
       (DBpedia cannot currently extract 3 Lengths out of a field).
       Otherwise use separate fields bustSize, waistSize, hipSize
    }}
    
  • Also made enh req #325 extract several Lengths out of a field
  • Finally, I linked the issue to the property, by putting this in the property's Discussion page: "If #325 is implemented, this should be deleted in favor of 3 separate fields"

Completed Mapping

Move any unmapped props to the end, in a comment !-- ... --

{{TemplateMapping | mapToClass = Model
| mappings = 
  {{ PropertyMapping | templateProperty = imdb | ontologyProperty = imdbId }}
  {{ PropertyMapping | templateProperty = Име | ontologyProperty = foaf:name }}
  {{ PropertyMapping | templateProperty = дата на смърт | ontologyProperty = deathDate }}
  {{ PropertyMapping | templateProperty = дейности | ontologyProperty = occupation}}
  ....
  {{ PropertyMapping | templateProperty = цвят на кожа | ontologyProperty = skinColor }}
  {{ PropertyMapping | templateProperty = цвят на коса | ontologyProperty = hairColor }}
  {{ PropertyMapping | templateProperty = цвят на очи | ontologyProperty = eyeColor }}
}}

!-- NOT YET MAPPED
  {{ PropertyMapping | templateProperty = категория | ontologyProperty = }}
  {{ PropertyMapping | templateProperty = филми | ontologyProperty = }} dbo:film has domain FilmFestival
--

Test the Mapping

Date: <2015-02-09>

Author: Vladimir Alexiev

Created: 2015-02-09 Mon 14:49

Emacs 25.0.50.1 (Org mode 8.2.7c)

Validate