我想知道如何使用 r2rml 建模以下内容:
人 -> 有地址 --> 空白节点 [街道名称、邮政编码、城市]
我确定如何将街道名称、邮政编码和城市添加到 rr:objectMap
中的空白节点
(附加问题:rr:class
对于 rr:BlankNode
是必需的吗?)
有什么建议吗? :)
<#Person>
rr:logicalTable [ rr:tableName "PERSON" ];
rr:subjectMap [
rr:template "http://ex.com/data/PersonClass/{ID}";
rr:class ex:PersonClass;
];
rr:preciateObjectMap [
rr:predicate ex:hasAddress;
rr:objectMap [
rr:termType rr:BlankNode;
## How/where can a add the street name, postal code, city? ##
];
].
最佳答案
应该不会太难。首先,您获取已创建的 R2RML 映射并为该地址创建一个空白节点。使用模板为其指定一个唯一的名称,但不要为其指定 IRI,因此它会被解释为空白节点。
<#Person>
rr:logicalTable [ rr:tableName "PERSON" ];
rr:subjectMap [
rr:template "http://ex.com/data/PersonClass/{ID}";
rr:class ex:PersonClass;
];
rr:preciateObjectMap [
rr:predicate ex:hasAddress;
rr:objectMap [
rr:template "BlankAddressNode{ADDRESSID}";
rr:termType rr:BlankNode;
];
].
注意:表 PERSON 中的 ADDRESSID 被视为 ADDRESS 表主键的外键。
接下来,您将使用 rdf:type 和其他所有内容创建空白节点。
<#Address>
rr:logicalTable [ rr:tableName "ADDRESS" ];
rr:subjectMap [
rr:template "BlankAddressNode{ID}";
rr:termType rr:BlankNode;
rr:class ex:AddressClass;
];
rr:predicateObjectMap [
rr:predicate ex:street;
rr:objectMap [ rr:column "Street"]
];
.
注意:ID是ADDRESS表的主键。
您也可以通过连接来完成此操作...但我认为从教程的角度来看,这更清楚。
关于semantic-web - R2RML rr :objectMap 内的空白节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36117188/