Skip to content

Commit cf16071

Browse files
committed
#401 add INRAE thesaurus, + rdf/xml handler
1 parent f6b2867 commit cf16071

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

R/geoflow_utils.R

+8-4
Original file line numberDiff line numberDiff line change
@@ -931,13 +931,17 @@ create_object_identification_id = function(prefix, str){
931931
#'@param child_label child_label
932932
#'@return a list of relationships
933933
#'@export
934-
precompute_relationships <- function(data, parent_key, child_key, child_label) {
934+
precompute_relationships <- function (data, parent_key, child_key, child_label) {
935935
ordered_data <- data[order(data[[parent_key]], data[[child_key]]), ]
936936
relationships <- split(ordered_data[[child_key]], ordered_data[[parent_key]])
937937
rel_names = names(relationships)
938-
relationships <- lapply(relationships, function(x){
939-
lapply(x, function(x_el){ attr(x_el, "label") = data[data[,child_key] == x_el, child_label][1]; return(x_el) })
940-
})
938+
relationships <- lapply(relationships, function(x) {
939+
lapply(x, function(x_el) {
940+
attr(x_el, "label") = data[data[, child_key] == x_el,
941+
child_label][1]
942+
return(x_el)
943+
})
944+
})
941945
names(relationships) = rel_names
942946
return(relationships)
943947
}

R/geoflow_vocabulary.R

+8
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ geoflow_skos_vocabulary <- R6Class("geoflow_skos_vocabulary",
9797
self$rdf = rdflib::rdf_parse(file.path(tempdir(), trg_file))
9898
}
9999
)
100+
}else if(mime::guess_type(file) == "application/rdf+xml"){
101+
self$rdf = rdflib::rdf_parse(file)
100102
}
101103
}
102104
},
@@ -438,6 +440,12 @@ register_vocabularies = function(){
438440
uri = "https://www.eionet.europa.eu/gemet",
439441
file = "https://www.eionet.europa.eu/gemet/latest/gemet.rdf.gz"
440442
),
443+
geoflow_skos_vocabulary$new(
444+
id = "inrae",
445+
def = "INRAE Thesaurus",
446+
uri = "http://opendata.inrae.fr/thesaurusINRAE/thesaurusINRAE",
447+
file = "https://forgemia.inra.fr/dipso/thesaurus-inrae/-/raw/main/thesaurusINRAE_skos_2025_04_02_V2.3.rdf"
448+
),
441449
geoflow_skos_vocabulary$new(
442450
id = "agrovoc",
443451
def = "AGROVOC Thesaurus",

0 commit comments

Comments
 (0)