Sparql查询具有特定信息框的页面的语法 [英] Syntax for Sparql query for pages with specific infobox

查看:92
本文介绍了Sparql查询具有特定信息框的页面的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是第一次(在dbpedia上)尝试使用Sparql,但无法进行任何查询。我尝试的所有操作都会返回语法错误或空数据集。

I'm trying Sparql for the first time (on dbpedia) and can't get any queries to work. Everything I try returns a syntax error or an empty dataset.

例如,我在此页面。它们不起作用,因此我进行了以下更改:

-我了解到WikiPageUsesTemplate已更改为 http://dbpedia.org/ontology/wikiPageUsesTemplate

-我在选择语句中添加了 WHERE,尽管我猜想这必须是可选的,

-我将整个事情减少到最低限度:只是infobox子句。

For example, I tried the queries on this page. They didn't work, so I made the following changes:
- I read that wikiPageUsesTemplate has changed to http://dbpedia.org/ontology/wikiPageUsesTemplate,
- I add 'WHERE' to select statement, though I guess that must be optional,
- I reduced the whole thing to a minimum: just the infobox clause.

但是它仍然不起作用!这是我想出的:

But it still doesn't work! Here is what I came up with:

PREFIX dbo: <http://dbpedia.org/ontology/>

SELECT * WHERE {
    ?page dbo:wikiPageUsesTemplate
        <http://dbpedia.org/resource/Template:Infobox_artist>
}
LIMIT 100

我一直在尝试查询这里

推荐答案

我不确定您为什么使用 dbpedia-owl:wikiPageUsesTemplate 。根据 http://wiki.dbpedia.org/Datasets39/Properties (强调):

I'm not sure why you're using dbpedia-owl:wikiPageUsesTemplate. According to http://wiki.dbpedia.org/Datasets39/Properties (emphasis added):


http:// xx.dbpedia.org/property/wikiPageUsesTemplate 可能是
更改为
未来版本)中的http://dbpedia.org/ontology/wikiPageUsesTemplate

http://xx.dbpedia.org/property/wikiPageUsesTemplate (may be changed to http://dbpedia.org/ontology/wikiPageUsesTemplate in future releases)

我不是DBpedia中的当前数据是否是将来的发行版(就该文档而言),但是听起来您仍然应该使用旧属性。不过,测试起来很容易。由于您拥有查询语言和网络服务,因此尝试更一般的结果作为一种健全性检查非常容易。特别是,类似以下内容的内容强烈表明它不是您想要的属性。

I'm not whether the current data in DBpedia is a future release (in terms of that document), but it sounds like you should still be on the old property. It's easy enough to test this, though. Since you have a query language and a webservice, it's quite easy to try a more general result as a sort of sanity check. In particular, something like the following very strongly suggests that it's not the property you want.

SELECT *  WHERE {
  ?s <http://dbpedia.org/ontology/wikiPageUsesTemplate> ?o         
}
LIMIT 100

SPARQL结果(0个结果)

类似地,由于您有一个交互式端点,为什么不尝试查看的哪些属性与< http://dbpedia.org/resource/Template:Infobox_artist> 相关,

Similarly, since you've got an interactive endpoint, why not try seeing what properties do relate things to <http://dbpedia.org/resource/Template:Infobox_artist>, and by what properties?

SELECT distinct ?p  WHERE {
  ?s ?p <http://dbpedia.org/resource/Template:Infobox_artist>      
}
limit 500

SPARQL结果(2个结果)

两个结果是

http://www.w3.org/2002/07/owl#sameAs
http://dbpedia.org/ontology/wikiPageRedirects

更多查询可以向我们显示重定向到它的内容。事实证明,这只是

More queries can show us what redirects to it. It turns out that it's just

http://dbpedia.org/resource/Template:Infobox_Artist

不过,事实也与此无关。

As it turns out, though, nothing is related to that either.

SELECT * WHERE {
   ?s ?p <http://dbpedia.org/resource/Template:Infobox_Artist>
}
limit 500

SPARQL结果(0个结果)

DBpedia似乎实际上并未记录您要查找的信息。

It doesn't look like DBpedia is actually recording the information that you're looking for.

这篇关于Sparql查询具有特定信息框的页面的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