Commit 67ee0bbb1160605e027feefc741fb7461b8f278a
1 parent
e02f00fd
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
virtuoso: fix dspace harvest
Showing
2 changed files
with
11 additions
and
3 deletions
Show diff stats
plugins/virtuoso/lib/virtuoso_plugin/dspace_harvest.rb
... | ... | @@ -22,12 +22,13 @@ class VirtuosoPlugin::DspaceHarvest |
22 | 22 | |
23 | 23 | def triplify(record) |
24 | 24 | metadata = VirtuosoPlugin::DublinCoreMetadata.new(record.metadata) |
25 | - puts "triplify #{record.header.identifier}" | |
25 | + subject_identifier = extract_identifier(record) | |
26 | + puts "triplify #{subject_identifier}" | |
26 | 27 | |
27 | 28 | settings.ontology_mapping.each do |mapping| |
28 | 29 | values = [metadata.extract_field(mapping[:source])].flatten.compact |
29 | 30 | values.each do |value| |
30 | - query = RDF::Virtuoso::Query.insert_data([RDF::URI.new(metadata.identifier), RDF::URI.new(mapping[:target]), value]).graph(RDF::URI.new(@dspace_uri)) | |
31 | + query = RDF::Virtuoso::Query.insert_data([RDF::URI.new(subject_identifier), RDF::URI.new(mapping[:target]), value]).graph(RDF::URI.new(@dspace_uri)) | |
31 | 32 | plugin.virtuoso_client.insert(query) |
32 | 33 | end |
33 | 34 | end |
... | ... | @@ -85,4 +86,11 @@ class VirtuosoPlugin::DspaceHarvest |
85 | 86 | end |
86 | 87 | end |
87 | 88 | |
89 | + protected | |
90 | + | |
91 | + def extract_identifier(record) | |
92 | + parsed_identifier = /oai:(.+):(\d+\/\d+)/.match(record.header.identifier) | |
93 | + "#{@dspace_uri}/handle/#{parsed_identifier[2]}" | |
94 | + end | |
95 | + | |
88 | 96 | end | ... | ... |
plugins/virtuoso/lib/virtuoso_plugin/dublin_core_metadata.rb