Skip to content

Commit

Permalink
Implement ORE aggregation
Browse files Browse the repository at this point in the history
Overall impression is that this is not helping much, but here we go.

Close #440
  • Loading branch information
melmothx committed Sep 7, 2023
1 parent 6310792 commit 3c689d2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
36 changes: 28 additions & 8 deletions lib/AmuseWikiFarm/Archive/OAI/ORE.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,33 @@ sub as_rdf_xml {
my $site = $text->site;
my $created = $text->pubdate->iso8601 . 'Z';
my $updated = $text->f_timestamp->iso8601 . 'Z';
my @dc;
if (my $oai_pmh_record = $text->oai_pmh_records->not_deleted->first) {
@dc = @{ $oai_pmh_record->dublin_core_record || [] };
my $full_uri = $text->full_uri;
my @canonical_dc;
my @aggregated_dcs;
my @aggregated_urls;
foreach my $pmh ($text->oai_pmh_records->not_deleted->all) {
if (my @dc = @{ $pmh->dublin_core_record || [] }) {
my $datestamp = $pmh->zulu_datestamp;
push @dc, [
'dcterms:created',
[ 'rdf:datatype' => "http://www.w3.org/2001/XMLSchema#dateTime" ],
$datestamp,
];
push @dc, [
'dcterms:modified',
[ 'rdf:datatype' => "http://www.w3.org/2001/XMLSchema#dateTime" ],
$datestamp,
];
if ($pmh->identifier eq $full_uri) {
@canonical_dc = @dc;
}
push @aggregated_dcs,
[ 'rdf:Description' => [ 'rdf:about', $self->uri_maker->($pmh->identifier) ], \@dc ];
push @aggregated_urls,
[ 'ore:aggregates' => [ 'rdf:resource', $self->uri_maker->($pmh->identifier) ], undef ];
}
}
push @canonical_dc, @aggregated_urls;
my $data = [
'rdf:RDF' => [
'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ,
Expand All @@ -49,12 +72,9 @@ sub as_rdf_xml {
],

[ 'rdf:Description' => [ 'rdf:about', $self->uri_maker->($text->full_ore_aggregation_uri) ],
[
@dc,
[ 'dcterms:created' => [ 'rdf:datatype' => "http://www.w3.org/2001/XMLSchema#dateTime" ], $created ],
[ 'dcterms:modified' => [ 'rdf:datatype' => "http://www.w3.org/2001/XMLSchema#dateTime" ], $updated ],
]
\@canonical_dc,
],
@aggregated_dcs,
]
];
my $w = XML::Writer->new(OUTPUT => "self",
Expand Down
7 changes: 1 addition & 6 deletions t/oai-ore.t
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ binmode STDOUT, ":encoding(UTF-8)";
my $schema = AmuseWikiFarm::Schema->connect('amuse');
my $site_id = '0ore0';

my $site = $schema->resultset('Site')->find($site_id);

unless ($site) {
$site = create_site($schema, $site_id);
my $site = create_site($schema, $site_id);
$site->update({ pdf => 1, a4_pdf => 1 });
$site->check_and_update_custom_formats;

Expand Down Expand Up @@ -108,8 +105,6 @@ if (my $att = $site->attachments->find({ uri => 't-t-1.png' })) {
);
}

}

my $mech = Test::WWW::Mechanize::Catalyst->new(catalyst_app => 'AmuseWikiFarm',
host => $site->canonical);

Expand Down

0 comments on commit 3c689d2

Please sign in to comment.