从DBPedia中提取基于日期/时间的谓词 [英] Extract date/time based predicates from DBPedia

查看:104
本文介绍了从DBPedia中提取基于日期/时间的谓词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从DBPedia的转储文件中提取所有语句。

I want to extract all statements from DBPedia's dump file.

是否可以编写sparql查询来提取包含日期值(例如releaseDate,deathDate,birthDate等)的谓词列表?

Is it possible to write a sparql query to extract the list of predicates which contains the date values (like releaseDate, deathDate, birthDate,...)?

推荐答案

您可以编写一个找到这类的SPARQL查询(用SPARQL标记,因此大概是您要查询的东西)属性。您需要做的就是查询owl:DatatypeProperties(因为日期应该是文字),然后根据其字符串表示形式进行过滤。例如:

You can write a SPARQL query (you tagged with SPARQL, so presumably that's how you want to query for these things) that finds these kind of properties. All you need to do is query for things which are owl:DatatypeProperties (since dates should be literals), and then filter based on their string representation. For instance:

select ?p where {
  ?p a owl:DatatypeProperty
  filter( contains( str(?p), "Date" ) || contains( str(?p), "date" ))
}
limit 100

SPARQL结果

现在,它将返回任何字符串形式的属性包含字符串日期或日期。您会发现其中大多数都是您想要的东西。但是,执行此操作的更好方法可能是使用如下查询来搜索以xsd:date为范围的内容:

Now, that will return any property whose string form contains the strings "Date" or "date". You'll find that most of those are the kind of things you're looking for. However, a better way to do this might be to search for things that have xsd:date as their range, using a query like this:

select ?p where {
  ?p a owl:DatatypeProperty ;
     rdfs:range xsd:date .
}
limit 100

SPARQL结果

这样做的好处是,即使名称不为日期,您也将获得其值应为日期的属性。包括日期。例如,您将获得:

This has the advantage that you'll get properties whose values should be dates, even if their name doesn't include date. For instance, you'll get:

  • http://dbpedia.org/ontology/closed;
  • http://dbpedia.org/ontology/discovered;
  • http://dbpedia.org/ontology/finalFlight;
  • … and so on.

这篇关于从DBPedia中提取基于日期/时间的谓词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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