Skip to content

Commit 782c782

Browse files
committed
#404 ensure uniqueness of xs:ID
1 parent acba85c commit 782c782

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

inst/actions/geometa_create_iso_19115.R

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ function(action, entity, config){
3535
}
3636
}
3737

38-
createResponsibleParty = function(x, role = NULL){
38+
createResponsibleParty = function(x, role = NULL, roleId = NULL){
3939
if(is.null(role)) role <- x$role
40+
if(is.null(roleId)) roleId = role
4041
rp <- ISOResponsibleParty$new()
4142
if(is.null(x$firstName)) x$firstName = NA
4243
if(is.null(x$lastName)) x$lastName = NA
@@ -80,7 +81,7 @@ function(action, entity, config){
8081
}
8182

8283
if(include_object_identification_ids){
83-
rp_id = paste(role, tolower(x$email), sep = "_")
84+
rp_id = paste(roleId, tolower(x$email), sep = "_")
8485
rp$setAttr("id", create_object_identification_id("party", rp_id))
8586
}
8687
return(rp)
@@ -181,7 +182,7 @@ function(action, entity, config){
181182

182183
if(length(entity$contacts)>0)for(entity_contact in entity$contacts){
183184
if(tolower(entity_contact$role) == "metadata"){
184-
rp<-createResponsibleParty(entity_contact,"pointOfContact")
185+
rp<-createResponsibleParty(entity_contact,role = "pointOfContact", roleId = "metadata")
185186
md$addContact(rp)
186187
}
187188
}
@@ -278,7 +279,7 @@ function(action, entity, config){
278279
#adding contacts
279280
if(length(entity$contacts)>0)for(entity_contact in entity$contacts){
280281
if(tolower(entity_contact$role) != "metadata" && !startsWith(entity_contact$role, "processor")){
281-
rp<-createResponsibleParty(entity_contact)
282+
rp<-createResponsibleParty(entity_contact, roleId = "pointOfContact")
282283
ident$addPointOfContact(rp)
283284
}
284285
}
@@ -335,7 +336,7 @@ function(action, entity, config){
335336
owners <- entity$contacts[sapply(entity$contacts, function(x){x$role == "owner"})]
336337
if(length(owners)==0) owners <- list(entity$contacts[[1]])
337338
for(owner_entity in owners){
338-
rp<-createResponsibleParty(owner_entity)
339+
rp<-createResponsibleParty(owner_entity, roleId = "owner")
339340
ct$citedResponsibleParty <- c(ct$citedResponsibleParty, rp)
340341
}
341342
}
@@ -786,7 +787,7 @@ function(action, entity, config){
786787
if(length(distributors)==0) distributors <- list(entity$contacts[[1]])
787788
for(distributor_entity in distributors){
788789
dist_ent = ISODistributor$new()
789-
dist_rp<-createResponsibleParty(distributor_entity)
790+
dist_rp<-createResponsibleParty(distributor_entity, roleId = "distributor")
790791
dist_ent$setContact(dist_rp)
791792
distrib$addDistributor(dist_ent)
792793
}
@@ -894,7 +895,7 @@ function(action, entity, config){
894895

895896
#processor as responsability party
896897
for(processor in process$processors){
897-
rpp<-createResponsibleParty(processor)
898+
rpp<-createResponsibleParty(processor, roleId = "processor")
898899
processStep$addProcessor(rpp)
899900
}
900901
lineage$addProcessStep(processStep)

0 commit comments

Comments
 (0)