如何将带注释的公理序列化为 RDF 形式



让我们以公理为例SubClassOf( DataAllValuesFrom( <d> xsd:boolean ) ObjectSomeValuesFrom( <o> owl:Thing ) Annotation( rdfs:comment "comm"^^xsd:string ) ).

这个公理在RDF的形式中应该是什么样子的?

如果我正确理解规范, 只有一种方法:

示例 1

@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
<o>     a       owl:ObjectProperty .
[ a                      owl:Axiom ;
rdfs:comment           "comm" ;
owl:annotatedProperty  rdfs:subClassOf ;
owl:annotatedSource    [ a                  owl:Restriction ;
rdfs:subClassOf    _:c2 ;
owl:allValuesFrom  xsd:boolean ;
owl:onProperty     <d>
] ;
owl:annotatedTarget    _:c2
] .
<d>     a       owl:DatatypeProperty .
_:c2    a                   owl:Restriction ;
owl:onProperty      <o> ;
owl:someValuesFrom  owl:Thing .

但是,突然发现有人以不同的方式理解规范。 上面的公理可以甚至必须写成这样:

示例 2

@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
<o>     a       owl:ObjectProperty .
<d>     a       owl:DatatypeProperty .
[ a                      owl:Axiom ;
rdfs:comment           "comm" ;
owl:annotatedProperty  rdfs:subClassOf ;
owl:annotatedSource    [ a                   owl:Restriction ;
rdfs:subClassOf     [ a                  owl:Restriction ;
owl:allValuesFrom  owl:Thing ;
owl:onProperty     <o>
] ;
owl:onProperty      <d> ;
owl:someValuesFrom  xsd:boolean
] ;
owl:annotatedTarget    [ a                  owl:Restriction ;
owl:allValuesFrom  owl:Thing ;
owl:onProperty     <o>
]
] .

所以,问题是,谁是对的?哪个例子是正确的?

在我看来,第二个RDF(示例2)违反了对RDF化和数据连接的理解。 但我无法将这一点传达给对手。 我有基于规范的参数 (以后可能会作为答案提供), 但事实证明,这些论点在他眼里是站不住脚的, 所以我呼吁这里的广泛专家获得新的论点,或者,也许是为了提高我自己对这个概念的看法: 没有人(除了我)说示例 1 是唯一正确的方法。
因此,最好有规范,获得第一个(或第二个)示例是正确的证明。

如果我理解正确,我的对手会诉诸规范中的以下短语:
In the mapping, each generated blank node (i.e., each blank node that does not correspond to an anonymous individual) is fresh in each application of a mapping rule.. 他认为,这意味着超类ObjectSomeValuesFrom( <o> owl:Thing )在写入RDF时必须获得两次b节点。
如何证明这不是真的(或真的)?

谢谢。

所以,既然还没有答案,这里是我自己的,这是基于我对官方规范 https://www.w3.org/TR/owl2-mapping-to-rdf/的理解。 欢迎任何意见和改进。


1. 简介

规范只定义了运算符T(E)TANN(ann, y),其中annAnnotation( AP av )Ey是一些对象。 规范还说:The definition of the operator T uses the operator TANN in order to translate annotations.对于第2.1 Translation of Axioms without Annotations节中描述的操作 和部分2.3 Translation of Axioms with Annotations没有自己的名字。 运算符TANNTable 22.2 Translation of Annotations节中定义, 但它是注释的注释,它正在产生具有根三重_:x rdf:type owl:Annotation的 B 节点。 使用根三重_: x rdf: type owl: Axiom创建顶级注释的运算符在第2.3.1 Axioms that Generate a Main Triple一节中进行了描述,但也没有正确的名称。 而且,为了演示,我将为这个"运算符"介绍一个新名称:ANN. 注意 1:不要将其与第3.2.2 Parsing of Annotations节中ANN的函数混淆 - 我们不需要最后一件事;这个答案只是关于映射,而不是解析。 注2:我不是在编写自己的规范,我只是试图使用新的缩写来解释我的愿景。 在一般情况下,这种注入可能不正确,但出于演示目的,我认为这是可以的。

此外,让我们将公理SubClassOf视为具有两个操作数的运算符。在本节2.1 Translation of Axioms without AnnotationsTable 1中描述如下:

SubClassOf( CE1 CE2 ) = T(CE1) rdfs:subClassOf T(CE2) .

我们还考虑一个重载运算符SubClassOf,其中包含两个操作数和注释的变量。SubClassOf( CE1 CE2 annotations { n > 1 } )2.3.1 Axioms that Generate a Main Triple部分中定义如下:

