View source: R/fix_relations.R
fix_relations | R Documentation |
The function will flatten the relations list to more non-nested lists with
with relation.-prefix and replace the UUIDs in the lists values with
the corresponding identifiers from the uidlist/index
(see get_field_index()
or get_uid_list()
) using
replace_uid()
to make the result more readable.
fix_relations(resource, replace_uids = TRUE, uidlist = NULL)
resource |
One element from a list of class |
replace_uids |
TRUE/FALSE. If TRUE, replaces the UUIDs in each relation with the corresponding identifiers. If FALSE, just flattens the list. Default is TRUE. |
uidlist |
Only needs to be provided if |
The same resource with its relations unnested (and replaced with
identifiers if replace_uids
is set to TRUE
).
This function is used by: simplify_idaifield()
.
## Not run:
index <- data.frame(
identifier = c("name1", "name2"),
UID = c("15754929-dd98-acfa-bfc2-016b4d5582fe",
"bf06c7b0-dba0-dcfa-6d8e-3b3509fee5b6")
)
resource <- list(relations = list(
isRecordedIn = list("15754929-dd98-acfa-bfc2-016b4d5582fe"),
liesWithin = list("bf06c7b0-dba0-dcfa-6d8e-3b3509fee5b6")
),
identifier = "res_1"
)
new_relations_list <- fix_relations(resource, replace_uids = TRUE, uidlist = index)
new_relations_list
new_relations_list <- fix_relations(resource, replace_uids = FALSE)
new_relations_list
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.