sparql - 关于直接映射转换多对多关系的说明
解决方案
...从关系数据库转换多对多关系时出现问题
我想说直接映射引入了额外的“寄生”语义,将规范化伪影视为一流的对象。
让我们考虑D011-M2MRelations测试用例。
Student
+---------+-----------+----------+
| ID (PK) | FirstName | LastName |
+---------+-----------+----------+
| 10 | Venus | Williams |
| 11 | Fernando | Alonso |
| 12 | David | Villa |
+---------+-----------+----------+
Student_Sport
+------------+----------+
| ID_Student | ID_Sport |
+------------+----------+
| 10 | 110 |
| 11 | 111 |
| 11 | 112 |
| 12 | 111 |
+------------+----------+
Sport
+---------+-------------+
| ID (PK) | Description |
+---------+-------------+
| 110 | Tennis |
| 111 | Football |
| 112 | Formula1 |
+---------+-------------+
直接映射会生成很多这样的三元组:
<Student_Sport/ID_Student=11;ID_Sport=111> <Student_Sport#ref-ID_Student> <Student/ID=11>.
<Student_Sport/ID_Student=11;ID_Sport=111> <Student_Sport#ref-ID_Sport> <Sport/ID=111>.
<Student_Sport/ID_Student=11;ID_Sport=112> <Student_Sport#ref-ID_Student> <Student/ID=11>.
<Student_Sport/ID_Student=11;ID_Sport=112> <Student_Sport#ref-ID_Sport> <Sport/ID=112>.
从头开始建模,你可能会写这样的东西(R2RML 允许实现这一点):
<http://example.com/student/11> <http://example.com/plays> <http://example.com/sport/111>.
<http://example.com/student/11> <http://example.com/plays> <http://example.com/sport/112>.
此外,无法改善对原始表进行非规范化或创建 SQL 视图的结果:如果没有主键,结果可能会更糟。
为了改善结果,后续DELETE/INSERT
(或CONSTRUCT
)似乎是唯一可用的选项。该过程应命名为 ELT 而不是 ETL。也许以下 DM 生成的三元组旨在帮助进行这种转换:
<Student_Sport/ID_Student=11;ID_Sport=111> <Student_Sport#ID_Student> "11"^^xsd:integer.
<Student_Sport/ID_Student=11;ID_Sport=111> <Student_Sport#ID_Sport> "111"^^xsd:integer.
<Student_Sport/ID_Student=11;ID_Sport=112> <Student_Sport#ID_Student> "11"^^xsd:integer.
<Student_Sport/ID_Student=11;ID_Sport=112> <Student_Sport#ID_Sport> "112"^^xsd:integer.
...他们说它失去了语义
@JuanSequeda 意味着 DM 不会从关系模式生成 OWL 本体,这种行为不是特定于多对多关系的。
另请参阅第 14 期的链接。
推荐阅读
- bash - 这是在 cloudbuild.yaml 文件中编写 if..else 语句的正确方法吗?
- javascript - 在 Promise 中将数据异步写入 GCS
- javascript - 如何使用 date-picker bootstrap4 插件禁用每月 26 日到 30 日以及每个月的星期日
- c# - C# StreamReader 可以检查当前行号吗?
- docker - Docker 容器向 http 发送请求
- python - 编写灵活的正则表达式
- javascript - 如何修复“FirebaseError”类型的预期值,但在 Flutter Web 设置推送通知中得到“DomException”类型之一?
- firebase-realtime-database - 设备类型加湿器不显示湿度
- c++ - 无法使用 Visual Studio 生成 CMake 文件
- javascript - 如果未找到下一个关闭,RegExp 忽略开始字符