s p xlt .
_:x rdf:type owl:Axiom .
_:x owl:annotatedSource s .
_:x owl:annotatedProperty p .
_:x owl:annotatedTarget xlt .
TANN(annotation1, _:x)
...
TANN(annotationm, _:x) 

为简单起见,让我们详述一种只有一个顶级注释的情况。 因此,该运算符SubClassOf( CE1, CE2, ann),如下所示:

T(CE1) rdfs:subClassOf T(CE2) .
ANN(CE1, CE2, rdfs:subClassOf, ann) .

这是一个新的运算符ANN,它类似于TANN,但接受定义谓词的两个操作数,注解和常量。 它生成根三元组_:x rdf:type owl:Axiom,所有其他三元组类似于上面示例中运算符TANN的三元组,因此ANN(s, xlt, p, ann)

_:x rdf:type owl:Axiom .
_:x owl:annotatedSource s .
_:x owl:annotatedProperty p .
_:x owl:annotatedTarget xlt .
TANN(ann, _:x)

2.没有注释的本体。

现在让我们考虑第一个操作数DataAllValuesFrom而第二个操作数ObjectSomeValuesFrom的问题中的示例:

SubClassOf( DataAllValuesFrom( <d> xsd:boolean ) ObjectSomeValuesFrom( <o> owl:Thing ) ) .

TURTLE中,它看起来像这样:

<d>     a       owl:DatatypeProperty .
<o>     a       owl:ObjectProperty .
[ rdf:type owl:Restriction ;
owl:onProperty <d> ;
owl:allValuesFrom xsd:boolean ;
rdfs:subClassOf [ rdf:type owl:Restriction ;
owl:onProperty <o> ;
owl:someValuesFrom owl:Thing
]
] ;

或者NTRIPLES语法中的相同本体:

<d> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#DatatypeProperty> .
<o> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> .
_:c1 <http://www.w3.org/2000/01/rdf-schema#subClassOf> _:c2 .
_:c1 <http://www.w3.org/2002/07/owl#allValuesFrom> <http://www.w3.org/2001/XMLSchema#boolean> .
_:c1 <http://www.w3.org/2002/07/owl#onProperty> <d> .
_:c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:c2 <http://www.w3.org/2002/07/owl#someValuesFrom> <http://www.w3.org/2002/07/owl#Thing> .
_:c2 <http://www.w3.org/2002/07/owl#onProperty> <o> .
_:c2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .

SubClassOf是一个生成主三元组的公理(请参阅第2.3.1 Axioms that Generate a Main Triple节)。 所以,这里主要的三元组(s p xlt)是_:c1 <http://www.w3.org/2000/01/rdf-schema#subClassOf> _:c2, 其中s(在示例中的主语DataAllValuesFrom( <d> xsd:boolean ))是_:c1p(谓词)是rdfs:subClassOfxlt(xlt代表空白节点、IRI 或文字,这里是宾语,在示例中ObjectSomeValuesFrom( <o> owl:Thing ))是_:c2

注意,在ONT-API中,这样的TURTLE可以通过以下代码生成:

OntModel m = OntModelFactory.createModel().setNsPrefixes(OntModelFactory.STANDARD);
m.createDataAllValuesFrom(m.createDataProperty("d"), m.getDatatype(XSD.xboolean))
.addSuperClass(m.createObjectSomeValuesFrom(m.createObjectProperty("o"), 
m.getOWLThing()));
m.write(System.out, "ttl");

3.操作人员的行为T

规格说:In the mapping, each generated blank node (i.e., each blank node that does not correspond to an anonymous individual) is fresh in each application of a mapping rule.. 我相信这只是关于运营商T. 此语句大致符合解析 OWL、结构共享、OWL1 规范中的内容:In practice, this means that blank nodes (i.e. those with no name) which are produced during the transformation and represent arbitrary expressions in the abstract syntax form should not be "re-used".. 在一般情况下,ONT-API和OWL-API都不是问题,所有这些事情的行为都相似。以下代码为 OWL-API(默认 impl)和 ONT-API(使用 OWL-API 接口)生成相同的 RDF:

OWLOntologyManager m = OntManagers.createONT();
OWLDataFactory df = m.getOWLDataFactory();
OWLClassExpression ce = df.getOWLObjectComplementOf(df.getOWLThing());
OWLOntology o = m.createOntology();            
o.add(df.getOWLSubClassOfAxiom(ce, ce));
o.saveOntology(OntFormat.TURTLE.createOwlFormat(), System.out);

