问题描述
我们正在开发一个本体,我们需要根据 # Test mapping file
部分中定义的一些映射来推断每个节点的类型。我们尝试了 rdfs:subClassOf
,如下面的代码片段所示,但它无法推断类型。理想情况下,我们希望将 Person 1
和 Person 2
推断为 NodeTypePerson
,还将 sydney
和 canberra
推断为 NodeTypeCity
。
我尝试了 owl:equivalentClass
但没有成功。 rdfs:range
和 rdfs:domain
按预期推断类型,但在推断 rdfs:subClassOf
时遇到问题。任何建议都非常感谢。
更新:
owl:equivalentClass
在 Protege 中工作。 (如果推断类型)。但是我们不能类似地使用 rdfs:subClassOf
吗?实际上,我想要一种使用 RDFS 推理完成此操作的方法,其中 owl:equivalentClass
显然不起作用。我们可以在这里使用任何其他 RDFS 属性吗?
# baseURI: http://www.Test-app.com/ns
@prefix : <http://www.Test-app.com/ns#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-Syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix acl: <http://www.w3.org/ns/auth/acl#> .
@prefix cc: <http://creativecommons.org/ns#> .
@prefix cert: <http://www.w3.org/ns/auth/cert#> .
@prefix csvw: <http://www.w3.org/ns/csvw#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dcam: <http://purl.org/dc/dcam/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dctype: <http://purl.org/dc/dcmitype/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix posixstat: <http://www.w3.org/ns/posix/stat#> .
@prefix schema: <https://schema.org/> .
@prefix shacl: <http://www.w3.org/ns/shacl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#> .
@prefix solid: <http://www.w3.org/ns/solid/terms#> .
@prefix swapdoc: <http://www.w3.org/2000/10/swap/pim/doc#> .
@prefix ui: <http://www.w3.org/ns/ui#> .
@prefix vann: <http://purl.org/vocab/vann/> .
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
@prefix ws: <http://www.w3.org/ns/pim/space#> .
@base <http://www.Test-app.com/ns> .
<http://www.Test-app.com/ns>
rdf:type owl:Ontology ;
dc:title "Test Ontology"@en ;
owl:versionIRI <http://www.Test-app.com/ns/0.1> .
# Test mapping file
@prefix test: <http://www.Test-app.com/ns#> .
:Person
a rdfs:Class ;
owl:equivalentClass :NodeTypePerson .
:locatednear
a rdf:Property ;
rdfs:subClassOf :NodeCustomAttribute ;
rdfs:label "Located Near" .
:Location
a rdfs:Class ;
rdfs:label "Location" ;
rdfs:subClassOf :NodeTypeCity ;
rdfs:comment "This represents a geolocation." .
:City
a rdfs:Class ;
rdfs:label "City" ;
rdfs:comment "This represents a city." ;
rdfs:subClassOf :Location .
# Some graph instances data
:sydney
a :City ;
rdfs:label "Sydney" ;
rdfs:comment "Australia's largest city." .
:canberra
a :City ;
rdfs:label "Canberra" ;
rdfs:comment "Australia's national capital." .
:person1
a :Person ;
rdfs:label "Person 1" ;
rdfs:comment "First vertex." ;
:locatednear :sydney .
:person2
a :Person ;
rdfs:label "Person 2" ;
rdfs:comment "Second vertex." ;
:locatednear :canberra .
# Types
:NodeTypePerson
rdf:type rdfs:Class ;
rdfs:label "NodeTypePerson" ;
rdfs:comment "" ;
vs:term_status "stable" ;
rdfs:isDefinedBy <http://www.Test-app.com/ns> .
:NodeTypeCity
rdf:type rdfs:Class ;
rdfs:label "NodeTypeCity" ;
rdfs:comment "" ;
vs:term_status "stable" ;
rdfs:isDefinedBy <http://www.Test-app.com/ns> .```
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)