如何创建具有依赖关系的RDF?

时间:2016-01-30 19:53:45

标签: rdf

我正在努力与我正在创作的相机本体。生成单个tripples非常容易,但我想知道如何创建层次结构。基本上我想了解如何创建主题成为对象的RDF图。我刚刚开始这样做,所以如果它不匹配,请随意调整/重写我的术语。

例如:

我有一个叫做光学的课程,我希望在一系列相机中提供最大光圈。然而,该值取决于几个参数,即lensPosition(Wide或Tele)和传感器格式(FullFrame或APS-C)

这是可能的结果:

相机A:

optics - withPosition - > 广 - withFormat - > FullFrame - hasMaxAperture - >的 1.8

optics - withPosition - > 远程 - withFormat - > FullFrame - hasMaxAperture - >的 4.0

optics - withPosition - > 广 - withFormat - > APS-C - hasMaxAperture - >的 3.2

optics - withPosition - > 远程 - withFormat - > APS-C - hasMaxAperture - >的 6.0

相机B:

optics - withPosition - > 广 - withFormat - > FullFrame - hasMaxAperture - >的 4.0

optics - withPosition - > 远程 - withFormat - > FullFrame - hasMaxAperture - >的 8.0

依旧......

如何使用RDF / XML进行最佳编码?

1 个答案:

答案 0 :(得分:2)

除非您希望将这些关系建模为某种通用规则,否则使用Turtle(或N3或NTriples,它们类似)比RDF / XML更容易。

我认为你的例子不是你所描述的

  

主体成为对象

而是多个参数之间的关系。使用RDF的一种方法,您可以通过将参数分组为空白节点来进行建模

所以这里有一些Turtle for Camera 1(假设为空前缀)

:optics :hasMaxAptertureDefinition [
  :withPosition :Wide ; 
  :withFormat :FullFrame;
  :hasMaxAperture 1.8
]

这会对你有用吗?

等效的RDF / XML就像

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF 
   xmlns:ns1="http://example/"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
   <rdf:Description rdf:nodeID="ub428bL0C36">
      <ns1:withFormat rdf:resource="http://example/#FullFrame"/>
      <ns1:withPosition rdf:resource="http://example/#Wide"/>
      <ns1:hasMaxAperture rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal">1.8</ns1:hasMaxAperture>
   </rdf:Description>
   <rdf:Description rdf:about="http://example/#optics">
      <ns1:hasMaxAptertureDefinition rdf:nodeID="ub428bL0C36"/>
   </rdf:Description>
</rdf:RDF>
相关问题