对于作为SubClassOf( CE1, CE2 )操作数的两个相等类表达式ObjectComplementOf( owl:Thing )将有两个不同的 b 节点。 因此,没有人质疑OWL中没有对象共享的事实。
但是,在我看来,这不能适用于公理与其注释之间的关系,运算符ANN就是这种情况,见下一段。


4.1 生成主三元组的注释公理。与SPO的统一 .

现在让我们以我认为唯一正确的方式在SubClassOf( DataAllValuesFrom( <d> xsd:boolean ) ObjectSomeValuesFrom( <o> owl:Thing ) )中添加注释Annotation( rdfs:comment "comm" )(请参阅前面的第2段)。 请记住,运算符SubClassOf(CE1, CE2, ann)生成以下 ttl:

T(CE1) rdfs:subClassOf T(CE2) .
ANN(CE1, CE2, rdfs:subClassOf, ann) .

s p xlt .
_:x rdf:type owl:Axiom .
_:x owl:annotatedSource s .
_:x owl:annotatedProperty p .
_:x owl:annotatedTarget xlt .
TANN(ann, _:x)

在这里,三重s p xlt是应用运算符SubClassOf(CE1, CE2)的结果。从Table 2,第2.2 Translation of Annotations节,Annotation( rdfs:comment "comm"^^xsd:string )的运算符TANN(Annotation( AP av ), _:x)将给出三重_:x rdfs:comment "comm"^^xsd:string,所以我们有(SubClassOf(CE1, CE2, Annotation( rdfs:comment "comm"^^xsd:string ))):

s p xlt .
_:x rdf:type owl:Axiom .
_:x owl:annotatedSource s .
_:x owl:annotatedProperty p .
_:x owl:annotatedTarget xlt .
_:x rdfs:comment "comm"^^xsd:string .

此处的三重s p xlt_:c1 rdfs:subClassOf _:c2(见第2段); 所以最后我们得到以下注释公理:

_:c1 rdfs:subClassOf _:c2 .
_:x rdfs:comment "comm"^^xsd:string .
_:x rdf:type owl:Axiom .
_:x owl:annotatedSource _:c1 .
_:x owl:annotatedProperty rdfs:subClassOf .
_:x owl:annotatedTarget _:c2 .

NTRIPLES语法中的完整本体(没有本体ID)如下所示:

<o> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> .
<d> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#DatatypeProperty> .
_:x <http://www.w3.org/2000/01/rdf-schema#comment> "comm" .
_:x <http://www.w3.org/2002/07/owl#annotatedTarget> _:c2 .
_:x <http://www.w3.org/2002/07/owl#annotatedProperty> <http://www.w3.org/2000/01/rdf-schema#subClassOf> .
_:x <http://www.w3.org/2002/07/owl#annotatedSource> _:c1 .
_:x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Axiom> .
_:c2 <http://www.w3.org/2002/07/owl#someValuesFrom> <http://www.w3.org/2002/07/owl#Thing> .
_:c2 <http://www.w3.org/2002/07/owl#onProperty> <o> .
_:c2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:c1 <http://www.w3.org/2000/01/rdf-schema#subClassOf> _:c2 .
_:c1 <http://www.w3.org/2002/07/owl#allValuesFrom> <http://www.w3.org/2001/XMLSchema#boolean> .
_:c1 <http://www.w3.org/2002/07/owl#onProperty> <d> .
_:c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .

或者在海龟中也是如此:

@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
<o>     a       owl:ObjectProperty .
[ a                      owl:Axiom ;
rdfs:comment           "comm" ;
owl:annotatedProperty  rdfs:subClassOf ;
owl:annotatedSource    [ a                  owl:Restriction ;
rdfs:subClassOf    _:c2 ;
owl:allValuesFrom  xsd:boolean ;
owl:onProperty     <d>
] ;
owl:annotatedTarget    _:c2
] .
<d>     a       owl:DatatypeProperty .
_:c2    a                   owl:Restriction ;
owl:onProperty      <o> ;
owl:someValuesFrom  owl:Thing .

三重_:c1 rdfs:subClassOf _:c2(SPO)存在于图中,并有其统一:

_:x owl:annotatedTarget _:c2 .
_:x owl:annotatedProperty rdfs:subClassOf .
_:x owl:annotatedSource _:c1 .

请注意,此本体可以通过以下代码生成:

