Date: 2010-06-23 16:52:16
From: adamcoen86-at-googlemail.com
Hi
I'd like to select each movie has been made from 2005 to today from dbpedia;
so I write:
PREFIX fb-film: <http://rdf.freebase.com/ns/film.film.>PREFIX db-ont: <
http://dbpedia.org/ontology/> PREFIX db-work: <
http://dbpedia.org/ontology/Work/> PREFIX rdf: <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <
http://www.w3.org/2002/07/owl#> PREFIX fb-alb: <
http://rdf.freebase.com/ns/music.album.> PREFIX xsd: <
http://www.w3.org/2001/XMLSchema#>
SELECT DISTINCT ?id ?relDate WHERE {
?id rdf:type db-ont:Film  .
?id db-ont:releaseDate ?relDate
FILTER(xsd:relDate(?dataUscita) > xsd:dateTime("2005-01-01"))
}
but unfortunately I don't get any results...this query looks right to
me,isn't it? Why doesn't it work?

asked 03 Apr '13, 04:22

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k142160227
accept rate: 30%

edited 17 Apr '13, 10:52

nkrustev's gravatar image

nkrustev ♦♦
66117


Date: 2010-06-24 09:55:13
From: damyan-at-sirma.bg
Hi Adam,
comparing Calendar types is a bit tricky task - currently the xsd typecasts in the query engine do not convert the values to valid calendar values prior to apply the requested operation so you end up comparing incompatible calendar values which screw the whole query result - for your particular query the next one could do the job but it exploits the fact that all the dates related with the dbp:relesedate property have xsd:date datatype so promoting that type to the literal with which you compare will do the trick:
SELECT DISTINCT ?id ?relDate WHERE { 
?id rdf:type db-ont:Film  .  
?id db-ont:releaseDate ?relDate
FILTER(?relDate > ("2005-01-01"^^xsd:date))
}
n.b. you always could use str() operator instead to convert to a datatype-less values and compare them lexicographically e.g.
FILTER( str(?relDate) > "2005-01-01)
HTH,
Damyan Ognyanov
Ontotext AD
link

answered 03 Apr '13, 04:22

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k142160227
accept rate: 30%

edited 17 Apr '13, 10:52

nkrustev's gravatar image

nkrustev ♦♦
66117

Date: 2010-06-23 17:43:36
From: adamcoen86-at-googlemail.com
Ok, that query was wrong, this is the right one:
PREFIX fb-film: <http://rdf.freebase.com/ns/film.film.>PREFIX db-ont: <
http://dbpedia.org/ontology/> PREFIX db-work: <
http://dbpedia.org/ontology/Work/> PREFIX rdf: <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <
http://www.w3.org/2002/07/owl#> PREFIX fb-alb: <
http://rdf.freebase.com/ns/music.album.> PREFIX xsd: <
http://www.w3.org/2001/XMLSchema#>
SELECT DISTINCT ?id ?relDate WHERE {
?id rdf:type db-ont:Film  .
?id db-ont:releaseDate ?relDate
FILTER(xsd:dateTime(?relDate) > xsd:dateTime("2005-01-01"))
}
but it still gives me an empty result set...
link

answered 03 Apr '13, 04:22

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k142160227
accept rate: 30%

edited 17 Apr '13, 10:52

nkrustev's gravatar image

nkrustev ♦♦
66117

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×261
×242
×37

Asked: 03 Apr '13, 04:22

Seen: 1,672 times

Last updated: 21 Jan, 11:18

powered by BitNami OSQA