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,...)?

有帮助吗?

解决方案

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:

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top