Skip to content

Commit 656d806

Browse files
committed
vocab query full dataset to enable simple query from uri/term
1 parent d779d8a commit 656d806

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

R/geoflow_entity.R

+10-5
Original file line numberDiff line numberDiff line change
@@ -1954,15 +1954,20 @@ geoflow_entity <- R6Class("geoflow_entity",
19541954
#'@param config geoflow config object
19551955
enrichWithVocabularies = function(config){
19561956

1957+
vocabs = list_vocabularies(raw = T)
1958+
19571959
self$subjects = lapply(self$subjects, function(subject){
19581960

19591961
if(is.null(subject$uri)) return(subject)
19601962

19611963
#find vocabulary
1962-
vocabs = list_vocabularies(raw = T)
19631964
target_vocab = vocabs[sapply(vocabs, function(vocab){vocab$id == subject$uri})]
19641965
if(length(target_vocab)>0){
19651966
target_vocab = target_vocab[[1]]
1967+
if(!is.null(target_vocab$rdf)){
1968+
#in case of rdf file-based vocabs, we 1st query the full dataset
1969+
target_vocab$query_full_dataset()
1970+
}
19661971
subject$uri = target_vocab$uri #default uri
19671972
subject$keywords = lapply(subject$keywords, function(keyword){
19681973
rs = NULL
@@ -1980,10 +1985,10 @@ geoflow_entity <- R6Class("geoflow_entity",
19801985
attr(keyword$name, paste0("locale#",toupper(lang))) = rs[rs$lang == lang,]$prefLabel[1]
19811986
}
19821987
#overwrite subject uri/name if we find a collection (assuming keywords are from the same collection)
1983-
if(!is.na(rs[1L,]$collection)){
1984-
subject$uri <<- rs[1L,]$collection
1985-
subject$name <<- rs[1L,]$collectionLabel
1986-
}
1988+
# if(!is.na(rs[1L,]$collection)){
1989+
# subject$uri <<- rs[1L,]$collection
1990+
# subject$name <<- rs[1L,]$collectionLabel
1991+
# }
19871992
}
19881993
return(keyword)
19891994
})

0 commit comments

Comments
 (0)