Created
May 22, 2012 14:07
-
-
Save taniki/2769308 to your computer and use it in GitHub Desktop.
merge of birthdate and birthyear when birthdate not available
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PREFIX dbo: <http://dbpedia.org/ontology/> | |
| PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
| SELECT DISTINCT ?person ?birthdate | |
| WHERE { | |
| ?person rdf:type dbo:Philosopher . | |
| { | |
| ?person dbo:birthDate ?birthdate . | |
| FILTER( datatype(?birthdate) != xsd:gMonthDay ). | |
| } | |
| UNION { | |
| ?person dbo:birthYear ?birthdate . | |
| OPTIONAL { | |
| ?person dbo:birthDate ?b . | |
| FILTER( datatype(?b) != xsd:gMonthDay ). | |
| } | |
| FILTER( !bound(?b) ) | |
| } | |
| } | |
| ORDER BY ?birthdate |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if someone knows why the following query does not work, I'll be happy to think that SPARQL is simple.