扩展其他 ontology 的 owl

Extend owl of other ontology

我在 Protege 中创建了以下 OWL,当我在 dbpedia 中执行 SPARQL 时。org/sparql 它没有 return 任何东西。

@prefix : <http://www.wad.nistorandrei.com/ontology.owl#> .
@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#> .

<http://www.wad.nistorandrei.com/ontology.owl> a owl:Ontology .
# 
# 
# #################################################################
# #
# #    Object Properties
# #
# #################################################################
# 
# 
# http://www.wad.nistorandrei.com/ontology.owl#type

:type a owl:ObjectProperty ;
    rdfs:isDefinedBy rdf:type ;
    rdfs:label "type" .
# 
# 
# 
# #################################################################
# #
# #    Classes
# #
# #################################################################
# 
# 
# http://www.wad.nistorandrei.com/ontology.owl#Church

:Church a owl:Class ;
    rdfs:subClassOf :Place .
# 
# http://www.wad.nistorandrei.com/ontology.owl#Place

:Place a owl:Class .
# 
# Generated by the OWL API (version 4.1.3.20151118-2017) https://github.com/owlcs/owlapi

这是我要执行的查询

PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
            PREFIX dbo: <http://dbpedia.org/ontology/>
            PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
            PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
            PREFIX dcterms: <http://purl.org/dc/terms/>
            PREFIX ontology: <http://wad.nistorandrei.com/ontology.owl>

            SELECT DISTINCT * WHERE {
                            ?s a dbo:Place;
                            geo:lat ?lat;
                            geo:long ?lng;
                            ontology:type ?type;
                            rdfs:label ?label;
                            dcterms:subject ?sub;
                            dbo:abstract ?description;
                            dbo:thumbnail ?thumbnail .

                        FILTER( lang(?label) = "en" )
                        FILTER( lang(?description) = "en" ) . FILTER ( ( ?lng > 27.577898 && ?lng < 27.597898 && ?lat > 47.144996 && ?lat < 47.164996 ) ) }
        ORDER BY ?s

如果您将 "ontology:type ?type;" 更改为 "rdf:type ?type",它将 return 我需要的信息。

我想要实现的(如果我做错了)是将更多类型映射到一种类型。例如 ontology:Church 到 **dbo:ReligiousBuilding 或其他与教堂相关的内容 **.

重要的是使用 ontology:type 的查询能够正常工作。

谁能给我提示?

谢谢。

问题

这里有几个问题。

前缀错误

首先是您正在使用

PREFIX ontology: <http://wad.nistorandrei.com/ontology.owl>
#-- ...
   ontology:type ?type

表示ontology:type代表

http://wad.nistorandrei.com/ontology.owltype(无 #在那里)

而您在 ontology 中声明的 属性 是

http://www.wad.nistorandrei.com/ontology.owl#type(带有 #)

所以你实际上使用了不同的 IRI。您应该将您的前缀声明为:

PREFIX ontology: <http://wad.nistorandrei.com/ontology.owl#>

DBpedia 不知道您的 ontology

也就是说,即使您修复了该问题,您仍然不会得到任何结果。该查询没有 return 任何内容,因为 DBpedia 没有来自您的 ontology 的任何数据。声明前缀只是意味着您可以用更短的方式编写某些 URI。这并不意味着 DBpedia 以某种方式加载了您的 ontology 或使用这些 IRI 的任何数据。

检查语言

这可能不会阻止您的查询工作,但请注意,您通常应该使用 langMatches 来比较语言标签,而不是 =lang。例如,您应该使用

filter langMatches(lang(?var), "en")

这将正确处理区域变体。例如,如果 ?var 绑定到 "colour"@en-gb,它仍然会匹配。