SPARQL查询从以下Turtle文件返回2001-2017之间所有日志的语法是什么?
@prefix c:<http://www.example.com/journal#> .
c:article1 c:title "Benifits of Computer" .
c:article1 c:author "Jhon Maur" .
c:article1 c:topic "Computers" .
c:article1 c:date "12/02/1978" .
c:article2 c:title "Eating Healthier" .
c:article2 c:author "Dr. Joe Green" .
c:article2 c:topic "Health" .
c:article2 c:date "10/13/1999" .
c:article3 c:title "Sports in America" .
c:article3 c:author "Tom Golds" .
c:article3 c:topic "Sports" .
c:article3 c:date "02/09/2004" .
c:article4 c:title "Students Jobs" .
c:article4 c:author "Harry Parsons" .
c:article4 c:topic "Commentary" .
c:article4 c:date "09/19/2012" .
c:article5 c:title "The Golden Age of IT" .
c:article5 c:author "Jhon Maur" .
c:article5 c:topic "Computers" .
c:article5 c:date "12/02/1990" .
c:article6 c:title "Health Foods to Avoid" .
c:article6 c:author "Dr. Joe Green" .
c:article6 c:topic "Heallth" .
c:article6 c:date "10/13/2007" .
c:article7 c:title "Boutique Languages" .
c:article7 c:author "Allister Rhodes" .
c:article7 c:topic "Computers" .
c:article7 c:date "02/09/2004" .
c:article8 c:title "Big Brother or Government" .
c:article8 c:author "Tomas Weiss" .
c:article8 c:topic "Commentary" .
c:article8 c:date "03/09/2016" .
c:article9 c:title "Getting a Good Job" .
c:article9 c:author "Joan Wiley" .
c:article9 c:topic "Commentary" .
c:article9 c:date "07/11/2014" .
c:article10 c:title "Scheduling Jobs in Python" .
c:article10 c:author "Tony Issacs" .
c:article10 c:topic "Computers" .
c:article10 c:date "01/09/2017" .
答案 0 :(得分:2)
如果您只使用字符串来表示日期,那么您必须进行一些字符串解析才能完成这些年。相反,您应该使用实际的数据类型文字(可能是 xsd:dateTime )来表示时间,这样您就可以使用year函数,然后执行以下操作:
EXECUTE PROCEDURE buscaExactPaisSS ''
如果您真的致力于使用格式的字符串&#34; mm / dd / yyyy&#34;对于日期,您可以像这样提取值:
select ?article {
?article c:date ?date
filter (2001 <= year(?date) && year(?date) <= 2017)
}