OntModel m = OntModelFactory.createModel().setNsPrefixes(OntModelFactory.STANDARD);
m.createDataAllValuesFrom(m.createDataProperty("d"), m.getDatatype(XSD.xboolean))
.addSubClassOfStatement(m.createObjectSomeValuesFrom(m.createObjectProperty("o"), m.getOWLThing()))
.annotate(m.getRDFSComment(), "comm");
m.write(System.out, "ttl");
System.out.println(".......");
m.write(System.out, "nt");

4.2 生成主三元组的注释公理。与(S*)P(O*)的统一 .

好吧,规范还说In the mapping, each generated blank node (i.e., each blank node that does not correspond to an anonymous individual) is fresh in each application of a mapping rule. 这是关于运算符T,但不适用于运算符TANNANNSubClassOf(CE1, CE2)SubClassOf(CE1, CE2, ann)。但是SubClassOf运算符由TANN(TANN)组成,因此它们还必须为每个操作数隐式生成一个空白节点。 我提醒一下,运算符最初SubClassOf(CE1, CE2, ann)(见第1页)如下所示:

T(CE1) rdfs:subClassOf T(CE2) .
ANN(CE1, CE2, rdfs:subClassOf, ann) .

但是仍然不完全清楚它的第二部分实际上应该发生什么 - 运营商ANN(CE1, CE2, rdfs:subClassOf, ann). 让我们采用我的对手的假设(据我所知),即使在包括其所有注释的层次结构树在内的整个公理中,类表达式也不得共享。 对于运算符SubClassOf(CE1, CE2)来说绝对是正确的,对于运算符TANN来说绝对是正确的,对于运算符ANN(包括TANN)来说,这是争议的主题。 但为了实验起见,让我们假设该规则也必须适用于ANN操作数。 因此,SubClassOf(CE1, CE2, ann)现在定义如下:

SubClassOf(CE1, CE2) .
ANN(T(CE1), T(CE2), rdfs:subClassOf, ann) .

T(CE1) rdfs:subClassOf T(CE2) .
ANN(T(CE1), T(CE2), rdfs:subClassOf, ann) .

SubClassOf(CE1, CE2)将给出以下NTRIPLES(见第 2页):

<d> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#DatatypeProperty> .
<o> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> .
_:c2 <http://www.w3.org/2002/07/owl#someValuesFrom> <http://www.w3.org/2002/07/owl#Thing> .
_:c2 <http://www.w3.org/2002/07/owl#onProperty> <o> .
_:c2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:c1 <http://www.w3.org/2000/01/rdf-schema#subClassOf> _:c2 .
_:c1 <http://www.w3.org/2002/07/owl#allValuesFrom> <http://www.w3.org/2001/XMLSchema#boolean> .
_:c1 <http://www.w3.org/2002/07/owl#onProperty> <d> .
_:c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .

这里,b节点_:c1对应于类表达式DataAllValuesFrom( <d> xsd:boolean ), 而 b 节点_:c2对应于ObjectSomeValuesFrom( <o> owl:Thing ).

然后我们对主题(第一个操作数T(CE1))进行ANNT

_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:b1 <http://www.w3.org/2002/07/owl#allValuesFrom> <http://www.w3.org/2001/XMLSchema#boolean> .
_:b1 <http://www.w3.org/2002/07/owl#onProperty> <d> .

对于对象(第二个操作数T(CE2)):

_:b2 <http://www.w3.org/2002/07/owl#someValuesFrom> <http://www.w3.org/2002/07/owl#Thing> .
_:b2 <http://www.w3.org/2002/07/owl#onProperty> <o> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .

并打印ANN本身:

_:x <http://www.w3.org/2000/01/rdf-schema#comment> "comm" .
_:x <http://www.w3.org/2002/07/owl#annotatedTarget> _:b2 .
_:x <http://www.w3.org/2002/07/owl#annotatedProperty> <http://www.w3.org/2000/01/rdf-schema#subClassOf> .
_:x <http://www.w3.org/2002/07/owl#annotatedSource> _:b1 .
_:x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Axiom> .

请注意,现在我们有用于CE1CE2的新 b 节点(分别为_:b1_:b2), 并在注释(_:x)中引用这两个节点。 在注解图结构内部有_:b1_:b2_:c1_:c2、 仅仅因为我们首先将运算符T应用于输入类表达式, 然后才将结果进一步传递到运算符ANN中。

完整的本体如下(只需连接上面的所有部分)(NTRIPLES):

