.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Catmandu::FedoraCommons 3pm" .TH Catmandu::FedoraCommons 3pm "2023-02-05" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Catmandu::FedoraCommons \- Low level Catmandu interface to the Fedora Commons REST API .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # Use the command line tools \& $ fedora_admin.pl \& \& # Or the low\-level API\-s \& use Catmandu::FedoraCommons; \& \& my $fedora = Catmandu::FedoraCommons\->new(\*(Aqhttp://localhost:8080/fedora\*(Aq,\*(AqfedoraAdmin\*(Aq,\*(AqfedoraAdmin\*(Aq); \& \& my $result = $fedora\->findObjects(terms=>\*(Aq*\*(Aq); \& \& die $result\->error unless $result\->is_ok; \& \& my $hits = $result\->parse_content(); \& \& for my $hit (@{ $hits\->{results} }) { \& printf "%s\en" , $hit\->{pid}; \& } \& \& # Or using the higher level Catmandu::Store codes you can do things like \& \& use Catmandu::Store::FedoraCommons; \& \& my $store = Catmandu::Store::FedoraCommons\->new( \& baseurl => \*(Aqhttp://localhost:8080/fedora\*(Aq, \& username => \*(AqfedoraAdmin\*(Aq, \& password => \*(AqfedoraAdmin\*(Aq, \& model => \*(AqCatmandu::Store::FedoraCommons::DC\*(Aq # default \& ); \& \& $store\->bag\->each(sub { \& my $model = shift; \& printf "title: %s\en" , join("" , @{ $model\->{title} }); \& printf "creator: %s\en" , join("" , @{ $model\->{creator} }); \& \& my $pid = $model\->{_id}; \& my $ds = $store\->fedora\->listDatastreams(pid => $pid)\->parse_content; \& }); \& \& my $obj = $store\->bag\->add({ \& title => [\*(AqThe Master and Margarita\*(Aq] , \& creator => [\*(AqBulgakov, Mikhail\*(Aq] } \& ); \& \& $store\->fedora\->addDatastream(pid => $obj\->{_id} , url => "http://myurl/rabbit.jpg"); \& \& # Add your own perl version of a descriptive metadata model by implementing your own \& # model that can do a serialize and deserialize. .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Catmandu::FedoraCommons is an Perl \s-1API\s0 to the Fedora Commons \s-1REST API\s0 (http://www.fedora.info/). Supported versions are Fedora Commons 3.6 or better. .SH "ACCESS METHODS" .IX Header "ACCESS METHODS" .SS "new($base_url,$username,$password)" .IX Subsection "new($base_url,$username,$password)" Create a new Catmandu::FedoraCommons connecting to the baseurl of the Fedora Commons installation. .ie n .SS "findObjects(query => $query, maxResults => $maxResults)" .el .SS "findObjects(query => \f(CW$query\fP, maxResults => \f(CW$maxResults\fP)" .IX Subsection "findObjects(query => $query, maxResults => $maxResults)" .ie n .SS "findObjects(terms => $terms , maxResults => $maxResults)" .el .SS "findObjects(terms => \f(CW$terms\fP , maxResults => \f(CW$maxResults\fP)" .IX Subsection "findObjects(terms => $terms , maxResults => $maxResults)" Execute a search query on the Fedora Commons server. One of 'query' or 'terms' is required. Query contains a phrase optionally including '*' and '?' wildcards. Terms contain one or more conditions separated by space. A condition is a field followed by an operator, followed by a value. The = operator will match if the field's entire value matches the value given. The ~ operator will match on phrases within fields, and accepts the ? and * wildcards. The <, >, <=, and >= operators can be used with numeric values, such as dates. .PP Examples: .PP .Vb 1 \& query => "*o*" \& \& query => "?edora" \& \& terms => "pid~demo:* description~fedora" \& \& terms => "cDate>=1976\-03\-04 creator~*n*" \& \& terms => "mDate>2002\-10\-2 mDate<2002\-10\-2T12:00:00" .Ve .PP Optionally a maxResults parameter may be specified limiting the number of search results (default is 20). This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::findObjects model. .ie n .SS "resumeFindObjects(sessionToken => $token)" .el .SS "resumeFindObjects(sessionToken => \f(CW$token\fP)" .IX Subsection "resumeFindObjects(sessionToken => $token)" This method returns the next batch of search results. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::findObjects model. .PP Example: .PP .Vb 1 \& my $result = $fedora\->findObjects(terms=>\*(Aq*\*(Aq); \& \& die $result\->error unless $result\->is_ok; \& \& my $hits = $result\->parse_content(); \& \& for my $hit (@{ $hits\->{results} }) { \& printf "%s\en" , $hit\->{pid}; \& } \& \& my $result = $fedora\->resumeFindObjects(sessionToken => $hits\->{token}); \& \& my $hits = $result\->parse_content(); \& \& ... .Ve .ie n .SS "getDatastreamDissemination(pid => $pid, dsID=> $dsID, asOfDateTime => $date, callback => \e&callback)" .el .SS "getDatastreamDissemination(pid => \f(CW$pid\fP, dsID=> \f(CW$dsID\fP, asOfDateTime => \f(CW$date\fP, callback => \e&callback)" .IX Subsection "getDatastreamDissemination(pid => $pid, dsID=> $dsID, asOfDateTime => $date, callback => &callback)" This method returns a datastream from the Fedora Commons repository. Required parameters are the identifier of the object \f(CW$pid\fR and the identifier of the datastream \f(CW$dsID\fR. Optionally a datestamp \f(CW$asOfDateTime\fR can be provided. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::getDatastreamDissemination model. .PP To stream the contents of the datastream a callback function can be provided. .PP Example: .PP .Vb 1 \& $fedora\->getDatastreamDissemination(pid => \*(Aqdemo:5\*(Aq, dsID => \*(AqVERYHIGHRES\*(Aq, callback => \e&process); \& \& sub process { \& my ($data, $response, $protocol) = @_; \& print $data; \& } .Ve .ie n .SS "getDissemination(pid => $pid , sdefPid => $sdefPid , method => $method , %method_parameters , callback => \e&callback)" .el .SS "getDissemination(pid => \f(CW$pid\fP , sdefPid => \f(CW$sdefPid\fP , method => \f(CW$method\fP , \f(CW%method_parameters\fP , callback => \e&callback)" .IX Subsection "getDissemination(pid => $pid , sdefPid => $sdefPid , method => $method , %method_parameters , callback => &callback)" This method execute a dissemination method on the Fedora Commons server. Required parameters are the object \f(CW$pid\fR, the service definition \f(CW$sdefPid\fR and the name of the method \f(CW$method\fR. Optionally further method parameters can be provided and a callback function to stream the results (see getDatastreamDissemination). This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::getDatastreamDissemination model. .PP .Vb 1 \& Example: \& \& $fedora\->getDissemination(pid => \*(Aqdemo:29\*(Aq, sdefPid => \*(Aqdemo:27\*(Aq , method => \*(AqresizeImage\*(Aq , width => 100, callback => \e&process); .Ve .ie n .SS "getObjectHistory(pid => $pid)" .el .SS "getObjectHistory(pid => \f(CW$pid\fP)" .IX Subsection "getObjectHistory(pid => $pid)" This method returns the version history of an object. Required is the object \f(CW$pid\fR. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::getObjectHistory model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->getObjectHistory(pid => \*(Aqdemo:29\*(Aq)\->parse_content; \& \& for @{$obj\->{objectChangeDate}} {} \& print "$_\en; \& } .Ve .ie n .SS "getObjectProfile(pid => $pid, asOfDateTime => $date)" .el .SS "getObjectProfile(pid => \f(CW$pid\fP, asOfDateTime => \f(CW$date\fP)" .IX Subsection "getObjectProfile(pid => $pid, asOfDateTime => $date)" This method returns a detailed description of an object. Required is the object \f(CW$pid\fR. Optionally a version date asOfDateTime can be provided. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::getObjectProfile model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->getObjectProfile(pid => \*(Aqdemo:29\*(Aq)\->parse_content; \& \& printf "Label: %s\en" , $obj\->{objLabel}; .Ve .ie n .SS "listDatastreams(pid => $pid, asOfDateTime => $date)" .el .SS "listDatastreams(pid => \f(CW$pid\fP, asOfDateTime => \f(CW$date\fP)" .IX Subsection "listDatastreams(pid => $pid, asOfDateTime => $date)" This method returns a list of datastreams provided in the object. Required is the object \f(CW$pid\fR. Optionally a version date asOfDateTime can be provided. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::listDatastreams model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->listDatastreams(pid => \*(Aqdemo:29\*(Aq)\->parse_content; \& \& for (@{ $obj\->{datastream}} ) { \& printf "Label: %s\en" , $_\->{label}; \& } .Ve .ie n .SS "listMethods(pid => $pid , sdefPid => $sdefPid , asOfDateTime => $date)" .el .SS "listMethods(pid => \f(CW$pid\fP , sdefPid => \f(CW$sdefPid\fP , asOfDateTime => \f(CW$date\fP)" .IX Subsection "listMethods(pid => $pid , sdefPid => $sdefPid , asOfDateTime => $date)" This method return a list of methods that can be executed on an object. Required is the object \f(CW$pid\fR and the object \f(CW$sdefPid\fR. Optionally a version date asOfDateTime can be provided. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::listMethods model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->listMethods(pid => \*(Aqdemo:29\*(Aq)\->parse_content; \& \& for ( @{ $obj\->{sDef} }) { \& printf "[%s]\en" , $_\->{$pid}; \& \& for my $m ( @{ $_\->{method} } ) { \& printf "\et%s\en" , $m\->{name}; \& } \& } .Ve .SS "describeRepository" .IX Subsection "describeRepository" This method returns information about the fedora repository. No arguments required. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::describeRepository model. .PP .Vb 1 \& Example: \& \& my $desc = $fedora\->describeRepository()\->parse_content(); .Ve .SH "MODIFY METHODS" .IX Header "MODIFY METHODS" .ie n .SS "addDatastream(pid => $pid , dsID => $dsID, url => $remote_location, %args)" .el .SS "addDatastream(pid => \f(CW$pid\fP , dsID => \f(CW$dsID\fP, url => \f(CW$remote_location\fP, \f(CW%args\fP)" .IX Subsection "addDatastream(pid => $pid , dsID => $dsID, url => $remote_location, %args)" .ie n .SS "addDatastream(pid => $pid , dsID => $dsID, file => $filename , %args)" .el .SS "addDatastream(pid => \f(CW$pid\fP , dsID => \f(CW$dsID\fP, file => \f(CW$filename\fP , \f(CW%args\fP)" .IX Subsection "addDatastream(pid => $pid , dsID => $dsID, file => $filename , %args)" .ie n .SS "addDatastream(pid => $pid , dsID => $dsID, xml => $xml , %args)" .el .SS "addDatastream(pid => \f(CW$pid\fP , dsID => \f(CW$dsID\fP, xml => \f(CW$xml\fP , \f(CW%args\fP)" .IX Subsection "addDatastream(pid => $pid , dsID => $dsID, xml => $xml , %args)" This method adds a data stream to the object. Required parameters are the object \f(CW$pid\fR, a new datastream \f(CW$dsID\fR and a remote \f(CW$url\fR, a local \f(CW$file\fR or an \f(CW$xml\fR string which contains the content. Optionally any of these datastream modifiers may be provided: controlGroup, altIDs, dsLabel, versionable, dsState, formatURI, checksumType, checksum, mimeType, logMessage. See: https://wiki.duraspace.org/display/FEDORA36/REST+API for more information. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::datastreamProfile model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->addDatastream(pid => \*(Aqdemo:29\*(Aq, dsID => \*(AqTEST\*(Aq , file => \*(AqREADME\*(Aq, mimeType => \*(Aqtext/plain\*(Aq)\->parse_content; \& \& print "Uploaded at: %s\en" , $obj\->{dateTime}; .Ve .ie n .SS "addRelationship(pid => $pid, relation => [ $subject, $predicate, $object] [, dataType => $dataType])" .el .SS "addRelationship(pid => \f(CW$pid\fP, relation => [ \f(CW$subject\fP, \f(CW$predicate\fP, \f(CW$object\fP] [, dataType => \f(CW$dataType\fP])" .IX Subsection "addRelationship(pid => $pid, relation => [ $subject, $predicate, $object] [, dataType => $dataType])" This methods adds a triple to the '\s-1RELS\-EXT\s0' data stream of the object. Requires parameters are the object \&\f(CW$pid\fR and a relation as a triple \s-1ARRAY\s0 reference. Optionally the \f(CW$datatype\fR of the literal may be provided. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::addRelationship model. .PP .Vb 1 \& Example: \& \& $fedora\->addRelationship(pid => \*(Aqdemo:29\*(Aq , relation => [ \*(Aqinfo:fedora/demo:29\*(Aq , \*(Aqhttp://my.org/name\*(Aq , \*(AqPeter\*(Aq]); .Ve .ie n .SS "export(pid => $pid [, format => $format , context => $context , encoding => $encoding])" .el .SS "export(pid => \f(CW$pid\fP [, format => \f(CW$format\fP , context => \f(CW$context\fP , encoding => \f(CW$encoding\fP])" .IX Subsection "export(pid => $pid [, format => $format , context => $context , encoding => $encoding])" This method exports the data model of the object in \s-1FOXML,METS\s0 or \s-1ATOM.\s0 Required is \f(CW$pid\fR of the object. Optionally a \f(CW$context\fR may be provided and the \f(CW$format\fR of the export. See: https://wiki.duraspace.org/display/FEDORA36/REST+API for more information. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::export model. .PP .Vb 1 \& Example: \& \& my $res = $fedora\->export(pid => \*(Aqdemo:29\*(Aq); \& \& print $res\->raw; \& \& print "%s\en" , $res\->parse_content\->{objectProperties}\->{label}; .Ve .ie n .SS "getDatastream(pid => $pid, dsID => $dsID , %args)" .el .SS "getDatastream(pid => \f(CW$pid\fP, dsID => \f(CW$dsID\fP , \f(CW%args\fP)" .IX Subsection "getDatastream(pid => $pid, dsID => $dsID , %args)" This method return metadata about a data stream. Required is the object \f(CW$pid\fR and the \f(CW$dsID\fR of the data stream. Optionally a version 'asOfDateTime' can be provided and a 'validateChecksum' check. See: https://wiki.duraspace.org/display/FEDORA36/REST+API for more information. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::datastreamProfile model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->getDatastream(pid => \*(Aqdemo:29\*(Aq, dsID => \*(AqDC\*(Aq)\->parse_content; \& \& printf "Label: %s\en" , $obj\->{profile}\->{dsLabel}; .Ve .ie n .SS "getDatastreamHistory(pid => $pid , dsID => $dsID , %args)" .el .SS "getDatastreamHistory(pid => \f(CW$pid\fP , dsID => \f(CW$dsID\fP , \f(CW%args\fP)" .IX Subsection "getDatastreamHistory(pid => $pid , dsID => $dsID , %args)" This method returns the version history of a data stream. Required parameters is the \f(CW$pid\fR of the object and the \f(CW$dsID\fR of the data stream. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::datastreamHistory model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->getDatastreamHistory(pid => \*(Aqdemo:29\*(Aq, dsID => \*(AqDC\*(Aq)\->parse_content; \& \& for (@{ $obj\->{profile} }) { \& printf "Version: %s\en" , $_\->{dsCreateDate}; \& } .Ve .ie n .SS "getNextPID(namespace => $namespace, numPIDs => $numPIDs)" .el .SS "getNextPID(namespace => \f(CW$namespace\fP, numPIDs => \f(CW$numPIDs\fP)" .IX Subsection "getNextPID(namespace => $namespace, numPIDs => $numPIDs)" This method generates a new pid. Optionally a 'namespace' can be provided and the required 'numPIDs' you need. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::pidList model. .PP .Vb 1 \& Example: \& \& my $pid = $fedora\->getNextPID()\->parse_content\->[0]; .Ve .ie n .SS "getObjectXML(pid => $pid)" .el .SS "getObjectXML(pid => \f(CW$pid\fP)" .IX Subsection "getObjectXML(pid => $pid)" This method exports the data model of the object in \s-1FOXML\s0 format. Required is \f(CW$pid\fR of the object. This method returns a Catmandu::FedoraCommons::Response object . .PP .Vb 1 \& Example: \& \& my $res = $fedora\->getObjectXML(pid => \*(Aqdemo:29\*(Aq); \& \& print $res\->raw; .Ve .ie n .SS "getRelationships(pid => $pid [, relation => [$subject, $predicate, undef] , format => $format ])" .el .SS "getRelationships(pid => \f(CW$pid\fP [, relation => [$subject, \f(CW$predicate\fP, undef] , format => \f(CW$format\fP ])" .IX Subsection "getRelationships(pid => $pid [, relation => [$subject, $predicate, undef] , format => $format ])" This method returns all RELS-EXT triples for an object. Required parameter is the \f(CW$pid\fR of the object. Optionally the triples may be filetered using the 'relation' parameter. Format defines the returned format. See: https://wiki.duraspace.org/display/FEDORA36/REST+API for more information. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::getRelationships model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->getRelationships(pid => \*(Aqdemo:29\*(Aq)\->parse_content; \& \& my $iter = $obj\->get_statements(); \& \& print "Names of things:\en"; \& while (my $st = $iter\->next) { \& my $s = $st\->subject; \& my $name = $st\->object; \& print "The name of $s is $name\en"; \& } .Ve .ie n .SS "ingest(pid => $pid , file => $filename , xml => $xml , format => $format , %args)" .el .SS "ingest(pid => \f(CW$pid\fP , file => \f(CW$filename\fP , xml => \f(CW$xml\fP , format => \f(CW$format\fP , \f(CW%args\fP)" .IX Subsection "ingest(pid => $pid , file => $filename , xml => $xml , format => $format , %args)" .ie n .SS "ingest(pid => 'new' , file => $filename , xml => $xml , format => $format , %args)" .el .SS "ingest(pid => 'new' , file => \f(CW$filename\fP , xml => \f(CW$xml\fP , format => \f(CW$format\fP , \f(CW%args\fP)" .IX Subsection "ingest(pid => 'new' , file => $filename , xml => $xml , format => $format , %args)" This method ingest an object into Fedora Commons. Required is the \f(CW$pid\fR of the new object (which can be the string 'new' when Fedora has to generate a new pid), and the \f(CW$filename\fR or \f(CW$xml\fR to upload written as \f(CW$format\fR. Optionally the following parameters can be provided: label, encoding, namespace, ownerId, logMessage. See: https://wiki.duraspace.org/display/FEDORA36/REST+API for more information. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::ingest model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->ingest(pid => \*(Aqnew\*(Aq, file => \*(Aqt/obj_demo_40.zip\*(Aq, format => \*(Aqinfo:fedora/fedora\-system:ATOMZip\-1.1\*(Aq)\->parse_content; \& \& printf "created: %s\en" , $obj\->{pid}; .Ve .ie n .SS "modifyDatastream(pid => $pid , dsID => $dsID, url => $remote_location, %args)" .el .SS "modifyDatastream(pid => \f(CW$pid\fP , dsID => \f(CW$dsID\fP, url => \f(CW$remote_location\fP, \f(CW%args\fP)" .IX Subsection "modifyDatastream(pid => $pid , dsID => $dsID, url => $remote_location, %args)" .ie n .SS "modifyDatastream(pid => $pid , dsID => $dsID, file => $filename , %args)" .el .SS "modifyDatastream(pid => \f(CW$pid\fP , dsID => \f(CW$dsID\fP, file => \f(CW$filename\fP , \f(CW%args\fP)" .IX Subsection "modifyDatastream(pid => $pid , dsID => $dsID, file => $filename , %args)" .ie n .SS "modifyDatastream(pid => $pid , dsID => $dsID, xml => $xml , %args)" .el .SS "modifyDatastream(pid => \f(CW$pid\fP , dsID => \f(CW$dsID\fP, xml => \f(CW$xml\fP , \f(CW%args\fP)" .IX Subsection "modifyDatastream(pid => $pid , dsID => $dsID, xml => $xml , %args)" This method updated a data stream in the object. Required parameters are the object \f(CW$pid\fR, a new datastream \f(CW$dsID\fR and a remote \f(CW$url\fR, a local \f(CW$file\fR or an \f(CW$xml\fR string which contains the content. Optionally any of these datastream modifiers may be provided: controlGroup, altIDs, dsLabel, versionable, dsState, formatURI, checksumType, checksum, mimeType, logMessage. See: https://wiki.duraspace.org/display/FEDORA36/REST+API for more information. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::datastreamProfile model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->modifyDatastream(pid => \*(Aqdemo:29\*(Aq, dsID => \*(AqTEST\*(Aq , file => \*(AqREADME\*(Aq, mimeType => \*(Aqtext/plain\*(Aq)\->parse_content; \& \& print "Uploaded at: %s\en" , $obj\->{dateTime}; .Ve .ie n .SS "modifyObject(pid => $pid, label => $label , ownerId => ownerId , state => $state , logMessage => $logMessage , lastModifiedDate => $lastModifiedDate)" .el .SS "modifyObject(pid => \f(CW$pid\fP, label => \f(CW$label\fP , ownerId => ownerId , state => \f(CW$state\fP , logMessage => \f(CW$logMessage\fP , lastModifiedDate => \f(CW$lastModifiedDate\fP)" .IX Subsection "modifyObject(pid => $pid, label => $label , ownerId => ownerId , state => $state , logMessage => $logMessage , lastModifiedDate => $lastModifiedDate)" This method updated the metadata of an object. Required parameter is the \f(CW$pid\fR of the object. Optionally one or more of label, ownerId, state, logMessage and lastModifiedDate can be provided. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::modifyObject model. .PP .Vb 1 \& Example: \& \& $fedora\->modifyObject(pid => \*(Aqdemo:29\*(Aq , state => \*(AqI\*(Aq); .Ve .ie n .SS "purgeDatastream(pid => $pid , dsID => $dsID , startDT => $startDT , endDT => $endDT , logMessage => $logMessage)" .el .SS "purgeDatastream(pid => \f(CW$pid\fP , dsID => \f(CW$dsID\fP , startDT => \f(CW$startDT\fP , endDT => \f(CW$endDT\fP , logMessage => \f(CW$logMessage\fP)" .IX Subsection "purgeDatastream(pid => $pid , dsID => $dsID , startDT => $startDT , endDT => $endDT , logMessage => $logMessage)" This method purges a data stream from an object. Required parameters is the \f(CW$pid\fR of the object and the \f(CW$dsID\fR of the data stream. Optionally a range \f(CW$startDT\fR to \f(CW$endDT\fR versions can be provided to be deleted. See: https://wiki.duraspace.org/display/FEDORA36/REST+API for more information. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::purgeDatastream model. .PP .Vb 1 \& Example: \& \& $fedora\->purgeDatastream(pid => \*(Aqdemo:29\*(Aq, dsID => \*(AqTEST\*(Aq)\->parse_content; .Ve .ie n .SS "purgeObject(pid => $pid, logMessage => $logMessage)" .el .SS "purgeObject(pid => \f(CW$pid\fP, logMessage => \f(CW$logMessage\fP)" .IX Subsection "purgeObject(pid => $pid, logMessage => $logMessage)" This method purges an object from Fedora Commons. Required parameter is the \f(CW$pid\fR of the object. Optionally a \f(CW$logMessage\fR can be provided. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::purgeObject model. .PP .Vb 1 \& Example: \& \& $fedora\->purgeObject(pid => \*(Aqdemo:29\*(Aq); .Ve .ie n .SS "purgeRelationship(pid => $pid, relation => [ $subject, $predicate, $object] [, dataType => $dataType])" .el .SS "purgeRelationship(pid => \f(CW$pid\fP, relation => [ \f(CW$subject\fP, \f(CW$predicate\fP, \f(CW$object\fP] [, dataType => \f(CW$dataType\fP])" .IX Subsection "purgeRelationship(pid => $pid, relation => [ $subject, $predicate, $object] [, dataType => $dataType])" This method removes a triple from the RELS-EXT data stream of an object. Required parameters are the \f(CW$pid\fR of the object and the relation to be deleted. Optionally the \f(CW$dataType\fR of the literal can be provided. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::purgeRelationship model. .PP .Vb 1 \& Example: \& \& $fedora\->purgeRelationship(pid => \*(Aqdemo:29\*(Aq , relation => [ \*(Aqinfo:fedora/demo:29\*(Aq , \*(Aqhttp://my.org/name\*(Aq , \*(AqPeter\*(Aq]) .Ve .ie n .SS "setDatastreamState(pid => $pid, dsID => $dsID, dsState => $dsState)" .el .SS "setDatastreamState(pid => \f(CW$pid\fP, dsID => \f(CW$dsID\fP, dsState => \f(CW$dsState\fP)" .IX Subsection "setDatastreamState(pid => $pid, dsID => $dsID, dsState => $dsState)" This method can be used to put a data stream on/offline. Required parameters are the \f(CW$pid\fR of the object , the \&\f(CW$dsID\fR of the data stream and the required new \f(CW$dsState\fR ((A)ctive, (I)nactive, (D)eleted). This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::datastreamProfile model. .PP .Vb 1 \& Example: \& \& $fedora\->setDatastreamState(pid => \*(Aqdemo:29\*(Aq , dsID => \*(Aqurl\*(Aq , dsState => \*(AqI\*(Aq); .Ve .ie n .SS "setDatastreamVersionable(pid => $pid, dsID => $dsID, versionable => $versionable)" .el .SS "setDatastreamVersionable(pid => \f(CW$pid\fP, dsID => \f(CW$dsID\fP, versionable => \f(CW$versionable\fP)" .IX Subsection "setDatastreamVersionable(pid => $pid, dsID => $dsID, versionable => $versionable)" This method updates the versionable state of a data stream. Required parameters are the \f(CW$pid\fR of the object, the \f(CW$dsID\fR of the data stream and the new \f(CW$versionable\fR (true|false) state. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::datastreamProfile model. .PP .Vb 1 \& Example: \& \& $fedora\->setDatastreamVersionable(pid => \*(Aqdemo:29\*(Aq , dsID => \*(Aqurl\*(Aq , versionable => \*(Aqfalse\*(Aq); .Ve .ie n .SS "validate(pid => $pid)" .el .SS "validate(pid => \f(CW$pid\fP)" .IX Subsection "validate(pid => $pid)" This method can be used to validate the content of an object. Required parameter is the \f(CW$pid\fR of the object. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::validate model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->validate(pid => \*(Aqdemo:29\*(Aq)\->parse_content; \& \& print "Is valid: %s\en" , $obj\->{valid}; .Ve .ie n .SS "upload(file => $file)" .el .SS "upload(file => \f(CW$file\fP)" .IX Subsection "upload(file => $file)" This method uploads a file to the Fedora Server. Required parameter is the \f(CW$file\fR name. This method returns a Catmandu::FedoraCommons::Response object with a Catmandu::FedoraCommons::Model::upload\- model. .PP .Vb 1 \& Example: \& \& my $obj = $fedora\->upload(file => \*(Aqt/marc.xml\*(Aq)\->parse_content; \& \& print "Upload id: %s\en" , $obj\->{id}; .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Catmandu::FedoraCommons::Response, Catmandu::Model::findObjects, Catmandu::Model::getObjectHistory, Catmandu::Model::getObjectProfile, Catmandu::Model::listDatastreams, Catmandu::Model::listMethods .SH "AUTHOR" .IX Header "AUTHOR" .IP "\(bu" 4 Patrick Hochstenbach, \f(CW\*(C`\*(C'\fR .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" This program is free software; you can redistribute it and/or modify it under the terms of either: the \s-1GNU\s0 General Public License as published by the Free Software Foundation; or the Artistic License. .PP See for more information.