Fedora Repository 3 Documentation
Page not found

Question

I want to know how to query the Resource Index using the date. What is the predicate I can use in iTQL for date comparison ?

Answer

To do this, you'll need to query against a datatyping model. The full documentation for this is here: http://docs.mulgara.org/itqloperations/datatypingmodels.html#o265

Fedora automatically creates a <#xsd> datatyping model, so you will need to use something like this:

select $object
from <#ri>                                                     
where  $object <fedora-model:hasModel>  <info:fedora/MY-CModel>
and    $object <fedora-view:lastModifiedDate> $modified
and    $ modified <mulgara:after> '2010-02-22T12:54:59.265Z'^^<xml-schema:dateTime> in <#xsd>

Mulgara does not parse time zones for dateTime.

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels

1 Comment

  1. On a related note, to do a date range query you can use Sparql and something like this to get all items created after the entered date and time.

    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX fedora-model: <info:fedora/fedora-system:def/model#>
    
    select ?pid ?date ?label 
    where {
    ?pid fedora-model:label ?label ;
         fedora-model:createdDate ?date
     FILTER( ?date > xsd:dateTime("2014-01-01T00:00:00Z")) .
     
    }