Skip to content

Commit

Permalink
Fix the rdf generation
Browse files Browse the repository at this point in the history
  • Loading branch information
melmothx committed Aug 27, 2023
1 parent 5985bfa commit 850f9c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/AmuseWikiFarm/Archive/OAI/ORE.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ sub as_rdf_xml {
my $created = $text->pubdate->iso8601 . 'Z';
my $updated = $text->f_timestamp->iso8601 . 'Z';
my @dc;
if (my $oai_pmh_record = $text->oai_pmh_record) {
if (my $oai_pmh_record = $text->oai_pmh_records->not_deleted->first) {
@dc = @{ $oai_pmh_record->dublin_core_record || [] };
}

my $data = [
'rdf:RDF' => [
'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ,
Expand All @@ -50,9 +49,11 @@ 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 ],
[
@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 ],
]
],
]
];
Expand Down
6 changes: 6 additions & 0 deletions lib/AmuseWikiFarm/Schema/ResultSet/OaiPmhRecord.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ sub oldest_record {
})->first;
}

sub not_deleted {
my $self = shift;
my $me = $self->current_source_alias;
$self->search({ "$me.deleted" => 0 });
}

sub set_deleted_flag_on_obsolete_records {
my ($self, $ids) = @_;
die "Missing ids" unless $ids && ref($ids) eq 'ARRAY';
Expand Down
1 change: 1 addition & 0 deletions lib/AmuseWikiFarm/Utils/XML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package AmuseWikiFarm::Utils::XML;
use utf8;
use strict;
use warnings;
use Data::Dumper::Concise;

=head1 SYNOPSIS
Expand Down

0 comments on commit 850f9c2

Please sign in to comment.