如何创建具有依赖关系的 RDF?
how to create RDF with dependencies?
我正在努力使用相机 ontology 我正在创作。生成单个三元组非常容易,但我想知道如何创建层次结构。基本上我想了解如何创建主题成为对象的 RDF 图。我只是从这个开始,所以如果它不真正匹配,请随时调整/重写我的术语。
例如:
我有一个叫做光学的 class,我想在一系列相机中提供最大光圈。然而,该值取决于几个参数,即镜头位置(广角或长焦)和传感器格式(全帧或 APS-C)
这是可能的结果:
相机A:
光学 -- withPosition --> Wide -- withFormat --> FullFrame -- hasMaxAperture --> 1.8
光学 -- withPosition --> Tele -- withFormat --> FullFrame -- hasMaxAperture --> 4.0
光学 -- withPosition --> Wide -- withFormat --> APS-C -- hasMaxAperture --> 3.2
光学 -- withPosition --> Tele -- withFormat --> APS-C -- hasMaxAperture --> 6.0
摄像头 B:
光学 -- withPosition --> Wide -- withFormat --> FullFrame -- hasMaxAperture --> 4.0
光学 -- withPosition --> Tele -- withFormat --> FullFrame -- hasMaxAperture --> 8.0
等等...
我如何使用 RDF/XML 最好地编写代码?
除非您想将这些关系建模为某种通用规则,否则使用 Turtle(或 N3 或 NTriples,它们是相似的)比 RDF/XML 更容易。
我认为你的例子不是你所描述的
the subject becomes the object
而是多个参数之间的关系。使用 RDF,您可以通过对空白节点中的参数进行分组来建模的一种方法
所以这是相机 1 的一些 Turtle(假定为空前缀)
: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>
我正在努力使用相机 ontology 我正在创作。生成单个三元组非常容易,但我想知道如何创建层次结构。基本上我想了解如何创建主题成为对象的 RDF 图。我只是从这个开始,所以如果它不真正匹配,请随时调整/重写我的术语。
例如:
我有一个叫做光学的 class,我想在一系列相机中提供最大光圈。然而,该值取决于几个参数,即镜头位置(广角或长焦)和传感器格式(全帧或 APS-C)
这是可能的结果:
相机A:
光学 -- withPosition --> Wide -- withFormat --> FullFrame -- hasMaxAperture --> 1.8
光学 -- withPosition --> Tele -- withFormat --> FullFrame -- hasMaxAperture --> 4.0
光学 -- withPosition --> Wide -- withFormat --> APS-C -- hasMaxAperture --> 3.2
光学 -- withPosition --> Tele -- withFormat --> APS-C -- hasMaxAperture --> 6.0
摄像头 B:
光学 -- withPosition --> Wide -- withFormat --> FullFrame -- hasMaxAperture --> 4.0
光学 -- withPosition --> Tele -- withFormat --> FullFrame -- hasMaxAperture --> 8.0
等等...
我如何使用 RDF/XML 最好地编写代码?
除非您想将这些关系建模为某种通用规则,否则使用 Turtle(或 N3 或 NTriples,它们是相似的)比 RDF/XML 更容易。
我认为你的例子不是你所描述的
the subject becomes the object
而是多个参数之间的关系。使用 RDF,您可以通过对空白节点中的参数进行分组来建模的一种方法
所以这是相机 1 的一些 Turtle(假定为空前缀)
: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>