Skip to content
Snippets Groups Projects
Select Git revision
  • 2aead4db1a6b3cc05ceac42fab9dd35c4f405396
  • master default protected
  • diag
  • version1.3-archivematica
  • version1.2-archivematica
  • version1.1-archivematica
  • version1.0-archivematica
  • version1.0-rosetta
8 results

TA.pm

Blame
  • search.pm 9.68 KiB
    package SLUB::LZA::TA::Command::search;
    use SLUB::LZA::TA -command;
    use v5.36;
    use SLUB::LZA::TA::Archivematica::Elasticsearch;
    use SLUB::LZA::TA::Archivematica::Elasticsearch::PrepareQuery;
    use SLUB::LZA::TA::Output;
    
    use Date::Calc qw(Date_to_Time);
    use namespace::autoclean -except => qr{SLUB::LZA::TA::.*};
    
    # VERSION
    
    # ABSTRACT: search IEs module for ta-tool
    
    sub abstract {return "searches Archival Information System (AIS)";}
    
    my $description=<<"DESCR";
    Searches an AIS for descriptive or source metadata on behalf of the Technical Analyst.
    Returns AIP id. Only the first 10 matches will be presented by default.
    
    Examples:
    
      * Which AIP has this dc identifier?
        '$0 search -d SLUB:LZA:Kitodo:kitodo:422766'
      * Which AIPs are public domain?
        '$0 search -s publicdomain'
      * Which AIPs are copyrighted?
        '$0 search -s copyrighted'
      * Which AIPs were created in 2021-05-31?
        '$0 search -c 2021-05-31'
      * Which AIPs with mkv-files are in archive?
        '$0 search --pronom-format fmt/569'
      * Which AIP has this dc identifier? Print the AIP id, lzaid of matching AIP
        as Rows of String Values (RSV)
        '$0 search -d SLUB:LZA:Kitodo:kitodo:422766 --with-lzaid --output-as-rsv'
      * Find all AIPs with missing LDP entries
        '$0 search --only-ldp\\
          --with-ldp-collection --with-ldp-funder --with-ldp-lender\\
          --with-ldp-project --output-as-csv --maxrecords=10000\\
          | grep "(^,,)|(,,)|(,\$)"'
    
    DESCR
    
    sub description {
        return "$description"
    }
    sub opt_spec {
        my @global_opts= SLUB::LZA::TA::common_global_opt_spec();
        my @local_opts = (
            [ 'output-format' => hidden => {
                one_of => [
                    [ 'output-as-csv|C' => 'prints output as Comma Separated Values (CSV)' ],
                    [ 'output-as-raw|R' => 'print raw hash output of elasticsearch response' ],
                    [ 'output-as-rsv|r' => 'prints output as Raw Strings Values (RSV) [default]' ],
                ],
            }
            ],
            [],
            [ 'aip|a=s' => 'search a specific AIP by given AIP id' ],
            [ 'datemode' => hidden => {
                one_of => [
                    [ 'creationdate|c=s' => 'search based on creation date in format "YYYY-MM-DD", ranges in format "YYYY-MM-DD...YYYY-MM-DD"' ],
                    #[ 'modificationdate|m=s' => 'search based on modificationdate string' ]
                ]
              }
            ],
            [ 'descriptive|d=s', 'search descriptive metadata (dc identifier)' ],
            [ 'lzaid|l=s', 'search a specific AIP by given LZA id' ],
            [ 'maxrecords=i', 'set maxrecords, default is 10', { default => 10 } ],
            #[ 'source|s=s', 'search source metadata' ],