简体   繁体   English

指定类后,SPARQL查询不推断属性

[英]SPARQL query not inferencing properties after class specified

I am running a test query on SPARQL to test inferencing. 我正在SPARQL上运行测试查询以测试推理。 My query is as follows: 我的查询如下:

    PREFIX eem: <http://purl.org/eem#>
    PREFIX ns: <http://purl.org/net/ns/>
    PREFIX sc_data: <http://purl.org/net/ns/sc_data/>
    PREFIX dbp: <http://dbpedia.org/resource/>
    PREFIX dbpprop: <http://dbpedia.org/property/>
    PREFIX ex: <http://www.example.org/rdf#>
    SELECT  ?roa
    WHERE {
    SERVICE <http://dbpedia.org/sparql>{
    ex:vaccine a dbp:Polio_vaccine.
    ex:vaccine dbpprop:routesOfAdministration ?roa.
}
    }

I get no results for this query when trying at the snorql page. 在snorql页面尝试时,此查询没有任何结果。 When I specify that something is polio vaccine, shouldn't it automatically inherit the properties specified for the vaccine? 当我指定某种东西是小儿麻痹症疫苗时,它不应该自动继承为疫苗指定的特性吗? What do I need to change? 我需要更改什么?

In your original query, ex:vaccine is a URI node, short for <http://www.example.org/rdf#vaccine> . 在原始查询中, ex:vaccine是URI节点,是<http://www.example.org/rdf#vaccine>的缩写。 It's very unlikely that DBpedia contains any information about it. 这是非常不可能的DBpedia中包含有关它的任何信息。 While the DBpedia endpoint may (or may not) include information that is inferrable from the DBpedia data, it doesn't treat your SPARQL query as part assertion and part query. 尽管DBpedia端点可能(或可能不)包含从DBpedia数据中可以推断出的信息,但它不会将SPARQL查询视为部分断言和部分查询。

You're literally saying "find values of ?roa such that ?roa is the route of administration of ex:vaccine and ex:vaccine is an instance of dbp:Polio_vaccine". 您的意思是说:“查找?roa的值,以使?roa是ex:vaccine的管理途径,而ex:vaccine是dbp:Polio_vaccine的实例”。 ex:vaccine is a constant though, so it's kind of like saying, "find factors of 10, and by the way, 10 is the sum of 3 and 4." ex:vaccine虽然是一个常数 ,所以有点像说:“找到10的因子,顺便说一下,10是3和4的总和。” The "10 is the sum of 3 and 4" isn't in the data, though, so there won't be any matches, even if there are recorded factors of 10. On top of that, dbp:Polio_vaccine is an individual in DBpedia, not a class, so there won't be any instance of it. 但是,“ 10是3和4的和”并不在数据中,因此即使记录了10的因数,也不会有任何匹配。最重要的是, dbp:Polio_vaccine是DBpedia不是类,因此不会有任何实例。

Instead, you want to ask for any values of the dbpprop:routesOfAdministation property for the individual dbpedia:Polio_vaccine . 相反,您想询问单个dbpedia:Polio_vaccinedbpprop:routesOfAdministation属性的任何值。 The query you need here is (I'm using the prefixes that are defined at http://dbpedia.org/sparql , the public endpoint): 您在这里需要的查询是(我使用的是在公共端点http://dbpedia.org/sparql定义的前缀):

select ?routes where {
  dbpedia:Polio_vaccine dbpprop:routesOfAdministration ?routes
}

SPARQL results SPARQL结果

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM