问题描述
W3C的RDB2RDF标准之一是直接映射.我听说过从关系数据库转换多对多关系时出现了问题,并且他们说它失去了语义,我需要对此进行更多解释.
One of the standards from W3C for RDB2RDF is Direct Mapping. I heard that there is a problem when converting many-to-many relationship from a relational database and they say it loses semantic, I need more explanation about it.
推荐答案
我会说直接映射引入了附加的寄生"语义,将规范化伪像视为一类对象.
I'd say that direct mapping introduces additional "parasitic" semantics, treating normalization artefacts as first-class object.
让我们考虑 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 |
+---------+-------------+
直接映射会生成很多这种三元组:
Direct mapping generates a lot of triples of this kind:
<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可以实现):
Modeling from scratch, you'd probably write something like this (R2RML allows to achieve that):
<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视图的结果:没有主键,结果甚至可能甚至更糟.
Moreover, one can't improve results denormalizing original tables or creating SQL views: without primary keys, results are probably even worse.
为了改善结果,后续的DELETE/INSERT
(或CONSTRUCT
)似乎是唯一可用的选项.该过程应命名为ELT而不是ETL.以下DM生成的三元组可能旨在旨在这样的转变:
In order to improve results, subsequent DELETE/INSERT
(or CONSTRUCT
) seems to be the only option available. The process should be named ELT rather than ETL. Perhaps the following DM-generated triples were intended to help in such transformation:
<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本体,这种行为并不是特定于多对多关系的.
@JuanSequeda means that DM doesn't generate an OWL ontology from an relational schema, this behaviour is not many-to-many relations specific.
另请参见问题14 中的链接.
这篇关于关于直接映射转换多对多关系的说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!