【发布时间】:2016-02-02 18:48:49
【问题描述】:
我在 Protege 中创建了以下 OWL,当我在 dbpedia.org/sparql 中执行 SPARQL 时,它不返回任何内容。
@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" 它将返回我需要的信息。
我想要实现的(如果我做错了)是将更多类型映射到一种类型。例如 ontology:Church 到 **dbo:ReligiousBuilding 或其他与教堂相关的 **。
重要的是让使用 ontology:type 的查询起作用。
谁能给我一个提示?
谢谢。
【问题讨论】:
-
如果想法是基于 DBpedia 中的数据创建 RDF 数据,您可能希望使用 construct 查询来创建相应的三元组。有一个类似的问题可能会有所帮助,Is there a way to convert the data format of an RDF vocabulary to SKOS。
-
You commented on my answer,“谢谢你的回复。有没有办法合并2个本体并返回需要的信息?”目前还不清楚“需要的信息”是什么是”。你能举一个你想要得到的结果的例子吗?除此之外,我们只是猜测您要做什么。
-
如果你改变了查询“ontology:type ?type;”到“rdf:类型?类型;”并在dbpedia/sparql 中执行查询,您将看到结果。
-
但是为什么不直接运行那个查询呢?该查询正在 DBpedia 数据中查找三元组。 DBpedia 有
a rdf:type b形式的三元组,但没有a yourontology:type b形式的任何一种。你不能做你想做的事。 -
明白了,谢谢你的帮助。
标签: sparql semantic-web owl dbpedia