This HTML5 document contains 35 embedded RDF statements represented using HTML+Microdata notation.

The embedded RDF content will be recognized by any processor of HTML5 Microdata.

PrefixNamespace IRI
dctermshttp://purl.org/dc/terms/
atomhttp://atomowl.org/ontologies/atomrdf#
foafhttp://xmlns.com/foaf/0.1/
n18http://vos.openlinksw.com/dataspace/services/wiki/
oplhttp://www.openlinksw.com/schema/attribution#
n16http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+DISTINCT+%3Fs+%3Fdate%0D%0A%0D%0AWHERE%0D%0A++%7B%0D%0A++++%3Fs+%3Fp+%3Fdate+.+FILTER%28+%3Fdate+%3E%3D+xsd%3Adate%28%221945-01-01%22%29+%26%26+%3Fdate+%3C+xsd%3Adate%28%221946-01-01%22%29+%26%26+%28str%28%3Fp%29+%21%3D+str%28rdfs%3Alabel%29%29+%29%0D%0A++%7D%0D%0ALIMIT+10&format=text%2Fhtml&timeout=0&debug=
n2http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/
n14http://docs.openlinksw.com/virtuoso/rdfsparql.
dchttp://purl.org/dc/elements/1.1/
n20http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+%3Fs+%3Fdate+%0D%0AFROM+%3Chttp%3A%2F%2Fdbpedia.org%3E+%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+%3Fp+%3Fdate+.+FILTER+%28+%3Fdate+%3E%3D+%2219450101%22%5E%5Exsd%3Adate+%26%26+%3Fdate+%3C%3D+%2219451231%22%5E%5Exsd%3Adate+%29++%0D%0A++%7D+%0D%0ALIMIT+100&format=text%2Fhtml&timeout=0&debug=
n6http://vos.openlinksw.com/dataspace/dav#
rdfshttp://www.w3.org/2000/01/rdf-schema#
n19http://rdfs.org/sioc/services#
n12http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/VirtTipsAndTricksGuideDataRangeQueries/sioc.
siocthttp://rdfs.org/sioc/types#
n7http://vos.openlinksw.com/dataspace/person/dav#
n10http://vos.openlinksw.com/dataspace/owiki/wiki/
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
n5http://vos.openlinksw.com/dataspace/owiki#
n22http://dbpedia.
xsdhhttp://www.w3.org/2001/XMLSchema#
n23http://vos.openlinksw.com/dataspace/%28NULL%29/wiki/VOS/
n13http://vos.openlinksw.com/dataspace/person/owiki#
siochttp://rdfs.org/sioc/ns#
Subject Item
n7:this
foaf:made
n2:VirtTipsAndTricksGuideDataRangeQueries
Subject Item
n6:this
sioc:creator_of
n2:VirtTipsAndTricksGuideDataRangeQueries
Subject Item
n18:item
n19:services_of
n2:VirtTipsAndTricksGuideDataRangeQueries
Subject Item
n5:this
sioc:creator_of
n2:VirtTipsAndTricksGuideDataRangeQueries
Subject Item
n10:VOS
sioc:container_of
n2:VirtTipsAndTricksGuideDataRangeQueries
atom:entry
n2:VirtTipsAndTricksGuideDataRangeQueries
atom:contains
n2:VirtTipsAndTricksGuideDataRangeQueries
Subject Item
n2:VirtTipsAndTricksGuideDataRangeQueries
rdf:type
sioct:Comment atom:Entry
dcterms:created
2017-06-13T05:38:52.886474
dcterms:modified
2017-06-13T05:38:52.886474
rdfs:label
VirtTipsAndTricksGuideDataRangeQueries
foaf:maker
n7:this n13:this
dc:title
VirtTipsAndTricksGuideDataRangeQueries
opl:isDescribedUsing
n12:rdf
sioc:has_creator
n5:this n6:this
sioc:content
%META:TOPICPARENT{name="VirtTipsAndTricksGuide"}% ---++How to Manage Date Range in SPARQL queries? The following examples demonstrate how to manage date range in a SPARQL query: ---++++Example 1 <verbatim> SELECT ?s ?date FROM <http://dbpedia.org> WHERE { ?s ?p ?date . FILTER ( ?date >= "19450101"^^xsd:date &amp;&amp; ?date <= "19451231"^^xsd:date ) } LIMIT 100 </verbatim> [[http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+%3Fs+%3Fdate+%0D%0AFROM+%3Chttp%3A%2F%2Fdbpedia.org%3E+%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+%3Fp+%3Fdate+.+FILTER+%28+%3Fdate+%3E%3D+%2219450101%22%5E%5Exsd%3Adate+%26%26+%3Fdate+%3C%3D+%2219451231%22%5E%5Exsd%3Adate+%29++%0D%0A++%7D+%0D%0ALIMIT+100&format=text%2Fhtml&timeout=0&debug=on][View the results]] of the query execution on the [[http://dbpedia.org][dbpedia]] instance. ---++++Example 2 Suppose there is the following query using bif:contains for date: <verbatim> SELECT DISTINCT ?s ?date FROM <http://dbpedia.org> WHERE { ?s ?p ?date . FILTER( bif:contains(?date, '"1945*"' ) &amp;&amp; (str(?p) != str(rdfs:label)) ) } LIMIT 30 </verbatim> If ?date is of type xsd:date or xsd:dateTime and of valid syntax then bif:contains(?date, '"1945*"' ) will not found it, because it will be parsed at load/create and stored as SQL DATE value. So if data are all accurate and typed properly then the filter is: <verbatim> (?date >= xsd:date("1945-01-01") &amp;&amp; ?date < xsd:date("1946-01-01")) </verbatim> i.e. the query should be: <verbatim> SELECT DISTINCT ?s ?date FROM <http://dbpedia.org> WHERE { ?s ?p ?date . FILTER( ?date >= xsd:date("1945-01-01") &amp;&amp; ?date < xsd:date("1946-01-01") &amp;&amp; (str(?p) != str(rdfs:label)) ) } LIMIT 10 </verbatim> [[http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+DISTINCT+%3Fs+%3Fdate%0D%0A%0D%0AWHERE%0D%0A++%7B%0D%0A++++%3Fs+%3Fp+%3Fdate+.+FILTER%28+%3Fdate+%3E%3D+xsd%3Adate%28%221945-01-01%22%29+%26%26+%3Fdate+%3C+xsd%3Adate%28%221946-01-01%22%29+%26%26+%28str%28%3Fp%29+%21%3D+str%28rdfs%3Alabel%29%29+%29%0D%0A++%7D%0D%0ALIMIT+10&format=text%2Fhtml&timeout=0&debug=on][View the results]] of the query execution on the [[http://dbpedia.org][dbpedia]] instance. If data falls, then the free-text will be OK for tiny examples but not for "big" cases because <b>bif:contains(?date, '"1945*"')</b> would require that less than 200 words in the table begins with 1945. Still, some data can be of accurate type and syntax so range comparison should be used for them and results aggregated via UNION. If dates mention timezones then the application can chose the beginning and the end of the year in some timezones other than the default. ---+++Related * [[VirtTipsAndTricksGuideDataRangeIndexFilter][How to optimize bif:dateadd in SPARQL query using selective index-friendly filter?]] * [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]] * [[http://docs.openlinksw.com/virtuoso/rdfsparql.html][SPARQL]]
sioc:id
9dd9106fef90c909034de6d5f2416459
sioc:link
n2:VirtTipsAndTricksGuideDataRangeQueries
sioc:has_container
n10:VOS
n19:has_services
n18:item
atom:title
VirtTipsAndTricksGuideDataRangeQueries
sioc:links_to
n2:VirtTipsAndTricksGuideDataRangeIndexFilter n14:html n16:on n20:on n22:org n23:VirtTipsAndTricksGuide
atom:source
n10:VOS
atom:author
n7:this
atom:published
2017-06-13T05:38:52Z
atom:updated
2017-06-13T05:38:52Z
sioc:topic
n10:VOS