<o> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> .
<d> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#DatatypeProperty> .
_:c2 <http://www.w3.org/2002/07/owl#someValuesFrom> <http://www.w3.org/2002/07/owl#Thing> .
_:c2 <http://www.w3.org/2002/07/owl#onProperty> <o> .
_:c2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:c1 <http://www.w3.org/2000/01/rdf-schema#subClassOf> _:c2 .
_:c1 <http://www.w3.org/2002/07/owl#allValuesFrom> <http://www.w3.org/2001/XMLSchema#boolean> .
_:c1 <http://www.w3.org/2002/07/owl#onProperty> <d> .
_:c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:x <http://www.w3.org/2000/01/rdf-schema#comment> "comm" .
_:x <http://www.w3.org/2002/07/owl#annotatedTarget> _:b2 .
_:x <http://www.w3.org/2002/07/owl#annotatedProperty> <http://www.w3.org/2000/01/rdf-schema#subClassOf> .
_:x <http://www.w3.org/2002/07/owl#annotatedSource> _:b1 .
_:x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Axiom> .
_:b2 <http://www.w3.org/2002/07/owl#someValuesFrom> <http://www.w3.org/2002/07/owl#Thing> .
_:b2 <http://www.w3.org/2002/07/owl#onProperty> <o> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:b1 <http://www.w3.org/2002/07/owl#allValuesFrom> <http://www.w3.org/2001/XMLSchema#boolean> .
_:b1 <http://www.w3.org/2002/07/owl#onProperty> <d> .

或者在海龟中也是如此:

@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
<o>     a       owl:ObjectProperty .
[ a                  owl:Restriction ;
rdfs:subClassOf    [ a                   owl:Restriction ;
owl:onProperty      <o> ;
owl:someValuesFrom  owl:Thing
] ;
owl:allValuesFrom  xsd:boolean ;
owl:onProperty     <d>
] .
<d>     a       owl:DatatypeProperty .
[ a                      owl:Axiom ;
rdfs:comment           "comm" ;
owl:annotatedProperty  rdfs:subClassOf ;
owl:annotatedSource    [ a                  owl:Restriction ;
owl:allValuesFrom  xsd:boolean ;
owl:onProperty     <d>
] ;
owl:annotatedTarget    [ a                   owl:Restriction ;
owl:onProperty      <o> ;
owl:someValuesFrom  owl:Thing
]
] .

如您所见,图中存在三重_:c1 rdfs:subClassOf _:c2(SPO),但没有统一。 取而代之的是三重_:b1 rdfs:subClassOf _:b2((S*)P(O*))的统一,这在图中实际上并不存在:

_:x owl:annotatedTarget _:b2 .
_:x owl:annotatedProperty rdfs:subClassOf .
_:x owl:annotatedSource _:b1 .

由于三重_:b1 rdfs:subClassOf _:b2不存在,那么在我看来,这个练习展示了无效的行为。


4.3 一个带注释的公理,通过OWL-API生成主三元组。与SP(O*)的统一 .

正如您可能猜到的那样,我的对手为OWL-API(v5.1.11)的当前行为辩护。 那么让我们看看OWL-API是做什么的。 要生成的代码:

OWLOntologyManager man = OntManagers.createOWL();
OWLDataFactory df = man.getOWLDataFactory();
OWLAxiom a = df.getOWLSubClassOfAxiom(df.getOWLDataSomeValuesFrom(df.getOWLDataProperty("d"),
df.getBooleanOWLDatatype()),
df.getOWLObjectAllValuesFrom(df.getOWLObjectProperty("o"), df.getOWLThing()),
Collections.singletonList(df.getRDFSComment("comm")));
OWLOntology o = man.createOntology();
o.add(a);
o.saveOntology(new TurtleDocumentFormat(), System.out);

NTRIPLES(本体ID省略):

