-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmusicbrainz_mapping.n3
669 lines (581 loc) · 22.1 KB
/
musicbrainz_mapping.n3
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
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
@prefix map: <file:/home/kurtjx/srcs/d2r-server-0.7/mapping.n3#> .
@prefix mbz: <http://test.musicbrainz.org/> .
@prefix vocab: <http://localhost:2020/vocab/resource/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
@prefix d2r: <http://sites.wiwiss.fu-berlin.de/suhl/bizer/d2r-server/config.rdf#> .
@prefix jdbc: <http://d2rq.org/terms/jdbc/> .
# vocabs in mapping
@prefix mo: <http://purl.org/ontology/mo/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ov: <http://open.vocab.org/terms/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
# connection stuff
map:database a d2rq:Database;
d2rq:jdbcDriver "org.postgresql.Driver";
d2rq:jdbcDSN "jdbc:postgresql://localhost/musicbrainz_db";
d2rq:username "kurtjx";
d2rq:password "kurtjx";
# relatively crude to limit db load
d2rq:resultSizeLimit 100;
.
<> a d2r:Server;
rdfs:label "LinkedBrainz";
d2r:baseURI <http://test.musicbrainz.org/>;
d2r:port 2020;
d2r:documentMetadata [
rdfs:comment "This is an RDF translation of the MusicBrainz service.";
];
d2r:vocabularyIncludeInstances true;
.
# translators
map:DBpediaTrans a d2rq:TranslationTable;
d2rq:javaClass "translators.WikipediaTranslator";
.
map:MySpaceTrans a d2rq:TranslationTable;
d2rq:javaClass "translators.MySpaceTranslator";
.
map:BBCTrans a d2rq:TranslationTable;
d2rq:javaClass "translators.BBCTranslator";
.
################
# artist table #
################
map:Artist a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:uriPattern "artist/@@musicbrainz.artist.gid@@#_";
d2rq:class mo:MusicArtist;
d2rq:classDefinitionLabel "Music Artist"@en;
.
map:artist_name a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property foaf:name;
d2rq:join "musicbrainz.artist.name => musicbrainz.artist_name.id";
d2rq:column "musicbrainz.artist_name.name";
.
map:artist_sort_name a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property ov:sortLabel;
d2rq:join "musicbrainz.artist.sortname => musicbrainz.artist_name.id";
d2rq:column "musicbrainz.artist_name.name";
.
map:artist_alias a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property skos:altLabel;
d2rq:join "musicbrainz.artist_alias.name => musicbrainz.artist_name.id";
d2rq:join "musicbrainz.artist_alias.artist => musicbrainz.artist.id";
d2rq:column "musicbrainz.artist_name.name";
.
map:artist_gender a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property foaf:gender;
d2rq:join "musicbrainz.artist.gender => musicbrainz.gender.id";
d2rq:column "musicbrainz.gender.name";
.
map:artist_type_person a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property rdf:type;
d2rq:condition "musicbrainz.artist.type = 1";
d2rq:constantValue mo:SoloMusicArtist;
.
map:artist_type_group a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property rdf:type;
d2rq:condition "musicbrainz.artist.type = 2";
d2rq:constantValue mo:MusicGroup;
.
# setup artist foaf:made
map:artist_credit_release a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property foaf:made;
d2rq:limit 100; # limit_db_load
d2rq:limitInverse 100; # limit_db_load
d2rq:refersToClassMap map:Release;
d2rq:join "musicbrainz.artist.id <= musicbrainz.artist_credit_name.artist";
d2rq:join "musicbrainz.artist_credit_name.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit.id <= musicbrainz.release.artist_credit";
.
map:artist_credit_recording a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property foaf:made;
d2rq:limit 100;
d2rq:limitInverse 100;
d2rq:refersToClassMap map:Recording;
d2rq:join "musicbrainz.artist.id <= musicbrainz.artist_credit_name.artist";
d2rq:join "musicbrainz.artist_credit_name.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit.id <= musicbrainz.recording.artist_credit";
.
map:artist_credit_work a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property foaf:made;
d2rq:limit 100;
d2rq:limitInverse 100;
d2rq:refersToClassMap map:Work;
d2rq:join "musicbrainz.artist.id <= musicbrainz.artist_credit_name.artist";
d2rq:join "musicbrainz.artist_credit_name.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit.id <= musicbrainz.work.artist_credit";
.
map:artist_credit_release_group a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property foaf:made;
d2rq:limit 100;
d2rq:limitInverse 100;
d2rq:refersToClassMap map:ReleaseGroup;
d2rq:join "musicbrainz.artist.id <= musicbrainz.artist_credit_name.artist";
d2rq:join "musicbrainz.artist_credit_name.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit.id <= musicbrainz.release_group.artist_credit";
.
map:artist_credit_track a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property foaf:made;
d2rq:limit 100;
d2rq:limitInverse 100;
d2rq:refersToClassMap map:Track;
d2rq:join "musicbrainz.artist.id <= musicbrainz.artist_credit_name.artist";
d2rq:join "musicbrainz.artist_credit_name.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit.id <= musicbrainz.track.artist_credit";
.
# country
map:artist_country a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property foaf:based_near;
d2rq:uriPattern "http://ontologi.es/place/@@musicbrainz.country.isocode@@";
d2rq:join "musicbrainz.artist.country => musicbrainz.country.id";
.
# country names
map:Country a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:uriPattern "http://ontologi.es/place/@@musicbrainz.country.isocode@@";
d2rq:class geo:Country;
d2rq:classDefinitionLabel "Country";
.
map:country_name a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Country;
d2rq:property geo:name, rdfs:label;
d2rq:column "musicbrainz.country.name";
.
map:countryISO a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Country;
d2rq:property skos:notation;
d2rq:column "musicbrainz.country.isocode";
.
# artist ARs
# wikipedia id=213
map:artist_dbpedia a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property owl:sameAs;
d2rq:join "musicbrainz.l_artist_url.entity0 => musicbrainz.artist.id";
d2rq:join "musicbrainz.l_artist_url.link => musicbrainz.link.id";
d2rq:join "musicbrainz.link.link_type => musicbrainz.link_type.id";
d2rq:condition "musicbrainz.link_type.id=213";
d2rq:join "musicbrainz.l_artist_url.entity1 => musicbrainz.url.id";
d2rq:uriColumn "musicbrainz.url.url";
d2rq:translateWith map:DBpediaTrans;
.
# discogs id=214
# TODO discogs will pry need a translator as they do some funky things to the URIs
# bbc link_type.id=205
map:artist_bbc a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property owl:sameAs;
d2rq:join "musicbrainz.l_artist_url.entity0 => musicbrainz.artist.id";
d2rq:join "musicbrainz.l_artist_url.link => musicbrainz.link.id";
d2rq:join "musicbrainz.link.link_type => musicbrainz.link_type.id";
d2rq:condition "musicbrainz.link_type.id=205";
d2rq:join "musicbrainz.l_artist_url.entity1 => musicbrainz.url.id";
d2rq:uriColumn "musicbrainz.url.url";
d2rq:translateWith map:BBCTrans;
.
# foaf:homepage link_type.id=222
map:artist_homepage a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property foaf:homepage;
d2rq:join "musicbrainz.l_artist_url.entity0 => musicbrainz.artist.id";
d2rq:join "musicbrainz.l_artist_url.link => musicbrainz.link.id";
d2rq:join "musicbrainz.link.link_type => musicbrainz.link_type.id";
d2rq:condition "musicbrainz.link_type.id=222";
d2rq:join "musicbrainz.l_artist_url.entity1 => musicbrainz.url.id";
d2rq:uriColumn "musicbrainz.url.url";
.
# MySpace id=227
map:artist_myspace a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Artist;
d2rq:property owl:sameAs;
d2rq:join "musicbrainz.l_artist_url.entity0 => musicbrainz.artist.id";
d2rq:join "musicbrainz.l_artist_url.link => musicbrainz.link.id";
d2rq:join "musicbrainz.link.link_type => musicbrainz.link_type.id";
d2rq:condition "musicbrainz.link_type.id=227";
d2rq:join "musicbrainz.l_artist_url.entity1 => musicbrainz.url.id";
d2rq:uriColumn "musicbrainz.url.url";
d2rq:translateWith map:MySpaceTrans;
.
#######################
# release_group table #
#######################
map:ReleaseGroup a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:uriPattern "release-group/@@musicbrainz.release_group.gid@@#_";
d2rq:class mo:SignalGroup;
d2rq:classDefinitionLabel "Signal Group"@en;
.
map:release_group_name a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:ReleaseGroup;
d2rq:property dct:title, rdfs:label;
d2rq:join "musicbrainz.release_group.name => musicbrainz.release_name.id";
d2rq:column "musicbrainz.release_name.name";
.
map:release_group_credit a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:ReleaseGroup;
d2rq:property foaf:maker;
d2rq:refersToClassMap map:Artist;
d2rq:join "musicbrainz.release_group.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit_name.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit_name.artist => musicbrainz.artist.id";
.
# TODO release_group types???
# id | name
# ----+------------------
# 1 | Non-Album Tracks
# 2 | Album
# 3 | Single
# 4 | EP
# 5 | Compilation
# 6 | Soundtrack
# 7 | Spokenword
# 8 | Interview
# 9 | Audiobook
# 10 | Live
# 11 | Remix
# 12 | Other
###########
# Release #
###########
map:Release a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:class mo:Release;
d2rq:classDefinitionLabel "Release"@en;
d2rq:uriPattern "release/@@musicbrainz.release.gid@@#_";
.
map:release_name a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Release;
d2rq:property dct:title, rdfs:label;
d2rq:join "musicbrainz.release.name => musicbrainz.release_name.id";
d2rq:column "musicbrainz.release_name.name";
.
map:release_credit a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Release;
d2rq:property foaf:maker;
d2rq:refersToClassMap map:Artist;
d2rq:join "musicbrainz.release.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit_name.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit_name.artist => musicbrainz.artist.id";
.
map:release_country a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Release;
d2rq:property mo:publishing_location;
d2rq:uriPattern "http://ontologi.es/place/@@musicbrainz.country.isocode@@";
d2rq:join "musicbrainz.release.country => musicbrainz.country.id";
.
map:release_record_label a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Release;
d2rq:property mo:label;
d2rq:refersToClassMap map:Label;
d2rq:join "musicbrainz.release_label.release => musicbrainz.release.id";
d2rq:join "musicbrainz.release_label.label => musicbrainz.label.id";
.
map:release_tracklists a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Release;
d2rq:property mo:record;
d2rq:join "musicbrainz.medium.release => musicbrainz.release.id";
d2rq:join "musicbrainz.medium.tracklist => musicbrainz.tracklist.id";
d2rq:refersToClassMap map:Tracklist;
.
# FIXME: no idea why this doesn't work and why it makes everything super slow!!!
# map:release_medium a d2rq:PropertyBridge;
# d2rq:belongsToClassMap map:Release;
# d2rq:property rdf:type;
# d2rq:join "musicbrainz.medium.release => musicbrainz.release.id";
# d2rq:join "musicbrainz.medium.format => musicbrainz.medium_format.id";
# d2rq:uriColumn "musicbrainz.medium_format.name";
# .
# d2rq:translateWith map:MediumTrans;
# .
map:MediumTrans a d2rq:TranslationTable;
d2rq:javaClass "translators.MediumTranslator";
.
map:release_to_release_event a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Release;
d2rq:property mo:release_event;
d2rq:refersToClassMap map:ReleaseEvent;
.
# Release Event
map:ReleaseEvent a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:class mo:ReleaseEvent;
d2rq:classDefinitionLabel "Release Event"@en;
d2rq:uriPattern "release/@@musicbrainz.release.gid@@#event";
.
map:release_event_date_year a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:ReleaseEvent;
d2rq:property dct:date;
d2rq:column "musicbrainz.release.date_year";
#d2rq:condition "musicbrainz.release.date_month <> NULL";
#d2rq:condition "musicbrainz.release.date_day <> NULL";
d2rq:datatype xsd:gYear;
.
map:release_event_date_year_month a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:ReleaseEvent;
d2rq:property dct:date;
d2rq:pattern "@@musicbrainz.release.date_year@@-@@musicbrainz.release.date_month@@";
#d2rq:condition "musicbrainz.release.date_day is NULL";
d2rq:datatype xsd:gYearMonth;
.
# FIXME conditionals seem to not work for these various date formats
# FIXME doesn't seem to work at all!
map:release_event_date_full a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:ReleaseEvent;
d2rq:property dct:date;
d2rq:pattern "@@musicbrainz.release.date_year@@-@@musicbrainz.release.date_month@@-@@musicbrainz.release.date_day@@";
#d2rq:condition "musicbrainz.release.date_month != NULL";
#d2rq:condition "musicbrainz.release.date_day != NULL";
d2rq:datatype xsd:date;
.
# TODO deal with release_packaging ???
# id | name
# ----+-----------------
# 1 | Jewel Case
# 2 | Slim Jewel Case
# 3 | Digipak
# 4 | Paper Sleeve
# 5 | Other
# (5 rows)
# TODO deal with release_status ???
# musicbrainz_db=# select * from musicbrainz.release_status;
# id | name
# ----+----------------
# 1 | Official
# 2 | Promotion
# 3 | Bootleg
# 4 | Pseudo-Release
# (4 rows)
#############
# Tracklist #
#############
map:Tracklist a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:class mo:Record;
d2rq:classDefinitionLabel "Record"@en;
d2rq:uriPattern "tracklist/@@musicbrainz.tracklist.id@@#_";
.
map:tracklist_track a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Tracklist;
d2rq:property mo:track;
d2rq:refersToClassMap map:Track;
d2rq:join "musicbrainz.track.tracklist => musicbrainz.tracklist.id";
.
map:tracklist_track_count a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Tracklist;
d2rq:property mo:track_count ;
d2rq:datatype xsd:int;
d2rq:column "musicbrainz.tracklist.trackcount";
.
#########
# Track #
#########
map:Track a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:bNodeIdColumns "musicbrainz.track.id";
d2rq:class mo:Track;
d2rq:classDefinitionLabel "Track"@en;
.
map:track_name a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Track;
d2rq:property dct:title, rdfs:label;
d2rq:join "musicbrainz.track.name => musicbrainz.track_name.id";
d2rq:column "musicbrainz.track_name.name";
.
map:track_credit a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Track;
d2rq:property foaf:maker;
d2rq:refersToClassMap map:Artist;
d2rq:join "musicbrainz.track.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit_name.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit_name.artist => musicbrainz.artist.id";
.
map:track_to_recording a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Track;
d2rq:property mo:published_as;
d2rq:refersToClassMap map:Recording;
d2rq:join "musicbrainz.track.recording => musicbrainz.recording.id";
.
map:track_position a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Track;
d2rq:property mo:track_number ;
d2rq:datatype xsd:int;
d2rq:column "musicbrainz.track.position";
.
#############
# Recording #
#############
map:Recording a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:class mo:Signal;
d2rq:classDefinitionLabel "Signal"@en;
d2rq:uriPattern "recording/@@musicbrainz.recording.gid@@#_";
.
map:recording_name a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Recording;
d2rq:property dct:title, rdfs:label;
d2rq:join "musicbrainz.recording.name => musicbrainz.track_name.id";
d2rq:column "musicbrainz.track_name.name";
.
map:recording_credit a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Recording;
d2rq:property foaf:maker;
d2rq:refersToClassMap map:Artist;
d2rq:join "musicbrainz.recording.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit_name.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit_name.artist => musicbrainz.artist.id";
.
map:isrc a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Recording;
d2rq:property mo:isrc;
d2rq:join "musicbrainz.isrc.recording => musicbrainz.recording.id";
d2rq:column "musicbrainz.isrc.isrc";
d2rq:datatype xsd:string;
.
map:puid a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Recording;
d2rq:property mo:puid;
d2rq:join "musicbrainz.recording_puid.recording => musicbrainz.recording.id";
d2rq:join "musicbrainz.recording_puid.puid => musicbrainz.puid.id";
d2rq:column "musicbrainz.puid.puid";
d2rq:datatype xsd:string;
.
map:duration a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Recording;
d2rq:property mo:duration;
d2rq:column "musicbrainz.recording.length";
d2rq:translateWith map:DurationTrans;
d2rq:datatype xsd:duration;
.
map:duration_ms a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Recording;
d2rq:property mo:duration_ms;
d2rq:column "musicbrainz.recording.length";
d2rq:datatype xsd:int;
.
# TODO: perhaps use xdt:dayTimeDuration type?
# http://www.w3.org/TR/swbp-xsch-datatypes/#section-duration
map:DurationTrans a d2rq:TranslationTable;
d2rq:javaClass "translators.DurationTranslator";
.
########
# Work #
########
map:Work a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:class mo:MusicalWork;
d2rq:classDefinitionLabel "Musical Work"@en;
d2rq:uriPattern "work/@@musicbrainz.work.gid@@#_";
.
map:work_name a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Work;
d2rq:property dct:title, rdfs:label;
d2rq:join "musicbrainz.work.name => musicbrainz.work_name.id";
d2rq:column "musicbrainz.work_name.name";
.
map:work_credit a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Work;
d2rq:property foaf:maker;
d2rq:refersToClassMap map:Artist;
d2rq:join "musicbrainz.work.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit_name.artist_credit => musicbrainz.artist_credit.id";
d2rq:join "musicbrainz.artist_credit_name.artist => musicbrainz.artist.id";
.
map:work_alias a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Work;
d2rq:property skos:altLabel;
d2rq:join "musicbrainz.work_alias.work => musicbrainz.work.id";
d2rq:join "musicbrainz.work_alias.name => musicbrainz.work_name.id";
d2rq:column "musicbrainz.work_name.name";
.
map:work_composed_in a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Work;
d2rq:property mo:composed_in;
d2rq:refersToClassMap map:WorkComposition;
.
# composition event
map:WorkComposition a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:class mo:Composition;
d2rq:classDefinitionLabel "Composition"@en;
d2rq:uriPattern "work/@@musicbrainz.work.gid@@#composition";
.
map:composition_produced_work a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:WorkComposition;
d2rq:property mo:produced_work;
d2rq:refersToClassMap map:Work;
.
# composed by AR
map:work_composed_by a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:WorkComposition;
d2rq:property mo:composer ;
d2rq:refersToClassMap map:Artist;
d2rq:condition "musicbrainz.link_type.id = 176";
d2rq:join "musicbrainz.link_type.id <= musicbrainz.link.link_type";
d2rq:join "musicbrainz.link.id <= musicbrainz.l_artist_work.link";
d2rq:join "musicbrainz.l_artist_work.entity0 => musicbrainz.artist.id";
d2rq:join "musicbrainz.l_artist_work.entity1 => musicbrainz.work.id";
.
# TODO deal with "arranged by" and other l_artist_work ARs many are important!
# note work_type currently empty 2010-10-07
# musicbrainz_db=# select * from musicbrainz.work_type;
# id | name
# ----+------
# (0 rows)
#########
# Label #
#########
map:Label a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:class mo:Label;
d2rq:classDefinitionLabel "Label"@en;
d2rq:uriPattern "label/@@musicbrainz.label.gid@@#_";
.
map:label_name a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Label;
d2rq:property foaf:name, rdfs:label;
d2rq:join "musicbrainz.label.name => musicbrainz.label_name.id";
d2rq:column "musicbrainz.label_name.name";
.
map:label_sort_name a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Label;
d2rq:property ov:sortLabel;
d2rq:join "musicbrainz.label.sortname => musicbrainz.label_name.id";
d2rq:column "musicbrainz.label_name.name";
.
map:label_alias a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Label;
d2rq:property skos:altLabel;
d2rq:join "musicbrainz.label_alias.label => musicbrainz.label.id";
d2rq:join "musicbrainz.label_alias.name => musicbrainz.label_name.id";
d2rq:column "musicbrainz.label_name.name";
.
# TODO deal with label_type
# musicbrainz_db=# select * from musicbrainz.label_type;
# id | name
# ----+---------------------
# 1 | Distributor
# 2 | Holding
# 3 | Production
# 4 | Original Production
# 5 | Bootleg Production
# 6 | Reissue Production
# 7 | Publisher
# (7 rows)