The ResourceIndex manages relationships between Fedora objects. It is very powerful, but the query syntax can be tricky.

Sample RIsearch queries

Select objects, modification dates, and titles. Start with the 50th Fedora object, and get the next 25 objects:

select     $object $modified $title $type
from       <#ri>
where      $object <rdf:type> $type
and        $object <rdf:type> <fedora-model:FedoraObject>
and        $object <fedora-view:lastModifiedDate> $modified
and        $object <dc:title> $title
order by   $title $object
limit      25
offset     50

Count all objects that are members of the collection object iudl:10:

select count(
  select  $object
  from    <#ri>
  where   $object
from <#ri>
where $a $b $c

Get objects with models and created dates that were created in a specified date range:

select $object $model $created from <#ri> 
where  $object <fedora-model:hasModel> $model 
and    $object <info:fedora/fedora-system:def/model#createdDate> $created
and    $created <mulgara:after> '2015-12-01T00:00:00.000Z'^^<xml-schema:dateTime> in <#xsd>
and    $created <mulgara:before> '2016-01-01T00:00:00.000Z'^^<xml-schema:dateTime> in <#xsd>

Get all collection objects:

select  $object
from    <#ri>
where   $object

Get the status of the OVERVIEW datastream:

select  $state
from    <#ri>
where   <info:fedora/iudl:99732/OVERVIEW>

Find all inactive items:

select  $object
from    <#ri>
where   $object

Find the OwnerID for an item:

select  $ownerId
from    <#ri>
where   <info:fedora/iudl:200332>

Count all non-deleted items in a collection:

select count(select  $object
from    <#ri>
where $object
minus $object
from <#ri>
where $a $b $c

Find all Service Deployments

select $object from <#ri>
where  $object <fedora-model:hasModel> <info:fedora/fedora-system:ServiceDeployment-3.0>

Find all Service Deployments for a given content model (in this case, the cmodel:image content model):

select $object from <#ri>
where  $object <fedora-model:isContractorOf> <info:fedora/cmodel:image>

Find all deleted object:

select  $object
from    <#ri>
where   $object <fedora-model:state> <info:fedora/fedora-system:def/model#Deleted>

Find all collections that have an item exposed through OAI PMH: (NOTE: be sure to check "Force Distinct")

select $collectionPid
from   <#ri>
where  $item           <> $itemID
and    $item           <info:fedora/fedora-system:def/relations-external#isMemberOfCollection>

Find all image-derivative items in the slocum collection that aren't described by another object nor contain description themselves

select $image
from <#ri>
where $image <fedora-model:hasModel> <info:fedora/cmodel:image-derivatives>
and $image <info:fedora/fedora-system:def/relations-external#isMemberOfCollection>
minus $image
minus $image <fedora-model:hasModel> <info:fedora/cmodel:item-metadata>

Find all service definitions that aren't registered with a "hasService" relationship to another object.

select $object from <#ri>
where $object <fedora-model:hasModel> <info:fedora/fedora-system:ServiceDefinition-3.0>
minus $object2 <fedora-model:hasService> $object


Encoding queries as URLs

All RI queries must be URL-encoded (with a tool like this one) before being added to a behavior mechanism. To manually encode a query, make the following substitutions:





















Do not encode the parentheses around any parameters that you want Fedora to pass in. The encoded query should be placed after a suitable base URL like

If no datastream parameters are being passed, remember to include a "nullbind" parameter (see Behavior Mechanisms for more detail on this). Here is a completed query that searches for the pages of a given object (linebreaks added for readability):