Child pages
  • Fedora Resource Index
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

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 
          <info:fedora/fedora-system:def/relations-external#isMemberOfCollection>
          <info:fedora/iudl:10>
  )
from <#ri>
where $a $b $c

Encoding queries as URLs

The version of risearch that comes with Fedora 2.1 doesn't display the encoded-URL version of the query. To manually encode a query, make the following substitutions:

Original

Replaced

#

%23

$

%24

(

%28

)

%29

/

%2F

:

%3A

<

%3C

>

%3E

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0b59b3d9-a931-4127-b6bf-f8684f708f74"><ac:plain-text-body><![CDATA[

[space]

+

]]></ac:plain-text-body></ac:structured-macro>

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

http://mallow.dlib.indiana.edu:9090/fedora/risearch?type=tuples&lang=itql&format=Sparql&query=

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):

http://mallow.dlib.indiana.edu:9090/fedora/risearch?type=tuples&lang=itql&format=Sparql&query=select+%24page+
%24sequence+from+%3C%23ri%3E+where+%24page+%3Cinfo%3Afedora%2Ffedora-system%3Adef%2Frelations-external%23
isPartOf%3E+%3C(objuri)%3E+and+%24page+%3Chttp%3A%2F%2Fdlib.indiana.edu%2Flib%2Fxml%2Finfrastructure%2F
rdfRelations%23sequenceNumber%3E+%24sequence&dummy=(NULLBIND)
  • No labels