index.html
80.6 KB
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
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN" xml:lang="EN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Use Cases and Requirements for Mapping Relational Databases to RDF
</title>
<style type="text/css">
/*<![CDATA[*/
@import url("local.css");
code { font-family: monospace; }
div.constraint,
div.issue,
div.note,
div.notice { margin-left: 2em; }
ol.enumar { list-style-type: decimal; }
ol.enumla { list-style-type: lower-alpha; }
ol.enumlr { list-style-type: lower-roman; }
ol.enumua { list-style-type: upper-alpha; }
ol.enumur { list-style-type: upper-roman; }
div.exampleInner pre { margin-left: 1em;
margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
border-bottom-width: 4px;
border-bottom-style: double;
border-bottom-color: #d3d3d3;
padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
margin: 4px}
em.rfc2119 { text-transform: lowercase;
font-variant: small-caps;
font-style: normal; }
/*]]>*/
</style>
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" />
</head>
<body>
<div class="head">
<p>
<a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72" /></a>
</p>
<h1>
<a name="title" id="title"></a>Use Cases and Requirements for Mapping Relational Databases to RDF
</h1>
<h2>
<a name="w3c-doctype" id="w3c-doctype"></a>W3C Working Draft 8 June 2010
</h2>
<dl>
<dt>
This version:
</dt>
<dd>
<a href="http://www.w3.org/TR/2010/WD-rdb2rdf-ucr-20100608/">http://www.w3.org/TR/2010/WD-rdb2rdf-ucr-20100608/</a>
</dd>
<dt>
Latest version:
</dt>
<dd>
<a href="http://www.w3.org/TR/rdb2rdf-ucr/">http://www.w3.org/TR/rdb2rdf-ucr/</a>
</dd>
<dt>
Editors:
</dt>
<dd>
Eric Prud'hommeaux, W3C <a href="mailto:eric@w3.org"><eric@w3.org></a>
</dd>
<dd>
Michael Hausenblas, DERI, NUI Galway <a href="mailto:michael.hausenblas@deri.org"><michael.hausenblas@deri.org></a>
</dd>
<dt>
Authors:
</dt>
<dd>
Sören Auer, Universität Leipzig <a href="mailto:auer@informatik.uni-leipzig.de"><auer@informatik.uni-leipzig.de></a>
</dd>
<dd>
Lee Feigenbaum, Cambridge Semantics <a href="mailto:lee@thefigtrees.net"><lee@thefigtrees.net></a>
</dd>
<dd>
Daniel Miranker, University of Texas at Austin <a href="mailto:miranker@cs.utexas.edu"><miranker@cs.utexas.edu></a>
</dd>
<dd>
Angela Fogarolli, University of Trento <a href="mailto:afogarol@disi.unitn.it"><afogarol@disi.unitn.it></a>
</dd>
<dd>
Juan Sequeda, University of Texas at Austin <a href="mailto:jsequeda@cs.utexas.edu"><jsequeda@cs.utexas.edu></a>
</dd>
</dl>
<p class="copyright">
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2010 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
</p>
</div>
<hr />
<div>
<h2>
<a name="abstract" id="abstract"></a>Abstract
</h2>
<p>
The need to share data with collaborators motivates custodians and users of relational databases (RDB) to expose relational data on the Web of Data. This document examines a set of use cases from science and industry, taking relational data and exposing it in patterns conforming to shared RDF schemata. These use cases expose a set of functional requirements for exposing relational data as RDF in the RDB2RDF Mapping Language (R2RML).
</p>
</div>
<div>
<h2>
<a name="status" id="status"></a>Status of this Document
</h2>
<p>
<em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/.</em>
</p>
<p>
This is the First Public Working Draft of the "Use Cases and Requirements for Mapping Relational Databases to RDF" for review by W3C members and other interested parties.
</p>
<p>
Comments on this document should be sent to <a href="mailto:public-rdb2rdf-comments@w3.org">public-rdb2rdf-comments@w3.org</a>, a mailing list with a <a href="http://lists.w3.org/Archives/Public/public-rdb2rdf-comments/">public archive</a>.
</p>
<p>
Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
</p>
<p>
The W3C <a href="http://www.w3.org/2001/sw/rdb2rdf/">RDB2RDF Working Group</a> is the W3C working group responsible for this document.
</p>
<p>
This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. W3C maintains a <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/43889/status">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.
</p>
</div>
<div>
<h2>
<a name="scope" id="scope"></a>Scope
</h2>
<p>
Per the <a href="http://www.w3.org/2009/08/rdb2rdf-charter">RDB2RDF charter</a>, the scope of the RDB2RDF Mapping Language (R2RML) is limited to read-only access to the relational database. This means that data can be extracted from the relational database, but not updated.
</p>
</div>
<div class="toc">
<h2>
<a name="contents" id="contents"></a>Table of Contents
</h2>
<p class="toc">
1 <a href="#intro">Introduction</a><br />
1.1 <a href="#intro-whyrdb2rdf">Why Mapping RDBs to RDF?</a><br />
1.2 <a href="#intro-whystandard">Why a standard RDB2RDF method?</a><br />
2 <a href="#uc">Use Cases</a><br />
2.1 <a href="#HCLS">UC1 - Patient Recruitment</a><br />
2.1.1 <a href="#HCLS-query">Queries Over the RDF Graph</a><br />
2.1.2 <a href="#HCLS-req">Derived Requirements</a><br />
2.2 <a href="#WP">UC2 - Web applications (Wordpress)</a><br />
2.2.1 <a href="#WP-query">Queries Over the RDF Graph</a><br />
2.2.2 <a href="#WP-req">Derived Requirements</a><br />
2.3 <a href="#tax">UC3 - Integrating Enterprise Relational databases for tax control</a><br />
2.3.1 <a href="#tax-query">Querying</a><br />
2.3.2 <a href="#tax-req">Derived Requirements</a><br />
2.4 <a href="#rCAD">UC4 - rCAD: RNA Comparative Analysis Database</a><br />
2.4.1 <a href="#d1e859">Expose Relational Data as RDF when there is no existing Domain Ontology to map the relational schema to</a><br />
2.4.2 <a href="#d1e876">Expose Mapping a Relational Database to an OWL DL ontology</a><br />
2.4.3 <a href="#rCAD-req">Derived Requirements</a><br />
3 <a href="#reqs">Requirements</a><br />
3.1 <a href="#reqs-core">Core Requirements</a><br />
3.1.1 <a href="#DIRECT">DIRECT - Direct Mapping</a><br />
3.1.2 <a href="#TRANSFORM">TRANSFORM - Transformative Mapping</a><br />
3.1.3 <a href="#GUIDGEN">GUIDGEN - Generation of Globally Unique Identifiers</a><br />
3.1.4 <a href="#SQLGEN">SQLGEN - Query Translation</a><br />
3.1.5 <a href="#ETL">ETL - Extract-Transform-Load</a><br />
3.1.6 <a href="#DATATYPES">DATATYPES - Datatypes</a><br />
3.1.7 <a href="#VSDATATYPES">VSDATATYPES - Database Vendor Specific Datatypes</a><br />
3.1.8 <a href="#RENAMECOL">RENAMECOL - Ability to Rename SQL Column Names</a><br />
3.1.9 <a href="#APPLYFUNCTIONBEFOREMAP">APPLYFUNCTION - Apply a Function before Mapping</a><br />
3.1.10 <a href="#Exposing_many-to-many_join_tables_as_simple_triples">MANYTOMANY - Exposing many-to-many join tables as simple triples</a><br />
3.1.11 <a href="#CLASSESFROMATTRIBVALUES">CLASSESFROMATTRIBVALUES - Creating Classes based on Attribute Values</a><br />
3.2 <a href="#reqs-optional">Optional Requirements</a><br />
3.2.1 <a href="#NAMEDGRAPH">NAMEDGRAPH - Named Graphs</a><br />
3.2.2 <a href="#NSDECL">NSDECL - Namespace declaration</a><br />
3.2.3 <a href="#METADATA">METADATA - Static Metadata</a><br />
3.2.4 <a href="#PROVENANCE">PROVENANCE - Provenance</a><br />
3.2.5 <a href="#UPDATES">UPDATES - Update Logs</a><br />
4 <a href="#ack">Acknowledgments</a><br />
5 <a href="#refs">References</a><br />
</p>
<h3>
<a name="appendices" id="appendices"></a>Appendices
</h3>
<p class="toc">
A <a href="#glossary">Glossary</a> (Non-Normative)<br />
B <a href="#approaches">RDB2RDF Mapping Approaches</a> (Non-Normative)<br />
B.1 <a href="#justDirect">Direct Mapping</a><br />
B.2 <a href="#databaseToOntology">Direct Mapping Plus Ontology Mapping</a><br />
B.3 <a href="#directPlusOnt">Database to Ontology Mapping</a><br />
</p>
</div>
<hr />
<div class="body">
<div class="div1">
<h2>
<a name="intro" id="intro"></a>1 Introduction
</h2>
<p>
The majority of dynamic Web content is backed by relational databases (RDB), and so are many enterprise systems <a href="#DynaWebSites">[DynaWebSites]</a>. On the other hand, in order to expose structured data on the Web, Resource Description Framework (RDF) <a href="#RDF">[RDF]</a> is used. This document reviews use cases and requirements for a <em>relational database to RDF mapping</em> (RDB2RDF) with the following structure:
</p>
<ol class="enumar">
<li>The remainder of this section motivates why mapping RDBs to RDF is necessary and needed and highlights the importance of a standard.
</li>
<li>In the next section RDB2RDF <a href="#uc">use cases</a> are reviewed.
</li>
<li>The last section discusses <a href="#reqs">requirements</a> regarding a RDB2RDF mapping language, driven by an analysis of the aforementioned use cases.
</li>
</ol>
<div class="div2">
<h3>
<a name="intro-whyrdb2rdf" id="intro-whyrdb2rdf"></a>1.1 Why Mapping RDBs to RDF?
</h3>
<p>
The Web of Data is constantly growing due to its compelling potential of facilitating data integration and retrieval. At the same time however, RDB systems host a vast amount of structured data in relational tables augmented with integrity constraints. In order to make this huge amount of relational data available for the Web of Data, a connection must be established between RDBs and a format suitable for the Web of Data.
</p>
<p>
The advantages of creating an <em>RDF view</em> of relational data are inherited from the Web of Data and can be summarized based on the tasks they facilitate:
</p>
<ul>
<li>
<em>Integration</em>: data in different RDBs can be integrated using RDF semantics and mechanisms; in this sense, the Web of Data can be imagined as one big database. Moreover, information in the database can be integrated with information that comes from other data sources.
</li>
<li>
<em>Retrieval</em>: once data are published in the Web of Data (as opposed to relational databases), queries can span different data sources and more powerful retrieval methods can be built.
</li>
</ul>
<p>
RDF data in the Web should be defined and linked in a way that makes it accessible for humans and machines <a href="#LinkedData">[LinkedData]</a>. The Web of data is a scalable environment with explicit semantics where not only humans can navigate information, but also machines are able to find connections and use them to navigate through the information space. In order to realise this global information space, we need to:
</p>
<ul>
<li>follow a common model to describe, connect and access resources;
</li>
<li>name resources in an unambiguous way
</li>
</ul>
<p>
The most common way to publish resources in the Web of Data follows the RDF model <a href="#RDF">[RDF]</a> and uses Uniform Resource Identifiers (<a href="#URI">[URI]</a>) for resource identification, thereby facilitating the creation of a comprehensive and flexible resource description.
</p>
<p>
In the following, we will use <em>RDB2RDF</em> to denote any technique that takes as an input a RDB (schema and data) and produces one or more RDF graphs, as depicted in the following figure:
</p>
<div>
<img src="rdb2rdf_principle.png" alt="RDB2RDF principle" />
</div>
<p>
The consumer of the RDF Graph (virtual or materialized) essentially can access the RDF data in different ways:
</p>
<ol class="enumar">
<li>
<em>Query</em> access, which means the agent issues a SPARQL query against an endpoint exposed by the system and processes the results (typically the result is a SPARQL result set in XML or JSON);
</li>
<li>
<em>Entity-level</em> access, which means the agent performs an HTTP <code>GET</code> on a URI exposed by the system and processes the result (typically the result is an RDF graph);
</li>
<li>
<em>Dump</em> access, which means the agent performs an HTTP <code>GET</code> on dump of the entire RDF graph, for example in Extract, Transform, and Load (ETL) processes.
</li>
</ol>
</div>
<div class="div2">
<h3>
<a name="intro-whystandard" id="intro-whystandard"></a>1.2 Why a standard RDB2RDF method?
</h3>
<p>
With the advent of the Web of Data, researcher and practitioners have compared the RDB model and the RDF model <a href="#RDB-RDF">[RDB-RDF]</a> and surveyed different approaches to map them <a href="#RDBMSMapping">[RDBMSMapping]</a>. As noted in the survey on existing RDB2RDF mapping approaches <a href="#RDB2RDFSurvey">[RDB2RDFSurvey]</a>, a couple of proposals on how to tackle the RDB2RDF mapping issues are known.
</p>
<p>
Use of a standard for mapping language for RDB to RDF may allow use of a single mapping specification in the context of mirroring of schema and (possibly some or all of the) data in various databases, possibly from different vendors (e.g., Oracle database, MySQL, etc.) and located at various sites. Similarly structured data (that is, data stored using same schema) is useful in many different organizations often located in different parts of the world. These organizations may employ databases from different vendors due to one or more of many possible factors (such as, licensing cost, resource constraints, availability of useful tools and applications and of appropriate database administrators, etc.). Presence of a standard RDB2RDF mapping language allows creation and use of a single mapping specification against each of the hosting databases to present a single (virtual or materialized) RDF view of the relational data hosted in those databases and this RDF view can then be queried by applications using SPARQL query or protocol.
</p>
<p>
Another reason for a standard is to allow easy migration between different systems. Just as a single web-page in HTML can be viewed by two different Web browsers from different vendors, a single RDB2RDF mapping standard should allow a user from one database to expose their data as RDF, and then, when they export their data to another database, allow the newly imported data to be queried as RDF without changing the mapping file. For example, imagine that a database administrator is exposing weather data as Linked Data to be consumed by other applications. At first, this weather data is stored in a light-weight database (such as MySQL). However, as more and more weather data is collected, and more and more users access the Web data, the light-weight database may have difficulty scaling. Therefore, the database administrator migrates their database to a more heavy-weight database (such as Oracle Database 11g). Of course, the database administrator does not want to re-create the ability to view the data as RDF using a vendor-specific mapping file, but instead wants to seamlessly migrate the view of their data as RDF.
</p>
<p>
A standardized mapping between relational data and RDF allows the database administrator to migrate the view of their data as RDF across databases, allowing the vendors to compete on functionality and features rather than forcing database administrators to rewrite their entire relational data to RDF mapping when they want to migrate their data from one database to another.
</p>
<p>
Another motivation for a standard is that for certain classes of systems (such as CMS) a 'default' mapping could be defined which can be deployed no matter what underlying RDB is used. As these systems, such as Drupal or Wordpress, can be run on top of different underlying relational databases. A standardized way of mapping between relational data and RDF hence allows the underlying database to be changed without disturbing the content management system.
</p>
<p>
Further, having a standard mapping would simplify programming applications that access multiple database sources.
</p>
</div>
</div>
<div class="div1">
<h2>
<a name="uc" id="uc"></a>2 Use Cases
</h2>
<p>
With integration of relational data from one RDB with various kinds of data (such as relational, spreadsheets, CSV, unstructured text, etc.), the use cases presented in the following fall into one or more of the following categories:
</p>
<ol class="enumar">
<li>I want to integrate my RDB with another structured source (RDB, XLS, CSV, etc.), so I'll convert my RDB to RDF and assume my other structured source can also be in RDF. See <a href="#HCLS">UC1</a>, <a href="#tax">UC3</a>.
</li>
<li>I want to integrate my RDB with existing RDF on the web (Linked Data), so I'll convert my RDB to RDF and then I'm able to link and integrate. See <a href="#WP">UC2</a>, <a href="#rCAD">UC4</a>.
</li>
<li>I want to integrate my RDB with unstructured data (HTML, PDF, etc.), so I'll convert my RDB to RDF and assume my other unstructured source can also be in RDF.
</li>
<li>I want my RDB data to be available for SPARQL or other RDF-based querying, and/or for others to integrate with other data sources (structured, RDF, unstructured). See <a href="#WP">UC2</a>, <a href="#rCAD">UC4</a>.
</li>
</ol>
<div class="div2">
<h3>
<a name="HCLS" id="HCLS"></a>2.1 UC1 - Patient Recruitment
</h3>
<p>
The <a href="http://esw.w3.org/HCLSIG">Semantic Web for Health Care and Life Sciences Interest Group</a> has created several demonstrators using SPARQL to query clinical and biological relational databases. Included is the database structure, sample data, and a SPARQL query. Following are six tables of sample diabetic patient data extracted from the University of Texas Health Science Center. Some columns have been omitted from this use case for brevity.
</p>
<p>
Accompanying each table are two RDF views (represented in Turtle) corresponding to <em style="background-color: rgb(238, 238, 255);">HL7/RIM</em> and <em style="background-color: rgb(238, 255, 238);">CDISK SDTM</em> ontology in RDFS. While there are many motivations for providing a common interface to administer distinct databases (access to patient history, shared rules for clinical decision support, etc.), in this case, SPARQL queries (following the table description) were used to find candidates for clinical studies. For these RDF graphs, the following namespaces apply:
</p>
<pre>
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix hl7: <http://www.hl7.org/v3ballot/xml/infrastructure/vocabulary/vocabulary#> .
@prefix stdm: <http://www.sdtm.org/vocabulary#> .
</pre><em>Person</em>
<table cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
ID
</th>
<th>
SexDE
</th>
<th>
DateOfBirth
</th>
<th>
LastEditedDTTM
</th>
</tr>
<tr>
<td>
1234561
</td>
<td>
2
</td>
<td>
1983-01-02 00:00:00
</td>
<td>
2007-11-13 15:49:20
</td>
</tr>
<tr>
<td>
1234562
</td>
<td>
3
</td>
<td>
1963-12-27 00:00:00
</td>
<td>
2008-01-30 17:08:42
</td>
</tr>
<tr>
<td>
1234563
</td>
<td>
2
</td>
<td>
1983-02-25 00:00:00
</td>
<td>
2007-03-10 06:01:55
</td>
</tr>
</tbody>
</table>
<pre style="background-color: rgb(238, 238, 255);">
<http://hospital.example/DB/Person/ID.1234561#record> a hl7:Person ;
hl7:administrativeGenderCodePrintName Sex_DE:M ;
hl7:livingSubjectBirthTime "1983-01-02T00:00:00Z"^^xsd:dateTime .
<http://hospital.example/DB/Person/ID.1234562#record> a hl7:Person ;
hl7:administrativeGenderCodePrintName Sex_DE:F ;
hl7:livingSubjectBirthTime "1963-12-27T00:00:00Z"^^xsd:dateTime .
<http://hospital.example/DB/Person/ID.1234563#record> a hl7:Person ;
hl7:administrativeGenderCodePrintName Sex_DE:M ;
hl7:livingSubjectBirthTime "1983-02-25T00:00:00Z"^^xsd:dateTime .
</pre>
<pre style="background-color: rgb(238, 255, 238);">
<http://hospital.example/DB/Person/ID.1234561#record> a sdtm:Patient ;
stdm:dateTimeOfBirth "1983-01-02T00:00:00Z"^^xsd:dateTime .
<http://hospital.example/DB/Person/ID.1234562#record> a sdtm:Patient ;
sdtm:dateTimeOfBirth "1963-12-27T00:00:00Z"^^xsd:dateTime ;
sdtm:sex <http://hospital.example/DB/Sex_DE#F> .
<http://hospital.example/DB/Person/ID.1234563#record> a sdtm:Patient ;
sdtm:dateTimeOfBirth "1983-02-25T00:00:00Z"^^xsd:dateTime ;
sdtm:sex <http://hospital.example/DB/Sex_DE#F> .
</pre><em>Sex_DE</em>
<table cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
ID
</th>
<th>
EntryCode
</th>
<th>
EntryName
</th>
<th>
EntryMnemonic
</th>
</tr>
<tr>
<td>
2
</td>
<td>
1
</td>
<td>
Male
</td>
<td>
M
</td>
</tr>
<tr>
<td>
3
</td>
<td>
2
</td>
<td>
Female
</td>
<td>
F
</td>
</tr>
</tbody>
</table>
<pre style="background-color: rgb(238, 238, 255);">
<http://hospital.example/DB/Zex_DE/ID.2#record>
hl7:administrativeGenderCodePrintName "Male"@en-us ;
Sex_DE:EntryMnemonic "M"@en-us .
<http://hospital.example/DB/Zex_DE/ID.3#record>
hl7:administrativeGenderCodePrintName "Female"@en-us ;
Sex_DE:EntryMnemonic "F"@en-us .
</pre>
<pre style="background-color: rgb(238, 255, 238);">
<http://hospital.example/DB/Person/ID.1234561#record>
stdm:sex <http://hospital.example/DB/Sex_DE#M> .
<http://hospital.example/DB/Person/ID.1234562#record>
stdm:sex <http://hospital.example/DB/Sex_DE#F> .
<http://hospital.example/DB/Person/ID.1234563#record>
stdm:sex <http://hospital.example/DB/Sex_DE#M> .
</pre><em>Item_Medication</em>
<table cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
ID
</th>
<th>
PatientID
</th>
<th>
ItemType
</th>
<th>
PerformedDTTM
</th>
</tr>
<tr>
<td>
99999999002
</td>
<td>
1234561
</td>
<td>
ME
</td>
<td>
2007-09-28 00:00:00
</td>
</tr>
<tr>
<td>
99999999003
</td>
<td>
1234562
</td>
<td>
ME
</td>
<td>
2007-09-28 00:00:00
</td>
</tr>
<tr>
<td>
99999999004
</td>
<td>
1234562
</td>
<td>
ME
</td>
<td>
2008-07-28 00:00:00
</td>
</tr>
</tbody>
</table>
<pre style="background-color: rgb(238, 238, 255);">
<http://hospital.example/DB/Person/ID.1234561#record>
hl7:substanceAdministration <http://hospital.example/DB/Item_Medication/ID.99999999002#record> .
<http://hospital.example/DB/Item_Medication/ID.99999999002#record>
a hl7:SubstanceAdministration ;
hl7:effectiveTime _:t1 .
_:t1 hl7:start "2007-09-28T00:00:00"^^xsd:dateTime .
<http://hospital.example/DB/Person/ID.1234562#record>
hl7:substanceAdministration <http://hospital.example/DB/Item_Medication/ID.99999999003#record> ;
hl7:substanceAdministration <http://hospital.example/DB/Item_Medication/ID.99999999004#record> .
<http://hospital.example/DB/Item_Medication/ID.99999999003#record>
a hl7:SubstanceAdministration ;
hl7:effectiveTime _:t2 .
_:t2 hl7:start "2007-09-28T00:00:00"^^xsd:dateTime .
<http://hospital.example/DB/Item_Medication/ID.99999999004#record>
a hl7:SubstanceAdministration ;
hl7:effectiveTime _:t3 .
_:t3 hl7:start "2008-07-28T00:00:00"^^xsd:dateTime .
</pre><em>Medication</em>
<table cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
ID
</th>
<th>
ItemID
</th>
<th>
Dose
</th>
<th>
Refill
</th>
<th>
QuantityToDispense
</th>
<th>
DaysToTake
</th>
<th>
PrescribedByID
</th>
<th>
MedDictDE
</th>
</tr>
<tr>
<td>
88888888002
</td>
<td>
99999999002
</td>
<td>
2
</td>
<td>
6
</td>
<td>
180
</td>
<td>
45
</td>
<td>
1004682
</td>
<td>
132139
</td>
</tr>
<tr>
<td>
88888888003
</td>
<td>
99999999002
</td>
<td>
2
</td>
<td>
0
</td>
<td>
180
</td>
<td>
45
</td>
<td>
1004683
</td>
<td>
132139
</td>
</tr>
<tr>
<td>
88888888004
</td>
<td>
99999999003
</td>
<td>
2
</td>
<td>
6
</td>
<td>
180
</td>
<td>
45
</td>
<td>
1004682
</td>
<td>
132139
</td>
</tr>
<tr>
<td>
88888888005
</td>
<td>
99999999004
</td>
<td>
4
</td>
<td>
6
</td>
<td>
180
</td>
<td>
45
</td>
<td>
1004682
</td>
<td>
132139
</td>
</tr>
</tbody>
</table>
<pre style="background-color: rgb(238, 238, 255);">
<http://hospital.example/DB/Item_Medication/ID.99999999002#record>
hl7:consumable <http://hospital.example/DB/Medication_DE/ID.132139#record> .
_:t1 hl7:durationInDays 45 .
<http://hospital.example/DB/Item_Medication/ID.99999999003#record>
hl7:consumable <http://hospital.example/DB/Medication_DE/ID.132139#record> .
<http://hospital.example/DB/Item_Medication/ID.99999999004#record>
hl7:consumable <http://hospital.example/DB/Medication_DE/ID.132139#record> .
_:t2 hl7:durationInDays 45 .
<http://hospital.example/DB/Item_Medication/ID.99999999005#record>
hl7:consumable <http://hospital.example/DB/Medication_DE/ID.132139#record> .
_:t3 hl7:durationInDays 45 .
</pre><em>Medication_DE</em>
<table cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
ID
</th>
<th>
Entry
</th>
<th>
EntryCode
</th>
<th>
EntryName
</th>
<th>
NDC
</th>
<th>
Strength
</th>
<th>
Form
</th>
<th>
UnitOfMeasure
</th>
<th>
DrugName
</th>
<th>
DisplayName
</th>
</tr>
<tr>
<td>
132139
</td>
<td>
131933
</td>
<td>
98630
</td>
<td>
GlipiZIDE-Metformin HCl 2.5-250 MG Tablet
</td>
<td>
54868079500
</td>
<td>
2.5-250
</td>
<td>
TABS
</td>
<td>
MG
</td>
<td>
GlipiZIDE-Metformin HCl
</td>
<td>
GlipiZIDE-Metformin HCl 2.5-250 MG Tablet
</td>
</tr>
</tbody>
</table>
<pre style="background-color: rgb(238, 238, 255);">
<http://hospital.example/DB/Medication_DE/ID.132139#record>
hl7:displayName "GlipiZIDE-Metformin HCl 2.5-250 MG Tablet" .
</pre><em>NDCcodes</em>
<table cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
ingredient
</th>
<th>
RxCUI
</th>
<th>
labelType
</th>
<th>
name
</th>
<th>
NDC
</th>
</tr>
<tr>
<td>
6809
</td>
<td>
351273
</td>
<td>
Clinical
</td>
<td>
Glipizide 2.5 MG / Metformin 500 MG Oral Tablet
</td>
<td>
54868079500
</td>
</tr>
</tbody>
</table>
<pre style="background-color: rgb(238, 238, 255);">
<http://hospital.example/DB/Medication_DE/ID.132139#record>
spl:activeIngredient _:i1 .
_:i1 spl:classCode 54868079500 .
</pre>
<pre style="background-color: rgb(238, 255, 238);">
[ a sdtm:ConcomitantMedication ;
sdtm:subject <http://hospital.example/DB/Person/ID.1234561#record> ;
sdtm:standardizedMedicationName "GlipiZIDE-Metformin HCl 2.5-250 MG Tablet" ;
hl7:activeIngredient [hl7:classCode 54868079500 ] ;
sdtm:startDateTimeOfMedication "2007-09-28 00:00:00"^^xsd:dateTime ] .
[ a sdtm:ConcomitantMedication ;
sdtm:subject <http://hospital.example/DB/Person/ID.1234562#record> ;
sdtm:standardizedMedicationName "GlipiZIDE-Metformin HCl 2.5-250 MG Tablet" ;
hl7:activeIngredient [ hl7:classCode 54868079500 ] ;
sdtm:startDateTimeOfMedication "2007-09-28 00:00:00"^^xsd:dateTime ] .
[ a sdtm:ConcomitantMedication ;
sdtm:subject <http://hospital.example/DB/Person/ID.1234562#record> ;
sdtm:standardizedMedicationName "GlipiZIDE-Metformin HCl 2.5-250 MG Tablet" ;
hl7:activeIngredient [ hl7:classCode 54868079500 ] ;
sdtm:startDateTimeOfMedication "2008-07-28 00:00:00"^^xsd:dateTime ] .
</pre>
<div class="div3">
<h4>
<a name="HCLS-query" id="HCLS-query"></a>2.1.1 Queries Over the RDF Graph
</h4>
<p>
The use case can be realised as a SPARQL query over the RDF graphs. The following is a SPARQL query, which extracts patients taking a particular class of medication, an anticoagulant, and not another (weight loss, here).
</p>
<pre>
PREFIX sdtm: <http://www.sdtm.org/vocabulary#>
PREFIX spl: <http://www.hl7.org/v3ballot/xml/infrastructure/vocabulary/vocabulary#>
SELECT ?patient ?dob ?sex # ?takes ?indicDate ?indicEnd ?contra
WHERE {
?patient a sdtm:Patient ;
sdtm:middleName ?middleName ;
sdtm:dateTimeOfBirth ?dob ;
sdtm:sex ?sex .
[ sdtm:subject ?patient ;
sdtm:standardizedMedicationName ?takes ;
spl:activeIngredient [ spl:classCode 6809 ] ;
sdtm:startDateTimeOfMedication ?indicDate
] .
OPTIONAL {
[ sdtm:subject ?patient ;
sdtm:standardizedMedicationName ?disqual ;
spl:activeIngredient [ spl:classCode 11289 ]
sdtm:startDateTimeOfMedication ?indicDate
] }
} LIMIT 30
</pre>
</div>
<div class="div3">
<h4>
<a name="HCLS-req" id="HCLS-req"></a>2.1.2 Derived Requirements
</h4>
<p>
This use case leads to the following requirements:
</p>
<ul>
<li>Map relational data to an RDF schema derived from the relational schema.
</li>
<li>Create a virtual RDF view that is used to translate SPARQL queries over the RDF views to SQL queries over the relational data.
</li>
<li>Mapping of relational data types to RDF/XML datatypes, for example, SQL date/time formats to XML Schema date/time formats.
</li>
<li>Mapping column names to RDF property names, for example, the column <code>DaysToTake</code> from the <code>Medication</code> table is mapped to <code>hl7:durationInDays</code>.
</li>
</ul>
</div>
</div>
<div class="div2">
<h3>
<a name="WP" id="WP"></a>2.2 UC2 - Web applications (Wordpress)
</h3>
<p>
In order to make the Web of Data useful to ordinary Web users, RDF and OWL have to be deployed on the Web on a much larger scale. Web applications such as Content Management Systems, online shops or community applications (e.g. Wikis, blogs, forums) already store their data in relational databases. Providing a standardized way to map the relational data and schema behind these Web applications into RDF, RDF-Schema and OWL will facilitate novel semantic browsing and search applications.
</p>
<p>
By supporting the long tail of Web applications and thus counteracting the centralization of the Web 2.0 applications, the planned RDB2RDF standardization will help to give control over data back to end-users and thus promote a democratization of the Web.
</p>
<p>
To support this use case, the mapping language should be easily implementable for lightweight Web applications and have a shallow learning curve to foster early adoption by Web developers.
</p>
<p>
We illustrate this use case with the example of Wordpress. <a href="http://wordpress.org/" class="external text" title="http://wordpress.org/">Wordpress</a> is a popular blogging Web application and installed on tens of thousands of Web servers. Wordpress used a relational database (MySQL) with a relatively simple schema:
</p><img src="wp_schema.png" alt="Wordpress SQL Schema" />
<p>
Wordpress SQL Schema:
</p>
<ul>
<li>
<a href="http://www.w3.org/2001/sw/rdb2rdf/wiki/images/1/11/Wordpress_blog.sql.txt" class="external text" title="http://www.w3.org/2001/sw/rdb2rdf/wiki/images/1/11/Wordpress_blog.sql.txt">SQL Schema</a>
</li>
<li>
<a href="http://www.w3.org/2001/sw/rdb2rdf/wiki/images/5/53/Aksw_blog.sql.txt" class="external text" title="http://www.w3.org/2001/sw/rdb2rdf/wiki/images/5/53/Aksw_blog.sql.txt">SQL Schema and complete data of blog.aksw.org</a>
</li>
<li>
<a href="http://www.w3.org/2001/sw/rdb2rdf/wiki/images/5/57/Aksw-blog.nt.txt" class="external text" title="http://www.w3.org/2001/sw/rdb2rdf/wiki/images/5/57/Aksw-blog.nt.txt">NTriples export of the above database</a> created using <a href="http://Triplify.org" class="external text" title="http://Triplify.org">Triplify</a>
</li>
</ul>
<p>
A mapping should be able to reuse existing vocabularies.
</p>
<p>
Mapped to RDF the resulting ontology should contain the classes post, attachment, tag, category, user and comment. An example instance of the post class, for example, should look like:
</p>
<pre>
@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dc11: <http://purl.org/dc/elements/1.1/> .
<<a href="http://blog.aksw.org/triplify/post/8" class="external free" title="http://blog.aksw.org/triplify/post/8">http://blog.aksw.org/triplify/post/8</a>> <a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" class="external free" title="http://www.w3.org/1999/02/22-rdf-syntax-ns#type">a</a> <a href="http://rdfs.org/sioc/ns#Post" class="external free" title="http://rdfs.org/sioc/ns#Post">sioc:Post</a> .
<<a href="http://blog.aksw.org/triplify/post/8" class="external free" title="http://blog.aksw.org/triplify/post/8">http://blog.aksw.org/triplify/post/8</a>> <a href="http://rdfs.org/sioc/ns#has_creator" class="external free" title="http://rdfs.org/sioc/ns#has_creator">sioc:has_creator</a> <<a href="http://blog.aksw.org/triplify/user/5" class="external free" title="http://blog.aksw.org/triplify/user/5">http://blog.aksw.org/triplify/user/5</a>> .
<<a href="http://blog.aksw.org/triplify/post/8" class="external free" title="http://blog.aksw.org/triplify/post/8">http://blog.aksw.org/triplify/post/8</a>> <a href="http://purl.org/dc/terms/created" class="external free" title="http://purl.org/dc/terms/created">dc:created</a> "2007-02-27T17:23:36"^^<<a href="http://www.w3.org/2001/XMLSchema#dateTime" class="external free" title="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>> .
<<a href="http://blog.aksw.org/triplify/post/8" class="external free" title="http://blog.aksw.org/triplify/post/8">http://blog.aksw.org/triplify/post/8</a>> <a href="http://purl.org/dc/elements/1.1/title" class="external free" title="http://purl.org/dc/elements/1.1/title">dc11:title</a> "Submissions open: 3rd Workshop on Scripting for the Semantic Web" .
<<a href="http://blog.aksw.org/triplify/post/8" class="external free" title="http://blog.aksw.org/triplify/post/8">http://blog.aksw.org/triplify/post/8</a>> <a href="http://rdfs.org/sioc/ns#content" class="external free" title="http://rdfs.org/sioc/ns#content">sioc:content</a> "The submissions web-site is now open for the 3rd Workshop on Scripting for the Semantic Web..." .
<<a href="http://blog.aksw.org/triplify/post/8" class="external free" title="http://blog.aksw.org/triplify/post/8">http://blog.aksw.org/triplify/post/8</a>> <a href="http://purl.org/dc/terms/modified" class="external free" title="http://purl.org/dc/terms/modified">dc:modified</a> "2008-02-22T21:41:00"^^<<a href="http://www.w3.org/2001/XMLSchema#dateTime" class="external free" title="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>> .
</pre>
<div class="div3">
<h4>
<a name="WP-query" id="WP-query"></a>2.2.1 Queries Over the RDF Graph
</h4>
<p>
An example SPARQL query on the resulting ontology could be:
</p>
<pre>
SELECT ?name, ?title
WHERE {
?post rdf:type sioc:Post .
?post dc:title ?title .
?post dc:has_creator ?author
?author foaf:name ?name
}
</pre>
</div>
<div class="div3">
<h4>
<a name="WP-req" id="WP-req"></a>2.2.2 Derived Requirements
</h4>
<p>
This use case leads to the following requirements:
</p>
<ul>
<li>Support Extract-Transform-Load (ETL) for the created RDF by the mapping.
</li>
</ul>
</div>
</div>
<div class="div2">
<h3>
<a name="tax" id="tax"></a>2.3 UC3 - Integrating Enterprise Relational databases for tax control
</h3>
<p>
Integrating relational databases and exposing them on the Web or Intranet requires the re-use of unique identifiers in order to integrate and interlink data about entities on different databases.
</p>
<p>
The re-use of unique identifiers allows:
</p>
<ul>
<li>Joins between entities described in different databases.
</li>
<li>Join structured data (SQL) to structured data, from incompatible schema, or where data is dirty, poorly normalized, lacking proper keys/indices.
</li>
</ul>
<p>
This use case is a pilot project for the Trentino region tax agency. Trentino is an autonomous region in the north of Italy. The region has a population of 1 million people and more than 200 municipalities with their own information systems. The goal of is to integrate and link tax related data about people, organizations, buildings, etc. This data come from different databases especially from the region's many municipalities, each with their own individual data structures.
</p>
<p>
The re-use of unique identifiers will provide a lightweight method for aggregating the data. In this way we are providing a tax agent an intelligent tool for navigating through the data present in the many different databases. Using unique identifiers, a tool can aggregate data and create a profile for each tax payer. Each user profile shows different type of information, with links to other entities such as the buildings owned, payments made, location of residence etc.
</p>
<p>
The RDF generated from the two databases is materialized and joined using the generated unique identifiers.
</p>
<p>
<em>Example</em>
</p>
<p>
Supposed that we have two tables (<code>Anagrafe</code> and <code>Urban_Cadastre</code>) from different databases, we select some typical attributes for the two tables to explain our conversion method. Table <code>Angrafe</code> includes the information about two type of entities, persons and locations (a person's residence place), and some other information:
</p>
<table cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
Firstname
</th>
<th>
Lastname
</th>
<th>
City_Residence_Place
</th>
<th>
Country_Residence_Place
</th>
<th>
Other_Info
</th>
</tr>
<tr>
<td>
Paolo
</td>
<td>
Bouquet
</td>
<td>
Trento
</td>
<td>
Italy
</td>
<td>
xyz...
</td>
</tr>
</tbody>
</table>
<p>
Table <code>Urban_Cadastre</code> contains the information about buildings and their owners:
</p>
<table cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
Owner_Name
</th>
<th>
Building_LocalID
</th>
<th>
Building_Address
</th>
<th>
Building_Type
</th>
</tr>
<tr>
<td>
Paolo Bouquet
</td>
<td>
123456
</td>
<td>
VIA G.LEOPARDI
</td>
<td>
3
</td>
</tr>
</tbody>
</table>
<p>
<em>DDL</em>:
</p>
<pre>
CREATE TABLE Anagrafe (
Firstname varchar
Lastname varchar
City_Residence_Place varchar
Country_Residence_Place varchar
Other_Info varchar
PRIMARY KEY (Firstname, Lastname)
)
CREATE TABLE (
Owner_Name varchar
Building_LocalID integer
Building_Address varchar
Building_Type varchar
PRIMARY KEY (Owner_Name)
)
</pre>
<p>
Using traditional RDB2RDF translation methods the RDF representation for the two example tables coming from two different databases is shown below:
</p>
<pre>
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix database_anagrafe: <http://www.database1.org/anagrafe/> .
database_anagrafe:entry_row1 database_anagrafe:Other_Info "xyz" ;
database_anagrafe:Country_Residence_Place "Italy" ;
database_anagrafe:City_Residence_Place "Trento" ;
database_anagrafe:Last_Name "Bouquet" ;
database_anagrafe:First_Name "Paolo" .
</pre>
<pre>
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix database_urbano: <http://www.database1.org/Urban_Cadastre/> .
database_urbano:entry_row1 database_urbano:Building_Type "3" ;
database_urbano:Building_Address "VIA G.LEOPARDI" ;
database_urbano:Building_LocalID "123456" ;
database_urbano:Owner_Name "Paolo Bouquet" .
</pre>
<div class="div3">
<h4>
<a name="tax-query" id="tax-query"></a>2.3.1 Querying
</h4>
<p>
If we wanted to query these two tables, we would have to create a unique identifier, such as <code>http://www.example.org/Paolo_Bouquet</code> for Paolo Bouquet, to refer to entities in order to join descriptions about the same entity coming from different data sources.
</p>
</div>
<div class="div3">
<h4>
<a name="tax-req" id="tax-req"></a>2.3.2 Derived Requirements
</h4>
<p>
This use case leads to the following requirements:
</p>
<ul>
<li>Create unique identifiers for the entities described by the data.
</li>
</ul>
</div>
</div>
<div class="div2">
<h3>
<a name="rCAD" id="rCAD"></a>2.4 UC4 - rCAD: RNA Comparative Analysis Database
</h3>
<p>
rCAD - RNA Comparative Analysis using SQLServer: the tremendous increase in available biological information creates opportunities to decipher the structure, function and evolution of cellular components while presenting new computational challenges for performance and scalability. To fully utilize this large increase in knowledge, it must be organized for efficient retrieval and integrated for multi-dimensional analysis. Given this, biologists are able to invent new comparative sequence analysis protocols that will yield new and different structural and functional information. Based on Microsoft SQL-server, we have designed and <a href="http://research.microsoft.com/apps/video/default.aspx?id=103865" class="external text" title="http://research.microsoft.com/apps/video/default.aspx?id=103865">implemented the RNA Comparative Analysis Database - rCAD</a> which supports comparative analysis of RNA sequence and structure, and unites, for the first time in a single environment, multiple dimensions of information necessary for alignment viewing, sequence metadata, structural annotations, structure prediction studies, structural statistics of different motifs, and phylogenetic analysis. This system provides a queryable environment that hosts efficient updates and rich analytics.
</p>
<p>
For this use-case, we will be presenting only the Sequence Alignment schema. The SQL-DDL for Microsoft SQL Server can be found here: <a href="http://userweb.cs.utexas.edu/%7Ejsequeda/rCAD_Alignment.sql" class="external text" title="http://userweb.cs.utexas.edu/~jsequeda/rCAD_Alignment.sql">rCAD Sequence Alignment SQL DDL</a>
</p>
<p>
This use-case presents the issue of a schema that does not have an existing domain ontology in which it can be mapped to. The closest domain ontology is the <a href="http://bioportal.bioontology.org/ontologies/3083" class="external text" title="http://bioportal.bioontology.org/ontologies/3083">Multiple Alignment Ontology (MAO)</a> which can only be mapped to the Sequence Alignment part of the entire rCAD database. However, MAO is in the OBO language. Nevertheless, <a href="http://sunsite.informatik.rwth-aachen.de/Publications/CEUR-WS/Vol-559/Paper6.pdf" class="external text" title="http://sunsite.informatik.rwth-aachen.de/Publications/CEUR-WS/Vol-559/Paper6.pdf">OBO ontologies can be translated to OWL (and back)</a>.
</p>
<div class="div3">
<h4>
<a name="d1e859" id="d1e859"></a>2.4.1 Expose Relational Data as RDF when there is no existing Domain Ontology to map the relational schema to
</h4>
<p>
Rob from the RNA lab would like to expose the Sequence Alignment data from the rCAD database as RDF. However, there is no existing domain ontology in which the relational schema can be mapped to. Therefore, an ontology should be derived automatically from the relational schema. The RDF data will become instance of this automatically generated ontology.
</p>
<p>
The Alignment table from the rCAD database is the following:
</p>
<pre>
CREATE TABLE [AlignmentClassic].[Alignment] (
[AlnID] int NOT NULL,
[SeqTypeID] tinyint NOT NULL,
[AlignmentName] varchar(max) NULL,
[ParentAlnID] int NULL,
[NextColumnNumber] int NOT NULL,
CONSTRAINT [PK_Alignment] PRIMARY KEY([AlnID])
)
ON [PRIMARY]
GO
ALTER TABLE [AlignmentClassic].[Alignment]
ADD CONSTRAINT [FK_Alignment_SequenceType]
FOREIGN KEY([SeqTypeID])
REFERENCES [dbo].[SequenceType]([SeqTypeID])
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO
ALTER TABLE [AlignmentClassic].[Alignment]
ADD CONSTRAINT [FK_Alignment_Alignment]
FOREIGN KEY([ParentAlnID])
REFERENCES [AlignmentClassic].[Alignment]([AlnID])
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO
</pre>
<p>
and the desired ontology that is generated automatically from the relational schema is the following:
</p>
<pre>
PREFIX rcad: <http://rcad.org/vocabulary/rcad.owl#>
rcad:Alignment rdf:type owl:Class .
rcad:AlignmentName rdf:type owl:DatatypeProperty.
rcad:AlignmentName rdfs:domain rcad:Alignment.
rcad:AlignmentName rdfs:range xsd:string.
rcad:NextColumnNumber rdf:type owl:DatatypeProperty.
rcad:NextColumnNumber rdfs:domain rcad:Alignment.
rcad:NextColumnNumber rdfs:range xsd:integer.
rcad:ParentAlnID rdf:type owl:ObjectProperty
rcad:ParentAlnID rdfs:domain rcad:Alignment
rcad:ParentAlnID rdfs:range rcad:Alignment
</pre>
<p>
and the desired RDF triples, which are instances of the automatically generated ontology are the following:
</p>
<pre>
PREFIX rcad: <http://rcad.org/vocabulary/rcad.owl#>
PREFIX rcad-data: <http://rcad.org/vocabulary/rcad-data.rdf#>
rcad-data:alignment1000 a rcad:Alignment;
rcad:AlignmentName "My Alignment 1000"^^xsd:string;
rcad:NextColumnNumber "123"^^xsd:int;
rcad:ParentAlnID rcad-data:alignment2000
</pre>
</div>
<div class="div3">
<h4>
<a name="d1e876" id="d1e876"></a>2.4.2 Expose Mapping a Relational Database to an OWL DL ontology
</h4>
<p>
Rob, from the RNA lab would like to expose the Sequence Alignment data from the rCAD database as RDF. Just recently the Multiple Alignment Ontology (MAO) as been released, which is an "<a href="http://bioportal.bioontology.org/ontologies/3083" class="external text" title="http://bioportal.bioontology.org/ontologies/3083">ontology for data retrieval and exchange in the fields of multiple DNA/RNA alignment, protein sequence and protein structure alignment.</a>" However, this ontology has been developed in OBO. Nevertheless, OBO ontologies can be translated to OWL ontologies, specifically OWL DL. Therefore, Rob will like to map his rCAD database to the MAO ontology
</p>
<p>
The Alignment and Alignment Column tables from the rCAD database is the following:
</p>
<pre>
CREATE TABLE [AlignmentClassic].[Alignment] (
[AlnID] int NOT NULL,
[SeqTypeID] tinyint NOT NULL,
[AlignmentName] varchar(max) NULL,
[ParentAlnID] int NULL,
[NextColumnNumber] int NOT NULL,
CONSTRAINT [PK_Alignment] PRIMARY KEY([AlnID])
)
GO
ALTER TABLE [AlignmentClassic].[Alignment]
ADD CONSTRAINT [FK_Alignment_SequenceType]
FOREIGN KEY([SeqTypeID])
REFERENCES [dbo].[SequenceType]([SeqTypeID])
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO
ALTER TABLE [AlignmentClassic].[Alignment]
ADD CONSTRAINT [FK_Alignment_Alignment]
FOREIGN KEY([ParentAlnID])
REFERENCES [AlignmentClassic].[Alignment]([AlnID])
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO
---
CREATE TABLE [AlignmentClassic].[AlignmentColumn] (
[AlnID] int NOT NULL,
[ColumnNumber] int NOT NULL,
[ColumnOrdinal] int NOT NULL,
CONSTRAINT [PK_AlignmentColumn] PRIMARY KEY([AlnID],[ColumnNumber])
)
GO
ALTER TABLE [AlignmentClassic].[AlignmentColumn]
ADD CONSTRAINT [FK_AlignmentColumn_Alignment]
FOREIGN KEY([AlnID])
REFERENCES [AlignmentClassic].[Alignment]([AlnID])
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO
</pre>
<p>
This is just part of the <a href="http://www.berkeleybop.org/ontologies/obo-all/mao/mao.owl">Multiple Alignment Ontology</a> in OWL DL.
</p>
</div>
<div class="div3">
<h4>
<a name="rCAD-req" id="rCAD-req"></a>2.4.3 Derived Requirements
</h4>
<p>
This use case leads to the following requirements:
</p>
<ul>
<li>Map relational data to an RDF schema derived from the relational schema.
</li>
<li>Map from the local ontology to a domain ontology.
</li>
<li>Allow transformation of SPARQL queries over the RDF view into efficient SQL queries.
</li>
</ul>
</div>
</div>
</div>
<div class="div1">
<h2>
<a name="reqs" id="reqs"></a>3 Requirements
</h2>
<div class="div2">
<p>
Following is a set of proposed requirements for R2RML.
</p>
<h3>
<a name="reqs-core" id="reqs-core"></a>3.1 Core Requirements
</h3>
<p>
The analysis of the above use cases yields a set of core requirements for the R2RML.
</p>
<div class="div3">
<h4>
<a name="DIRECT" id="DIRECT"></a>3.1.1 DIRECT - Direct Mapping
</h4>
<p>
Relational schema and data are a potentially cyclic graph where nodes are tables or tuples and edges are either foreign/primary key relationships or table attributes. This relational graph can be directly mapped to a RDF graph where the nodes of the relational graph correspond to the subject or object and the edges of the relational graph correspond to the predicate. This directly mapped RDF graph represents exactly the information in the relational database.
</p>
<p>
The relational schema can be directly mapped to a RDFS/OWL ontology while the relational data is directly mapped to a RDF graph, which is an instance of the RDFS/OWL ontology - this ontology is considered the <em>local ontology</em>. This local ontology can be used when it is desired to let the database schema determine the effective ontology of the RDF view. An example of direct mapping is shown in <a href="#justDirect">Section 3.1</a>.
</p>
<p>
A minimal configuration <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> provide a (virtual) RDF graph representing the attributes and relationships between tuples in the relational database.
</p>
<p>
This requirement comes from <a href="#HCLS">UC1</a> and <a href="#WP">UC2</a> as well as the first part of <a href="#rCAD">UC4</a>.
</p>
</div>
<div class="div3">
<h4>
<a name="TRANSFORM" id="TRANSFORM"></a>3.1.2 TRANSFORM - Transformative Mapping
</h4>
<p>
It is good Web of Data practice to re-use existing domain ontologies. Mapping between the relational graph or the local ontology with a domain ontology usually requires graph transformations <a href="#GraphTransform">[GraphTransform]</a>. An example of this mapping is shown in <a href="#databaseToOntology">Section 3.2</a>. The local ontology considers the teacher classification (Math, Physics, etc) as literal values while in the domain ontology the teacher classifications are RDFS/OWL classes.
</p>
<p>
The R2RML language <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> express transformations of the relational graph to produce the (virtual) RDF graph.
</p>
<p>
This requirement comes from the second part of <a href="#rCAD">UC4</a>.
</p>
</div>
<div class="div3">
<h4>
<a name="GUIDGEN" id="GUIDGEN"></a>3.1.3 GUIDGEN - Generation of Globally Unique Identifiers
</h4>
<p>
RDF identifiers for objects in the <a href="http://en.wikipedia.org/wiki/Conceptual_model">conceptual model</a> can, in some cases, be generated from a transformation of the schema and data in a tuple representing that conceptual model. For example, it may be sufficient to identify a patient in a clinical database with primary key <code>patientID</code> and value <code>1234561</code> as <code>http://myclinic.example/patient/patientID.12334561#x</code>, while but if the patient IDs are shared with another database, it will be necessary to transform one or both of these identifiers into a common form, e.g. <code>http://allclinics.example/sharedRecords/patient.12334561#y</code>. These use cases are labeled <code>custom-identifier</code>.
</p>
<p>
Given a row in a protein database with a primary key attribute "ID" and another unique attribute "uniProt":
</p>
<table cellpadding="2" cellspacing="0" border="1" summary="example of data">
<tbody>
<tr>
<th id="ID">
ID
</th>
<th id="uniProt">
uniProt
</th>
<th id="name">
name
</th>
<th id="seqLength">
seqLength
</th>
</tr>
<tr>
<th>
18
</th>
<th>
68250
</th>
<th>
YYHAB
</th>
<th>
246 AA
</th>
</tr>
</tbody>
</table>
<div class="note">
<p class="prefix">
<em>Note:</em>
</p>The RDB2RDF would like to ask the world which of the following subject mappings are likely to meet the most use cases:
<pre>
<http://mydb.example/prots/ID=18> db:name "YYHAB" . # consistent function of the primary key
<http://mydb.example/prots18/more/path> db:name "YYHAB" . # user-defined function of the primary key
<http://www.uniprot.org/uniprot/P68250> db:name "YYHAB" . # user-defined function of arbitrary attributes
</pre>
<p>
The former uses a potentially hard-coded formula, the middle uses a user-supplied function of the primary key and the latter uses a function of a different attribute to produce a common proteomic node label.
</p>
</div>
<p>
The R2RML language <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> allow for a mechanism to generate globally unique identifiers for database entities. The generation of identifiers should be designed to support the implementation of the Linked Data principles <a href="#LinkedData">[LinkedData]</a>. Where possible, R2RML <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em> encourage the reuse of public identifiers for long-lived entities such as persons, corporations and geo-locations.
</p>
<p>
This requirement comes from <a href="#tax">UC3</a>, but also found necessary in other use cases.
</p>
</div>
<div class="div3">
<h4>
<a name="SQLGEN" id="SQLGEN"></a>3.1.4 SQLGEN - Query Translation
</h4>
<p>
One use of R2RML is to materialize RDF views of data. Another is to define virtual RDF views, enabled by translating SPARQL queries over the RDF view into SQL queries over the original database.
</p>
<p>
The R2RML language <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> allow mapping specification to have sufficient information to enable transformation of SPARQL queries over the RDF view into efficient SQL queries over the relational database.
</p>
<p>
This requirement comes from the second part of <a href="#rCAD">UC4</a>.
</p>
</div>
<div class="div3">
<h4>
<a name="ETL" id="ETL"></a>3.1.5 ETL - Extract-Transform-Load
</h4>
<p>
In certain cases query access or entity-level access (see also explanation in <a href="#intro-whyrdb2rdf">Section 1.1 Why Mapping RDBs to RDF?</a> ) to the exposed RDF graph is not sufficient.
</p>
<p>
The R2RML language <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> allow the mapping to have sufficient information to provide a dump of the entire RDF graph (materialzed RDF graph).
</p>
<p>
This requirement comes from <a href="#WP">UC2</a>, but in fact all use cases require this.
</p>
</div>
<div class="div3">
<h4>
<a name="DATATYPES" id="DATATYPES"></a>3.1.6 DATATYPES - Datatypes
</h4>
<p>
Relational data types <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be treated consistently with RDF datatypes per SQL-XSD mapping <code>ISO IWD 9075-14:2011(E) Subclause 9.5, "Mapping SQL data types to XML Schema data types"</code>, possibly including XML datatypes defined at <a href="http://standards.iso.org/iso/9075/2003/sqlxml">http://standards.iso.org/iso/9075/2003/sqlxml</a>.
</p>
<p>
This requirement comes from <a href="#HCLS">UC1</a>, but in fact all use cases require this.
</p>
</div>
<div class="div3">
<h4>
<a name="VSDATATYPES" id="VSDATATYPES"></a>3.1.7 VSDATATYPES - Database Vendor Specific Datatypes
</h4>
<p>
The R2RML language <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> provide an extensibility mechanism to allow for mapping database vendor-specific data types.
</p>
</div>
<div class="div3">
<h4>
<a name="RENAMECOL" id="RENAMECOL"></a>3.1.8 RENAMECOL - Ability to Rename SQL Column Names
</h4>
<p>
When mapping from a relational schema to an RDF Schema or OWL ontology and column names are mapped to property names, it <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be possible to rename the property names.
</p>
<p>
This requirement comes from <a href="#HCLS">UC1</a>.
</p>
</div>
<div class="div3">
<h4>
<a name="APPLYFUNCTIONBEFOREMAP" id="APPLYFUNCTIONBEFOREMAP"></a>3.1.9 APPLYFUNCTION - Apply a Function before Mapping
</h4>
<p>
In some cases, what you want to map is not the original value in the database but the result of applying a function to the value. For example, the value may be temperature in Centigrade and you may want to convert to Fahrenheit. Or from Euros to Dollars. It is easy to think of other examples. Position may be stored as a tuple <code>(latitude, longitude</code> and you may want to map to two separate properties. Or the address may be stored in a number of columns and you may want to map as a single string. A more complex example: a database row might contain Wiki text, which should be transformed into HTML. This can be achieved, for example, by using standard or user defined SQL functions or using <a href="http://www.w3.org/TR/xquery-operators/">XQuery/XPath Functions and Operators</a>.
</p>
<p>
The mapping language <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em> allow for applying a function before mapping.
</p>
</div>
<div class="div3">
<h4>
<a name="Exposing_many-to-many_join_tables_as_simple_triples" id="Exposing_many-to-many_join_tables_as_simple_triples"></a>3.1.10 MANYTOMANY - Exposing many-to-many join tables as simple triples
</h4>
<p>
Relational databases typically use three tables to represent Many-to-Many relationships. This requirements is to allow such relationships to be mapped using direct links between the entities.
</p>
<table style="float:right; padding: 1em;" cellpadding="2" cellspacing="0" border="1" summary="example of data">
<tbody>
<tr>
<th>
TeacherID
</th>
<th>
TeacherName
</th>
</tr>
<tr>
<td>
1
</td>
<td>
Adams
</td>
</tr>
<tr>
<td>
2
</td>
<td>
Baker
</td>
</tr>
<tr>
<td>
3
</td>
<td>
Clark
</td>
</tr>
<tr>
<td>
...
</td>
<td>
...
</td>
</tr>
</tbody>
</table>
<table style="float:right; padding: 1em;" cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
StudentId
</th>
<th>
TeacherID
</th>
</tr>
<tr>
<td>
1
</td>
<td>
1
</td>
</tr>
<tr>
<td>
1
</td>
<td>
2
</td>
</tr>
<tr>
<td>
2
</td>
<td>
3
</td>
</tr>
<tr>
<td>
3
</td>
<td>
2
</td>
</tr>
<tr>
<td>
...
</td>
<td>
...
</td>
</tr>
</tbody>
</table>
<table style="float:right; padding: 1em;" cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
StudentId
</th>
<th>
StudentName
</th>
</tr>
<tr>
<td>
1
</td>
<td>
Davis
</td>
</tr>
<tr>
<td>
2
</td>
<td>
Evans
</td>
</tr>
<tr>
<td>
3
</td>
<td>
Frank
</td>
</tr>
<tr>
<td>
...
</td>
<td>
...
</td>
</tr>
</tbody>
</table>
<p>
The community's school district maintains an RDB with basic student and personnel information, including a <code>STUDENTS</code> and a <code>TEACHERS</code> table. The relationship between the two is given in a <code>STUDENT_TEACHER</code> table:
</p>
<p>
The SQL DDL for these tables are the following:
</p>
<pre>
CREATE TABLE student (
studentID int PRIMARY KEY,
studentName varchar
)
CREATE TABLE teacher (
teacherID int PRIMARY KEY,
teacherName varchar
)
CREATE TABLE student_teacher (
studentID int,
teacherID int,
PRIMARY KEY(studentID, teacherID),
FOREIGN KEY(studentID) REFERENCES student(studentID),
FOREIGN KEY(teacherID) REFERENCES teacher(teacherID)
)
</pre>
<p>
SemantEducaTrix, the most recent Semantic Web company to burst into the educational software market, is mapping the school system's relational database to RDF/SPARQL. They'd like to access the relationships modelled with this join table as simple links between students and teachers:
</p>
<pre>
ex:student1 ex:studentName "Davis".
ex:student2 ex:studentName "Evans".
ex:student2 ex:studentName "Frank".
</pre>
<pre>
ex:teacher1 ex:teacherName "Adams".
ex:teacher2 ex:teacherName "Baker".
ex:teacher3 ex:teacherName "Clark".
</pre>
<pre>
ex:student1 ex:has_teacher ex:teacher1, ex:teacher 2 ;
ex:student2 ex:has_teacher ex:teacher3 ;
ex:student3 ex:has_teacher ex:teacher2 ;
...
</pre>
</div>
<div class="div3">
<h4>
<a name="CLASSESFROMATTRIBVALUES" id="CLASSESFROMATTRIBVALUES"></a>3.1.11 CLASSESFROMATTRIBVALUES - Creating Classes based on Attribute Values
</h4>
<p>
The requirement is for creating multiple classes from a single column based on the values of a related attribute.
</p>
<p>
The <code>TEACHERS</code> table, see above, has a <code>Classification</code> column:
</p>
<table cellpadding="2" cellspacing="0" border="1">
<tbody>
<tr>
<th>
TeacherId
</th>
<th>
Classification
</th>
<th>
...
</th>
</tr>
<tr>
<td>
1
</td>
<td>
History
</td>
<td></td>
</tr>
<tr>
<td>
2
</td>
<td>
Physics
</td>
<td></td>
</tr>
<tr>
<td>
3
</td>
<td>
Music
</td>
<td></td>
</tr>
</tbody>
</table>
<p>
SemantEducaTrix wants to instantiate these teachers as different {{{rdf:type}}}s depending on the value in the <code>Classification</code> column:
</p>
<pre>
ex:teacher1 a ex:HistoryTeacher .
ex:teacher2 a ex:PhysicsTeacher .
ex:teacher3 a ex:MusicTeacher .
</pre>
</div>
</div>
<div class="div2">
<h3>
<a name="reqs-optional" id="reqs-optional"></a>3.2 Optional Requirements
</h3>
<div class="div3">
<h4>
<a name="NAMEDGRAPH" id="NAMEDGRAPH"></a>3.2.1 NAMEDGRAPH - Named Graphs
</h4>
<p>
The mapping language <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em> enable the creation of multiple Named Graphs within one mapping definition.
</p>
</div>
<div class="div3">
<h4>
<a name="NSDECL" id="NSDECL"></a>3.2.2 NSDECL - Namespace declaration
</h4>
<p>
The mapping language <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em> enable the declaration and use of namespace prefixes.
</p>
</div>
<div class="div3">
<h4>
<a name="METADATA" id="METADATA"></a>3.2.3 METADATA - Static Metadata
</h4>
<p>
The mapping language <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em> enable the attachment of static metadata (such as licensing information) to all RDF entities or instances of a certain class. This is in particular important, when RDF is published as Linked Data on the Web, for example when one wants to state that the dataset at hand is available under a certain license, such as the <a href="http://www.opendatacommons.org/licenses/pddl/">Public Domain Dedication and License</a>.
</p>
<table border="1" summary="Editorial note">
<tr>
<td align="left" valign="top">
<em>Editorial note</em>
</td>
<td align="right" valign="top"></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">
See also next requirement which could be considered a special case of static metadata.
</td>
</tr>
</table>
</div>
<div class="div3">
<h4>
<a name="PROVENANCE" id="PROVENANCE"></a>3.2.4 PROVENANCE - Provenance
</h4>
<p>
The mapping language <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em> support the preservation of provenance by generating additional RDF triples according to a provenance vocabulary, such as <a href="http://purl.org/net/provenance/">http://purl.org/net/provenance/</a>.
</p>
</div>
<div class="div3">
<h4>
<a name="UPDATES" id="UPDATES"></a>3.2.5 UPDATES - Update Logs
</h4>
<p>
The mapping language <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em> provide extension points to support the creation of update logs of relational data.
</p>
<table border="1" summary="Editorial note">
<tr>
<td align="left" valign="top">
<em>Editorial note</em>
</td>
<td align="right" valign="top"></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">
Not really in the scope of R2RML, hence a nice-to-have feature.
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="div1">
<h2>
<a name="ack" id="ack"></a>4 Acknowledgments
</h2>
<p>
The editors gratefully acknowledge contributions from the members of the W3C RDB2RDF Working Group: Marcelo Arenas, Sören Auer, Samir Batla, Richard Cyganiak, Daniel Daniel Miranker, Souripriya Das, Alexander de Leon, Alexander de Leon, Orri Erling, Ahmed Ezzat, Lee Feigenbaum, Angela Fogarolli, Enrico Franconi, Howard Greenblatt, Wolfgang Halb, Harry Halpin, Nuno Lopes, Li Ma, Ashok Malhotra, Ivan Mikhailov, Juan Sequeda, Seema Sundara, Ben Szekely, Edward Thomas, and Boris Villazón-Terrazas.
</p>
</div>
<div class="div1">
<h2>
<a name="refs" id="refs"></a>5 References
</h2>
<dl>
<dt class="label">
<a name="DynaWebSites" id="DynaWebSites"></a>DynaWebSites
</dt>
<dd>
A survey on dynamic Web content generation and delivery techniques, Jayashree Ravi, Zhifeng Yu, Weisong Shi, 2009. (See http://www.cs.wayne.edu/~weisong/papers/ravi09-dynamic-content.pdf.)
</dd>
<dt class="label">
<a name="LinkedData" id="LinkedData"></a>LinkedData
</dt>
<dd>
Linked Data, Tim Berners-Lee, Design Issue Note, 2006. (See http://www.w3.org/DesignIssues/LinkedData.html.)
</dd>
<dt class="label">
<a name="SPARQL" id="SPARQL"></a>SPARQL
</dt>
<dd>
SPARQL Query Language for RDF, Eric Prud'hommeaux and Andy Seaborne 2008. (See http://www.w3.org/TR/rdf-sparql-query/.)
</dd>
<dt class="label">
<a name="SQL" id="SQL"></a>SQL
</dt>
<dd>
ISO (International Organization for Standardization). ISO/IEC 9075-2:1999, Information technology --- Database languages --- SQL --- Part 2: Foundation (SQL/Foundation). [Geneva]: International Organization for Standardization, 1999. (See http://www.iso.ch/cate/d26197.html.)
</dd>
<dt class="label">
<a name="RDF-RDB" id="RDF-RDB"></a>RDF-RDB
</dt>
<dd>
RDF Access to Relational Databases (See http://www.w3.org/2003/01/21-RDF-RDB-access/.)
</dd>
<dt class="label">
<a name="RDB-RDF" id="RDB-RDF"></a>RDB-RDF
</dt>
<dd>
Relational Databases on the Semantic Web, Tim Berners-Lee, Design Issue Note, 1998. (See http://www.w3.org/DesignIssues/RDB-RDF.html.)
</dd>
<dt class="label">
<a name="RDBMSMapping" id="RDBMSMapping"></a>RDBMSMapping
</dt>
<dd>
SWAD-Europe Deliverable 10.2: Mapping Semantic Web Data with RDBMSes, Dave Beckett and Jan Grant, 2003. (See http://www.w3.org/2001/sw/Europe/reports/scalable_rdbms_mapping_report/#sec-mapping.)
</dd>
<dt class="label">
<a name="RDB2RDFSurvey" id="RDB2RDFSurvey"></a>RDB2RDFSurvey
</dt>
<dd>
A Survey of Current Approaches for Mapping of Relational Databases to RDF, Satya S. Sahoo, Wolfgang Halb, Sebastian Hellmann, Kingsley Idehen, Ted Thibodeau Jr, Sören Auer, Juan Sequeda, Ahmed Ezzat, 2009. (See http://www.w3.org/2005/Incubator/rdb2rdf/RDB2RDF_SurveyReport.pdf.)
</dd>
<dt class="label">
<a name="GraphTransform" id="GraphTransform"></a>GraphTransform
</dt>
<dd>
Wikipedia Article on Graph rewriting (See http://en.wikipedia.org/wiki/Graph_rewriting.)
</dd>
<dt class="label">
<a name="RDF" id="RDF"></a>RDF
</dt>
<dd>
Resource Description Framework (RDF): Concepts and Abstract Syntax, G. Klyne, J. J. Carroll, Editors, W3C Recommendation, 10 February 2004 (See http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/.)
</dd>
<dt class="label">
<a name="ReuseableIDs" id="ReuseableIDs"></a>ReuseableIDs
</dt>
<dd>
Reusable Identifiers in the RDB2RDF mapping language, Michael Hausenblas and Themis Palpanas, 2009. (See http://esw.w3.org/topic/Rdb2RdfXG/ReusableIdentifier.)
</dd>
<dt class="label">
<a name="URI" id="URI"></a>URI
</dt>
<dd>
RFC3986 - Uniform Resource Identifier (URI): Generic Syntax (See http://tools.ietf.org/html/rfc3986.)
</dd>
</dl>
</div>
</div>
<div class="back">
<div class="div1">
<h2>
<a name="glossary" id="glossary"></a>A Glossary (Non-Normative)
</h2>
<p>
<em>domain ontology</em> [<a name="glossary-do" id="glossary-do" title="">Definition</a>: an ontology that has been developed by experts in the domain and accepted by a community (for example, FOAF, SIOC, Gene Ontology, etc.)]
</p>
<p>
<em>graph</em> [<a name="glossary-gr" id="glossary-gr" title="">Definition</a>: TBD]
</p>
<p>
<em>entity</em> [<a name="glossary-en" id="glossary-en" title="">Definition</a>: TBD]
</p>
<p>
<em>federation</em> [<a name="glossary-fe" id="glossary-fe" title="">Definition</a>: TBD]
</p>
<p>
<em>identifier</em> [<a name="glossary-id" id="glossary-id" title="">Definition</a>: TBD]
</p>
<p>
<em>label</em> [<a name="glossary-la" id="glossary-la" title="">Definition</a>: TBD]
</p>
<p>
<em>local ontology</em> [<a name="glossary-lo" id="glossary-lo" title="">Definition</a>: an ontology that has been derived from the relational schema]
</p>
<p>
<em>named graph</em> [<a name="glossary-ng" id="glossary-ng" title="">Definition</a>: a graph that is given a URI, see <a href="#SPARQL">[SPARQL]</a> for details.]
</p>
<p>
<em>mapping</em> [<a name="glossary-ma" id="glossary-ma" title="">Definition</a>: TBD]
</p>
<p>
<em>vocabulary</em> [<a name="glossary-vo" id="glossary-vo" title="">Definition</a>: see ontology]
</p>
</div>
<div class="div1">
<h2>
<a name="approaches" id="approaches"></a>B RDB2RDF Mapping Approaches (Non-Normative)
</h2>
<p>
The RDB2RDF Working Group would like to call out, without specifically endorsing, three emergent approaches to mapping relational data to RDF.
</p>
<div class="div2">
<h3>
<a name="justDirect" id="justDirect"></a>B.1 Direct Mapping
</h3>
<p>
Supplying a relational database (schema and data) plus a stem URI defines an RDF graph, which emulates the relational schema. <img src="RDB2RDF_Option_1.jpg" alt="" />
</p>
</div>
<div class="div2">
<h3>
<a name="databaseToOntology" id="databaseToOntology"></a>B.2 Direct Mapping Plus Ontology Mapping
</h3>
<p>
The RDB2RDF may define a mapping semantics as a mapping to a direct graph, followed by the application of RDF graph transformations into an RDF graph in a final ontology. <img src="RDB2RDF_Option_2.jpg" alt="" />
</p>
</div>
<div class="div2">
<h3>
<a name="directPlusOnt" id="directPlusOnt"></a>B.3 Database to Ontology Mapping
</h3>
<p>
The RDB2RDF may define a mapping semantics as a single step process from database to an RDF graph in a final ontology. <img src="RDB2RDF_Option_3.jpg" alt="" />
</p>
</div>
</div>
</div>
</body>
</html>