Size: 2406
Comment:
|
← Revision 15 as of 2010-03-17 13:12:54 ⇥
Size: 5839
Comment: converted to 1.6 markup
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
The Fedora Resource Index service is described in | The Fedora Resource Index service is described in http://www.fedora-commons.org/confluence/display/FCR30/Resource+Index |
Line 5: | Line 5: |
http://www.fedora-commons.org/confluence/display/FCR30/Resource+Index | |
Line 7: | Line 6: |
The resource index is queried by iTQL. A guide to iTQL can be found on | == iTQL == The resource index is queried by iTQL (interactive Tucana Query Language?), which is largely similar to SQL (Structured Query Language). A guide to iTQL can be found on http://docs.mulgara.org/itqlcommands/select.html |
Line 9: | Line 9: |
http://docs.mulgara.org/itqlcommands/select.html | This has a graphical user interface, which it very helpful to users, but not programmatically useful. The interface is described here: http://www.fedora-commons.org/confluence/display/FCR30/Resource+Index+Search |
Line 11: | Line 11: |
This has a graphical user interface, which it very helpful to users, but not programmatically useful. | We have prepared a number of useful iTQL queries, that can serve as examples. These can be tested on the doms testbed in http://localhost:8080/fedora/risearch |
Line 13: | Line 13: |
http://www.fedora-commons.org/confluence/display/FCR30/Resource+Index+Search | Find all direct subclasses of doms:!ContentModel_File in the Base collection {{{ select $object from <#ri> where $object <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> <info:fedora/doms:ContentModel_File> and $object <http://doms.statsbiblioteket.dk/relations/default/0/1/#isPartOfCollection> <info:fedora/doms:DOMS_Base_Collection> }}} |
Line 15: | Line 21: |
For programs, there are two interfaces, neither of which is very optimal. | Find the ancestors of doms:!ContentModel_!AudioPreservationFile {{{ select $object from <#ri> where walk( <info:fedora/doms:ContentModel_AudioPreservationFile> <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object ) }}} |
Line 17: | Line 30: |
The first is the REST-based interface, defined in | Find all objects that relate to doms:!ContentModel_DOMS via a series of extendsModel relations. {{{ select $subject from <#ri> where walk( $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> <info:fedora/doms:ContentModel_DOMS> and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $obbject ); }}} |
Line 19: | Line 40: |
http://www.fedora-commons.org/confluence/display/FCR30/Resource+Index+Search#ResourceIndexSearch-ApplicationInterface | Same as above, but with more expressive output, namely the relation-chain. {{{ select $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object from <#ri> where walk( $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> <info:fedora/doms:ContentModel_DOMS> and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object ); }}} |
Line 21: | Line 50: |
The second is the Fedora client, which has a method getTuples(). See | Anylevel children of !ContentModel_DOMS in the base collection {{{ select $subject from <#ri> where walk( $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> <info:fedora/doms:ContentModel_DOMS> and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object ) and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#isPartOfCollection> <info:fedora/doms:DOMS_Base_Collection> }}} |
Line 23: | Line 61: |
http://www.fedora-commons.org/documentation/3.0/javadocs/index.html?fedora/client/FedoraClient.html. | Any objects relating to Root collection through a series of "isPartOfCollection" relations. {{{ select $subject '<isPartOfCollection>' $object from <#ri> where walk( $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#isPartOfCollection> <info:fedora/doms:Root_Collection> and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#isPartOfCollection> $object ) }}} |
Line 25: | Line 70: |
It has the javadoc | All Templates of content models in the base collection {{{ select $defbject from <#ri> where walk( $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> <info:fedora/doms:ContentModel_DOMS> and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object ) and $defbject <http://doms.statsbiblioteket.dk/relations/default/0/1/#isTemplateFor> $subject and $defbject <http://doms.statsbiblioteket.dk/relations/default/0/1/#isPartOfCollection> <info:fedora/doms:DOMS_Base_Collection> }}} |
Line 27: | Line 82: |
== Interacting with the Resource index == For programs, there are two interfaces. === REST interface === The first is the REST-based interface defined in http://www.fedora-commons.org/confluence/display/FCR30/Resource+Index+Search#ResourceIndexSearch-ApplicationInterface === Java interface === The second is the Fedora client, which has a method {{{getTuples()}}}. See http://www.fedora-commons.org/documentation/3.0/javadocs/index.html?fedora/client/FedoraClient.html. The method {{{getTuples()}}} has the following javadoc |
|
Line 35: | Line 102: |
}}} which is nicely outdated. This method, returns an org.trippi.TupleIterator which parses the sparql result. The javadoc for this can be found on http://trippi.sourceforge.net/api/org/trippi/TupleIterator.html Note that the page is not updated either, the releases can be found in the svn, and has reached version 1.4. Fedora use 1.3.2, which is unknown, but 1.3.1 can be checked out. Look at http://sourceforge.net/svn/?group_id=123675 to od this. |
}}} which is unfortunately outdated, but still largely correct. |
Line 39: | Line 104: |
The result consist of a list of maps. The iterator iterates through this list, returning maps. The iterator has a method, names, giving the keys to each map. The values in the maps are of type Node, | The method returns an {{{org.trippi.TupleIterator}}} which parses the sparql result. The javadoc for this can be found on http://trippi.sourceforge.net/api/org/trippi/TupleIterator.html, which is for 1.1.2 Note that the page is not updated either. The releaseses can be found in the svn, and has reached version 1.4. Fedora uses 1.3.2, which is unknown, but 1.3.1 can be checked out. Look at http://sourceforge.net/svn/?group_id=123675 to do this. The result consist of a list of maps. The iterator iterates through this list, returning maps. The iterator has a method, names(), giving the keys to each map. The values in the maps are of type Node, see |
Line 41: | Line 109: |
In practice each node will always be a Literal node or a URI reference Node or a Blank node, http://jrdf.sourceforge.net/0.3.4/doc/javadoc/org/jrdf/graph/URIReference.html, http://jrdf.sourceforge.net/0.3.4/doc/javadoc/org/jrdf/graph/Literal.html , http://jrdf.sourceforge.net/0.3.4/doc/javadoc/org/jrdf/graph/BlankNode.html |
In practice each node will always be a Literal node or a URI reference Node or a Blank node, see the following * http://jrdf.sourceforge.net/0.3.4/doc/javadoc/org/jrdf/graph/Literal.html, * http://jrdf.sourceforge.net/0.3.4/doc/javadoc/org/jrdf/graph/URIReference.html, * http://jrdf.sourceforge.net/0.3.4/doc/javadoc/org/jrdf/graph/BlankNode.html |
Fedora Resource Index
The Fedora Resource Index service is described in http://www.fedora-commons.org/confluence/display/FCR30/Resource+Index
iTQL
The resource index is queried by iTQL (interactive Tucana Query Language?), which is largely similar to SQL (Structured Query Language). A guide to iTQL can be found on http://docs.mulgara.org/itqlcommands/select.html
This has a graphical user interface, which it very helpful to users, but not programmatically useful. The interface is described here: http://www.fedora-commons.org/confluence/display/FCR30/Resource+Index+Search
We have prepared a number of useful iTQL queries, that can serve as examples. These can be tested on the doms testbed in http://localhost:8080/fedora/risearch
Find all direct subclasses of doms:ContentModel_File in the Base collection
select $object from <#ri> where $object <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> <info:fedora/doms:ContentModel_File> and $object <http://doms.statsbiblioteket.dk/relations/default/0/1/#isPartOfCollection> <info:fedora/doms:DOMS_Base_Collection>
Find the ancestors of doms:ContentModel_AudioPreservationFile
select $object from <#ri> where walk( <info:fedora/doms:ContentModel_AudioPreservationFile> <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object )
Find all objects that relate to doms:ContentModel_DOMS via a series of extendsModel relations.
select $subject from <#ri> where walk( $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> <info:fedora/doms:ContentModel_DOMS> and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $obbject );
Same as above, but with more expressive output, namely the relation-chain.
select $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object from <#ri> where walk( $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> <info:fedora/doms:ContentModel_DOMS> and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object );
Anylevel children of ContentModel_DOMS in the base collection
select $subject from <#ri> where walk( $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> <info:fedora/doms:ContentModel_DOMS> and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object ) and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#isPartOfCollection> <info:fedora/doms:DOMS_Base_Collection>
Any objects relating to Root collection through a series of "isPartOfCollection" relations.
select $subject '<isPartOfCollection>' $object from <#ri> where walk( $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#isPartOfCollection> <info:fedora/doms:Root_Collection> and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#isPartOfCollection> $object )
All Templates of content models in the base collection
select $defbject from <#ri> where walk( $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> <info:fedora/doms:ContentModel_DOMS> and $subject <http://doms.statsbiblioteket.dk/relations/default/0/1/#extendsModel> $object ) and $defbject <http://doms.statsbiblioteket.dk/relations/default/0/1/#isTemplateFor> $subject and $defbject <http://doms.statsbiblioteket.dk/relations/default/0/1/#isPartOfCollection> <info:fedora/doms:DOMS_Base_Collection>
Interacting with the Resource index
For programs, there are two interfaces.
REST interface
The first is the REST-based interface defined in http://www.fedora-commons.org/confluence/display/FCR30/Resource+Index+Search#ResourceIndexSearch-ApplicationInterface
Java interface
The second is the Fedora client, which has a method getTuples(). See http://www.fedora-commons.org/documentation/3.0/javadocs/index.html?fedora/client/FedoraClient.html.
The method getTuples() has the following javadoc
/** * Get tuples from the remote resource index. The map contains * <em>String</em> values for parameters that should be passed to the * service. Two parameters are required: 1) lang 2) query Two parameters to * the risearch service are implied: 1) type = tuples 2) format = sparql See * http://www.fedora.info/download/2.0/userdocs/server/webservices/risearch/#app.tuples */
which is unfortunately outdated, but still largely correct.
The method returns an org.trippi.TupleIterator which parses the sparql result. The javadoc for this can be found on http://trippi.sourceforge.net/api/org/trippi/TupleIterator.html, which is for 1.1.2 Note that the page is not updated either. The releaseses can be found in the svn, and has reached version 1.4. Fedora uses 1.3.2, which is unknown, but 1.3.1 can be checked out. Look at http://sourceforge.net/svn/?group_id=123675 to do this.
The result consist of a list of maps. The iterator iterates through this list, returning maps. The iterator has a method, names(), giving the keys to each map. The values in the maps are of type Node, see http://jrdf.sourceforge.net/0.3.4/doc/javadoc/org/jrdf/graph/Node.html
In practice each node will always be a Literal node or a URI reference Node or a Blank node, see the following