Skip to content

Commit 115c09f

Browse files
committed
#401 fix get_concepts_hierarchy
1 parent 1054197 commit 115c09f

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

R/geoflow_utils.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ build_hierarchical_list <- function(data, parent, parent_key, child_key) {
935935
return(NULL)
936936
} else {
937937
nested_list <- lapply(1:nrow(children), function(i) {
938-
build_vocabulary_hierarchical_list(data, children[i, child_key])
938+
build_hierarchical_list(data, children[i, child_key], parent_key, child_key)
939939
})
940940
names(nested_list) <- children[,child_key]
941941
return(nested_list)

R/geoflow_vocabulary.R

+8-3
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ geoflow_skos_vocabulary <- R6Class("geoflow_skos_vocabulary",
142142
#'@description list_concepts
143143
#'@param lang lang
144144
#'@param mimetype mimetype
145-
#'@param out_format output format (data.frame or list). Default is "data.frame"
145+
#'@param out_format output format (tibble or list). Default is "tibble"
146146
#'@return the response of the SPARQL query
147147
get_concepts_hierarchy = function(lang = "en", mimetype = "text/csv",
148-
out_format = c("data.frame","list")){
148+
out_format = c("tibble","list")){
149149
out_format = match.arg(out_format)
150150
str = paste0("
151151
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
@@ -168,7 +168,12 @@ geoflow_skos_vocabulary <- R6Class("geoflow_skos_vocabulary",
168168
")
169169
out = self$query(str = str, mimetype = mimetype)
170170
if(out_format == "list"){
171-
out = build_hierarchical_list(out, parent = "root", parent_key = "broaderPrefLabel", child_key = "prefLabel")
171+
out = build_hierarchical_list(
172+
as.data.frame(out),
173+
parent = "root",
174+
parent_key = "broaderPrefLabel",
175+
child_key = "prefLabel"
176+
)
172177
}
173178
return(out)
174179
},

man/geoflow_skos_vocabulary.Rd

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)