Skip to content

Commit d600334

Browse files
committed
support #404
1 parent 74e25ac commit d600334

7 files changed

+47
-8
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Imports:
4343
curl,
4444
whisker,
4545
mime,
46+
digest,
4647
plyr,
4748
readr,
4849
zip,

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export(add_config_utils)
44
export(check_packages)
55
export(closeWorkflow)
66
export(create_geoflow_data_from_dbi)
7+
export(create_object_identification_id)
78
export(debugWorkflow)
89
export(describeOGCRelation)
910
export(enrich_text_from_entity)

R/geoflow_utils.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,4 +800,18 @@ describeOGCRelation <- function(entity, data_object, service, download = FALSE,
800800
}
801801
)
802802
return(out)
803+
}
804+
805+
#'@name create_object_identification_id
806+
#'@aliases create_object_identification_id
807+
#'@title create_object_identification_id
808+
#'
809+
#'@usage create_object_identification_id(str)
810+
#'
811+
#'@param prefix a character string
812+
#'@param str a character string
813+
#'@return a digested character string
814+
#'@export
815+
create_object_identification_id = function(prefix, str){
816+
paste(prefix, digest::digest(object = str, algo = "crc32", serialize = FALSE), sep = "_")
803817
}

inst/actions/geometa_create_iso_19110.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function(action, entity, config){
131131
ct <- ISOCitation$new()
132132
ct$setTitle(entity$titles[["title"]])
133133
if("alternative" %in% names(entity$titles)){
134-
ct$setAlternateTitle(entity$titles[["alternative"]])
134+
ct$addAlternateTitle(entity$titles[["alternative"]])
135135
}
136136
d <- ISODate$new()
137137
d$setDate(Sys.Date())

inst/actions/geometa_create_iso_19115.R

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function(action, entity, config){
2222
include_service_identification <- action$getOption("include_service_identification")
2323
include_coverage_data_dimension_values <- action$getOption("include_coverage_data_dimension_values")
2424
include_coverage_service_dimension_values <- action$getOption("include_coverage_service_dimension_values")
25-
include_online_resource_ids = action$getOption("include_online_resource_ids")
25+
include_object_identification_ids = action$getOption("include_object_identification_ids")
2626

2727
#check inspire metadata validator configuration
2828
INSPIRE_VALIDATOR <- NULL
@@ -70,6 +70,10 @@ function(action, entity, config){
7070
rp$parentAttrs[["xlink:href"]] <- paste0("https://orcid.org/", orcid)
7171
}
7272

73+
if(include_object_identification_ids){
74+
rp_id = paste(role, tolower(x$email), sep = "_")
75+
rp$setAttr("id", create_object_identification_id("party", rp_id))
76+
}
7377
return(rp)
7478
}
7579

@@ -267,7 +271,7 @@ function(action, entity, config){
267271
ct <- ISOCitation$new()
268272
ct$setTitle(entity$titles[["title"]], locales = geoflow::get_locales_from(entity$titles[["title"]]))
269273
if("alternative" %in% names(entity$titles)){
270-
ct$setAlternateTitle(entity$titles[["alternative"]])
274+
ct$addAlternateTitle(entity$titles[["alternative"]])
271275
}
272276
for(date in entity$dates){
273277
if(date$key != "edition"){
@@ -328,6 +332,8 @@ function(action, entity, config){
328332
fileName = thumbnail$link,
329333
fileDescription = thumbnail$name
330334
)
335+
thumbnail_id = paste(tolower(entity$identifiers[["id"]]), "thumbnail", tolower(thumbnail$link),sep="_")
336+
if(include_object_identification_ids) go$setAttr("id", create_object_identification_id("browsegraphic", thumbnail_id))
331337
ident$addGraphicOverview(go)
332338
}
333339
}
@@ -779,7 +785,7 @@ function(action, entity, config){
779785
doi_or$setName("DOI")
780786
doi_or$setDescription("Digital Object Identifier")
781787
doi_or$setProtocol("WWW:LINK-1.0-http--link")
782-
if(include_online_resource_ids) doi_or$setAttr("id", the_doi)
788+
if(include_object_identification_ids) doi_or$setAttr("id", create_object_identification_id("onlineresource", the_doi))
783789
dto$addOnlineResource(doi_or)
784790
}
785791

@@ -843,9 +849,9 @@ function(action, entity, config){
843849
)
844850
or$setProtocol(protocol)
845851

846-
if(include_online_resource_ids) if(any(sapply(c("wms", "wfs", "wcs","download"), function(x){startsWith(http_relation$key, x)}))) {
852+
if(include_object_identification_ids) if(any(sapply(c("wms", "wfs", "wcs","download"), function(x){startsWith(http_relation$key, x)}))) {
847853
resource_id = paste(tolower(entity$identifiers[["id"]]), http_relation$key, tolower(http_relation$name),sep="_")
848-
or$setAttr("id", resource_id)
854+
or$setAttr("id", create_object_identification_id("onlineresource", resource_id))
849855
}
850856

851857
dto$onLine = c(dto$onLine,or)

inst/actions/geometa_create_iso_19115.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ available_options:
7070
def: Include ogc dimensions's range values to coverage description
7171
class: logical
7272
default: false
73-
include_online_resource_ids:
74-
def: Include online resource IDs (Applies only to DOIs, OGC services and download resources)
73+
include_object_identification_ids:
74+
def: Include object identification IDs (Applies only to graphic overviews, DOIs, OGC services and download resources)
7575
class: logical
7676
default: false

man/create_object_identification_id.Rd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)