首页 文章

SPARQL语句未返回正确的结果

提问于
浏览
0

我'm running a SPARQL statement but it is not returning the proper results. I'm使用TopBraid Composer对抗my OWL file (in RDF/XML) . 首先,以下SPARQL为我提供了结果 rdf:type

PREFIX rdf:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX wo:<http://purl.org/ontology/wo/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
SELECT * where {
    <http://www.bbc.co.uk/nature/life/Animal#kingdom> ?type wo:Kingdom
}

当我运行此查询时,我希望得到 <http://www.bbc.co.uk/nature/life/Animal#kingdom> ,但我得到一个空的结果集:

PREFIX rdf:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX wo:<http://purl.org/ontology/wo/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
SELECT * where {
    ?x rdf:type wo:Kingdom
}

我得到一个空结果集是什么?

1 回答

  • 3

    这样说并不准确:

    首先,[first] SPARQL为我提供了结果rdf:type

    你应该(而且我希望你)得到

    http://www.w3.org/1999/02/22-rdf-syntax-ns#type
    

    为了那个结果 . 但是,由于您已经以不寻常的方式定义了 rdf: 前缀, rdf:type (根据您的前缀定义)将是:

    http://www.w3.org/2000/01/rdf-schema#type
    

    这些显然是不同的IRI . 问题是你已经 rdf:rdfs: 相同:

    PREFIX rdf:<http://www.w3.org/2000/01/rdf-schema#>
    PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    

    假设您需要标准定义,这些应该是:

    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    

相关问题