-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd-mapping.html
464 lines (439 loc) · 17.7 KB
/
add-mapping.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Adding a DBpedia Mapping</title>
<meta name="author" content="(Vladimir Alexiev)"/>
<meta name="description" content=""/>
<link rel="stylesheet" href="../../reveal.js/css/reveal.min.css"/>
<link rel="stylesheet" href="../../reveal.js/css/theme/solarized.css" id="theme"/>
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '../../reveal.js/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<style type="text/css">
h1,h2,h3,h4,h5,h6,h7 {font-family: Arial}
// don't want empty lines in auto-postamble
.author, .date, .creator {-webkit-margin-before: 0em; -webkit-margin-after: 0em}
// style for #+begin_abstract
.abstract {margin: 1em; padding: 1em; border: 1px solid black}
.abstract:before {content: "Abstract: "; font-weight: bold}
// center the preamble (author name) and make it bigger
#preamble p { font-size: 110%; margin-left: auto; margin-right: auto; text-align: center; }
// table headers aligned same as table data
th.left {text-align:left}
th.right {text-align:right}
// table horizontal&vertical borders. First value is top&bottom, second is left&right. http://www.w3schools.com/css/css_border.asp
th, td {border-width: 1px; border-style: solid solid; border-spacing: 2px 2px; padding:4px 2px}
// colored TODO keywords
.CANCELED {color: blue}
.MAYBE {color: blue}
.POSTPONED {color: blue}
.INPROGRESS {color: orange}
.NEXT {color: orange}
.IER {color: orange}
</style>
<style>
.reveal .slides {text-align:left}
h1,h2,h3,h4,h5,h6,.center {text-align:center}
img,table {display: block; margin-left:auto!important; margin-right:auto!important}
td>img {width:250px; display:block; margin-left:auto!important; margin-right:auto!important; margin-top:0px!important; margin-bottom:0px!important}
.reveal th, .reveal td {font-size:80%; border: 1px; border-style: solid solid; border-spacing:0; padding:0px 2px}
span.clouditem {padding-left: 0.15em; padding-right: 0.15em; line-height: 90%}
#table-of-contents {font-size:70%}
</style>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h2>Adding a DBpedia Mapping</h2><h4>Vladimir Alexiev</h4><h5><a href="mailto:[email protected]">[email protected]</a></h5> <p class='center'><span class="timestamp-wrapper"><span class="timestamp"><2015-02-10></span></span></p></section>
<section id="table-of-contents">
<h2>Table of Contents</h2><ul>
<li>
<a href="#/sec-1">Intro</a>
</li>
<li>
<a href="#/sec-2">Outline</a>
</li>
<li>
<a href="#/sec-3">Prepare for Mapping</a>
</li>
<li>
<a href="#/sec-4">Prepare for Mapping (2)</a>
</li>
<li>
<a href="#/sec-5">Find Template to Map</a>
</li>
<li>
<a href="#/sec-6">Start a Blank Mapping</a>
</li>
<li>
<a href="#/sec-7">Search for Properties</a>
</li>
<li>
<a href="#/sec-8">Add A Property</a>
</li>
<li>
<a href="#/sec-9">Add a Tracking Issue</a>
</li>
<li>
<a href="#/sec-10">Describe the Problem</a>
</li>
<li>
<a href="#/sec-11">Add Another Property</a>
</li>
<li>
<a href="#/sec-12">Completed Mapping</a>
</li>
<li>
<a href="#/sec-13">Test the Mapping</a>
</li>
</ul>
</section>
<section id="sec-1" >
<h2>Intro</h2>
<ul class="org-ul">
<li><a href="./add-mapping-long.html">Single HTML page</a>: easier to read, you can print it, external links don't lose context
</li>
<li><a href="./add-mapping.html">2D interactive presentation</a>: one slide per page, 2D structure
<ul class="org-ul">
<li>"O" for 2D outline, Esc to zoom on selected slide, "H" for help
</li>
<li>Proudly made in plain text with <a href="https://github.com/hakimel/reveal.js/">reveal.js</a>, <a href="https://github.com/yjwen/org-reveal">org-reveal</a>, <a href="http://orgmode.org">org-mode</a>, <a href="http://www.gnu.org/s/emacs/">emacs</a>
</li>
</ul>
</li>
</ul>
</section>
<section id="sec-2" >
<h2>Outline</h2>
<p>
Show practical steps to add a mapping:
</p>
<ol class="org-ol">
<li>Preparation
</li>
<li>Find a template to map
</li>
<li>Generate blank mapping with Chrome plugin
</li>
<li>Explore the meaining of each property from the template definition
</li>
<li>Pick appropriate ontology properties
</li>
<li>Create missing properties
</li>
<li>Clean up (or post as issues) any problems you find along the way
</li>
<li>Test the mapping
</li>
</ol>
</section>
<section id="sec-3" >
<h2>Prepare for Mapping</h2>
<p>
To work more easily with the mapping wiki info, install some addons
</p>
<ul class="org-ul">
<li><a href="https://chrome.google.com/webstore/detail/copy-url/mkhnbhdofgaendegcgbmndipmijhbili">CopyURL</a> Chrome Plugin
<ul class="org-ul">
<li>Many URLs in dbpedia are International Resource Identifiers (IRIs)
</li>
<li>When you copy from the browser's address bar, an IRI is URL-encoded
</li>
<li>Unreadable ugliness like
<pre class="example">
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
</pre>
</li>
<li>Instead, this plugin allows you to copy & paste IRIs like <a href="http://bg.dbpedia.org/resource/Константина_Живова">http://bg.dbpedia.org/resource/Константина_Живова</a>
</li>
<li>These are readable and allow other editors to see what they represent: it's <a href="http://mappings.dbpedia.org/index.php/Main_Page#Copy_IRIs_not_URL-encoded">editorial policy</a>
</li>
</ul>
</li>
<li><a href="https://github.com/dbpedia/mappings_chrome_extension">mappings_chrome_extension</a>
<ul class="org-ul">
<li>generates blank mappings by analyzing which template properties are used
</li>
<li><a href="https://github.com/dbpedia/mappings_chrome_extension/archive/master.zip">Download</a> the extension
</li>
<li>Go to <i>chrome://extensions</i>, enable "Developer mode"
</li>
<li>"Load unpacked extension" and point to the extension folder
</li>
<li>Note: <a href="https://github.com/dbpedia/mapping-tool">mapping-tool</a> is a GUI mapping tool.
</li>
<li>Potentially much more useful, but is 4y old and I haven't tried it
</li>
</ul>
</li>
</ul>
</section>
<section id="sec-4" >
<h2>Prepare for Mapping (2)</h2>
<p>
<a href="http://www.listary.com/text-editor-anywhere">Text Editor Anywhere</a>
</p>
<ul class="org-ul">
<li>This is a Windows program (not Chrome plugin) that allows you to edit web text with your favorite editor.
</li>
<li>Map editing may involve significant text operations, so I use this all the time with Emacs
</li>
<li>It creates a temp file, calls your editor, watches the file for changes, and pastes back into the browser text box
</li>
<li>You can save the file with your editor many times before you finish
</li>
<li>This is better than the other similar programs ("edit servers") I've tried
</li>
</ul>
</section>
<section id="sec-5" >
<h2>Find Template to Map</h2>
<ul class="org-ul">
<li>You can start from a wiki page you like that doesn't have much semantic data
<ul class="org-ul">
<li>eg the Model (mannequin) <a href="http://bg.wikipedia.org/wiki/Константина_Живова">Константина_Живова</a> has <a href="http://bg.dbpedia.org/resource/Константина_Живова">no type</a>
</li>
<li>since the template <a href="https://bg.wikipedia.org/wiki/Шаблон:Манекен_инфо">Манекен_инфо</a> is not yet mapped
</li>
</ul>
</li>
<li>Or browse <a href="http://mappings.dbpedia.org/server/statistics/bg/?show=100000">stats for your language</a>
</li>
</ul>
<img src="./img/mapping-stats.png" alt="mapping-stats.png" />
</section>
<section id="sec-6" >
<h2>Start a Blank Mapping</h2>
<ul class="org-ul">
<li>Click "Edit" on the stats screen, which takes you to <a href="http://mappings.dbpedia.org/index.php?title=Mapping_bg:Манекен_инфо&action=edit">http://mappings.dbpedia.org/index.php?title=Mapping_bg:Манекен_инфо&action=edit</a>
</li>
<li>Or directly start a new mapping by replacing the template URL
<pre class="example">
https://bg.wikipedia.org/wiki/Шаблон:* ->
http://mappings.dbpedia.org/index.php?action=edit&title=Mapping_bg:*
</pre>
</li>
<li>the Chrome plugin makes a blank map for us (hurray!):
</li>
</ul>
<pre class="example">
{{TemplateMapping | mapToClass =
| mappings =
!-- {{ PropertyMapping | templateProperty = imdb | ontologyProperty = }} --
!-- {{ PropertyMapping | templateProperty = Име | ontologyProperty = }} --
</pre>
</section>
<section id="sec-7" >
<h2>Search for Properties</h2>
<ul class="org-ul">
<li>so we first need to map "imdb" (International Movie DataBase id)
</li>
<li>we search for "imdb" on the mapping wiki. We don't find a property directly
</li>
<li>then we search for "imdb*" and find the property imdbId: that's the one we need
</li>
<li>however, it has rdfs:domain = Film while we're mapping a Model, which is a Person
</li>
<li>So we remove rdfs:domain and replace it with a comment (see <a href="http://mappings.dbpedia.org/index.php?title=OntologyProperty:ImdbId&diff=39770&oldid=28299">the diff</a>):
<pre class="example">
|comments=
{{comment|en|International Movie Database ID. Applies to Films, Actors, etc}}
</pre>
</li>
</ul>
</section>
<section id="sec-8" >
<h2>Add A Property</h2>
<p>
There are a few props we need to add, eg zodiacSign, skinColor
</p>
<ul class="org-ul">
<li>We check Wikipedia or Google for the right name, and find that it applies not only to People but also to Planets
</li>
<li>Go directly to <a href="http://mappings.dbpedia.org/index.php?title=OntologyProperty:ZodiacSign&action=edit">http://mappings.dbpedia.org/index.php?title=OntologyProperty:ZodiacSign&action=edit</a>
</li>
<li>Entering the prop info is best done from a template
</li>
<li>We also check the use of this prop in wikipedia and find out that it links to pages, eg <code>[[Телец]]</code> (Taurus). So we need an ObjectProperty
</li>
<li>Entering an appropriate comment is <b>mandatory</b>: describe the usage <b>in detail</b>:
<pre class="example">
{{ObjectProperty
| labels =
{{label|en|zodiac sign}}
|comments=
{{comment|en|Zodiac Sign. Applies to persons, planets, etc}}
}}
</pre>
</li>
</ul>
</section>
<section id="sec-9" >
<h2>Add a Tracking Issue</h2>
<p>
Looking for "shoe size", we find two duplicate properties. showSize is the proper English term, so we choose to remove showNumber
</p>
<ul class="org-ul">
<li>Search for "shoeNumber" to see how many times it's used. If it's a few, just do it (delete the prop and replace the usages)
</li>
<li>But in this case there are a many, so let's make an issue hoping that someone else (maybe with the help of a bot) will do it
</li>
<li>Go to <a href="https://github.com/dbpedia/mappings-tracker/issues/new">https://github.com/dbpedia/mappings-tracker/issues/new</a>
</li>
<li>Type a title: "replace shoeNumber with shoeSize"
</li>
<li>Paste the link of the property discussion page: <a href="http://mappings.dbpedia.org/index.php?title=OntologyProperty_talk:ShoeNumber">http://mappings.dbpedia.org/index.php?title=OntologyProperty_talk:ShoeNumber</a>
</li>
<li>Put all details on the discussion page: we use the tracker only to track, not to discuss/explain
</li>
</ul>
</section>
<section id="sec-10" >
<h2>Describe the Problem</h2>
<ul class="org-ul">
<li>Go to the Discussion tab of the shoeNumber property
</li>
<li>Add a description of the problem:
<pre class="example">
* 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
--~~~~
</pre>
</li>
<li>Paste the new issue link that you just created. This way the issue and prop are inter-linked
</li>
<li>Sign your submission! The –~~~~ at the end is converted to the datetime and your name
</li>
</ul>
</section>
<section id="sec-11" >
<h2>Add Another Property</h2>
<p>
The "vital stats" for a Model include height, weight, eyeColor, hairColor, skinColor, shoeSize, zodiacSign, bustSize (but of course!), waistSize, hipSize
</p>
<ul class="org-ul">
<li>enwiki and jawiki have fields bustSize, waistSize, hipSize
<ul class="org-ul">
<li>An app to sort models by these measures would surely be a commercial success :-)
</li>
</ul>
</li>
<li>bgwiki uses a composite field bust-waist-hip size (мерки: бюст-талия-ханш)
</li>
<li>So I made a new composite property, describing in detail its usage vs the 3 separate properties (rdfs:comment):
<pre class="example">
{{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
}}
</pre>
</li>
<li>Also made enh req <a href="https://github.com/dbpedia/extraction-framework/issues/325">#325</a> extract several Lengths out of a field
</li>
<li>Finally, I linked the issue to the property, by putting this in the property's Discussion page:
"If <a href="https://github.com/dbpedia/extraction-framework/issues/325">#325</a> is implemented, this should be deleted in favor of 3 separate fields"
</li>
</ul>
</section>
<section id="sec-12" >
<h2>Completed Mapping</h2>
<p>
Move any unmapped props to the end, in a comment <code>!-- ... --</code>
</p>
<pre class="example">
{{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
--
</pre>
</section>
<section id="sec-13" >
<h2>Test the Mapping</h2>
<ul class="org-ul">
<li>At the <a href="http://mappings.dbpedia.org/index.php/Mapping_bg:Манекен_инфо">mapping page</a> you'll find some useful links
</li>
<li>Link to <a href="http://mappings.dbpedia.org/server/mappings/bg/extractionSamples/Mapping_bg:Манекен_инфо">return triples</a> from the mapping: unfortunately works only for ASCII names (<a href="https://github.com/dbpedia/extraction-framework/issues/289">#289</a>)
</li>
<li>So <a href="http://bg.wikipedia.org/wiki/Special:WhatLinksHere/Template:Манекен_инфо?limit=500&namespace=0">find some usages</a> and pick up some names
<pre class="example">
Летисия Каста
Константина Живова
</pre>
</li>
<li>Then go to the Discussion page, add a section "Testing" and make a list of links eg
<ul class="org-ul">
<li><a href="http://mappings.dbpedia.org/server/extraction/bg/extract?format=turtle-triples&extractors=custom&title=Летисия_Каста">http://mappings.dbpedia.org/server/extraction/bg/extract?format=turtle-triples&extractors=custom&title=Летисия_Каста</a>
</li>
<li><a href="http://mappings.dbpedia.org/server/extraction/bg/extract?format=turtle-triples&extractors=custom&title=Константина_Живова">http://mappings.dbpedia.org/server/extraction/bg/extract?format=turtle-triples&extractors=custom&title=Константина_Живова</a>
</li>
</ul>
</li>
<li>This is <b>especially</b> important if you fix a mapping
</li>
<li>It's <a href="http://mappings.dbpedia.org/index.php/Main_Page#Testing_Best_Practices">proposed editorial policy</a>
</li>
</ul>
</section>
</div>
</div>
<script src="../../reveal.js/lib/js/head.min.js"></script>
<script src="../../reveal.js/js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: false,
center: true,
slideNumber: true,
rollingLinks: false,
keyboard: true,
overview: true,
width: 1200,
height: 925,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'none', // default/cube/page/concave/zoom/linear/fade/none
transitionSpeed: 'default',
// Optional libraries used to extend on reveal.js
dependencies: [
{src: '../../reveal.js/js/reveal-help.js', async: true, condition: function() {return !!document.body.classList}}, {src: '../../reveal.js/js/reveal-tagcloud.js', async: true, condition: function() {return !!document.body.classList}},
{ src: '../../reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '../../reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '../../reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '../../reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '../../reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: '../../reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>