<o> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> .
<d> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#DatatypeProperty> .
_:u <http://www.w3.org/2002/07/owl#allValuesFrom> <http://www.w3.org/2002/07/owl#Thing> .
_:u <http://www.w3.org/2002/07/owl#onProperty> <o> .
_:u <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:x <http://www.w3.org/2000/01/rdf-schema#comment> "comm" .
_:x <http://www.w3.org/2002/07/owl#annotatedTarget> _:u .
_:x <http://www.w3.org/2002/07/owl#annotatedProperty> <http://www.w3.org/2000/01/rdf-schema#subClassOf> .
_:x <http://www.w3.org/2002/07/owl#annotatedSource> _:c1 .
_:x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Axiom> .
_:c1 <http://www.w3.org/2000/01/rdf-schema#subClassOf> _:c2 .
_:c1 <http://www.w3.org/2002/07/owl#someValuesFrom> <http://www.w3.org/2001/XMLSchema#boolean> .
_:c1 <http://www.w3.org/2002/07/owl#onProperty> <d> .
_:c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:c2 <http://www.w3.org/2002/07/owl#allValuesFrom> <http://www.w3.org/2002/07/owl#Thing> .
_:c2 <http://www.w3.org/2002/07/owl#onProperty> <o> .
_:c2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://www.w3.org/2002/07/owl#> .
[ rdf:type owl:Ontology
] .
#################################################################
#    Object Properties
#################################################################
###  o
<o> rdf:type owl:ObjectProperty .

#################################################################
#    Data properties
#################################################################
###  d
<d> rdf:type owl:DatatypeProperty .

#################################################################
#    General axioms
#################################################################
[ rdf:type owl:Axiom ;
owl:annotatedSource [ rdf:type owl:Restriction ;
owl:onProperty <d> ;
owl:someValuesFrom xsd:boolean ;
rdfs:subClassOf [ rdf:type owl:Restriction ;
owl:onProperty <o> ;
owl:allValuesFrom owl:Thing
]
] ;
owl:annotatedProperty rdfs:subClassOf ;
owl:annotatedTarget [ rdf:type owl:Restriction ;
owl:onProperty <o> ;
owl:allValuesFrom owl:Thing
] ;
rdfs:comment "comm"
] .

###  Generated by the OWL API (version 5.1.11) https://github.com/owlcs/owlapi/

和重新格式化的TURTLE(同样,没有本体 ID):

@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
<o>     a       owl:ObjectProperty .
<d>     a       owl:DatatypeProperty .
[ a                      owl:Axiom ;
rdfs:comment           "comm" ;
owl:annotatedProperty  rdfs:subClassOf ;
owl:annotatedSource    [ a                   owl:Restriction ;
rdfs:subClassOf     [ a                  owl:Restriction ;
owl:allValuesFrom  owl:Thing ;
owl:onProperty     <o>
] ;
owl:onProperty      <d> ;
owl:someValuesFrom  xsd:boolean
] ;
owl:annotatedTarget    [ a                  owl:Restriction ;
owl:allValuesFrom  owl:Thing ;
owl:onProperty     <o>
]
] .

如您所见,图中存在三重_:c1 rdfs:subClassOf _:c2(SPO),但没有统一,就像上一段(p4.2)一样。 取而代之的是三重_:c1 rdfs:subClassOf _:u(SP(O*))的统一,这在图中实际上并不存在:

_:x owl:annotatedTarget _:u .
_:x owl:annotatedProperty rdfs:subClassOf .
_:x owl:annotatedSource _:c1 .

另请注意,对于此示例,运算符SubClassOf(CE1, CE2, ann)必须如下所示:

T(CE1) rdfs:subClassOf T(CE2) .
ANN(CE1, T(CE2), rdfs:subClassOf, ann) .

在这里,第一个操作数按原样传递,但第二个操作数有T-转换,它产生一个新的 B 节点。

由于三重_:c1 rdfs:subClassOf _:u在整个图中不存在, 此示例还演示了错误的行为。 所以,在我看来OWL-API (v5.1.11) 在注释公理由匿名表达式组成的情况下不会产生正确的 RDF。


5.结论和注释。

  • 那么,为什么这两个规范都禁止在映射中重复使用 b 节点呢?好吧,我看到唯一的一种解释——作者希望公理是原子的。如果某些公理的组件是共享的,那么在推理时不可能单独关闭/打开所需的公理。
  • 第4.1段中的例子是否违反了这一原则?不,注释仍然属于唯一的公理,不能引用另一个公理。
  • 第4.24.3段中的例子是错误的:相应的具体陈述实际上并不存在。 但是,据我所知,我的对手为4.3的正确性辩护,提出了导致4.2正确性的论据。我想,这个奇怪的事实也是正确性4.1的隐含证明。
  • 示例4.3中的运算符SubClassOf(CE1, CE2, ann)是不对称的。规范中没有任何线索可能导致这种不平衡的结果。为什么第二个操作数有转换T,而不是第一个操作数 - 这是一个问题。
  • 来源(github问题中的评论):https://github.com/owlcs/owlapi/issues/874#issuecomment-527399645

相关内容

  • 没有找到相关文章

最新更新