Extract date/time based predicates from DBPedia

佐手、 提交于 2019-12-02 20:48:01

问题


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

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


回答1:


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 results

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 results

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.


来源:https://stackoverflow.com/questions/18579620/extract-date-time-based-predicates-from-dbpedia

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!