我想知道如何用r2rml来建模以下内容:
Person ->有地址->空白节点街名称,邮编,城市
我确信如何将街道名称、邮政编码和城市添加到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? ##
];
].发布于 2016-03-21 08:00:26
应该不会太难。首先,您使用您创建的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是地址表的主键。
你也可以加入.但我认为从一个教程的角度来看,这是更清楚的。
https://stackoverflow.com/questions/36117188
复制相似问题