Skip to content

Commit 067bdf1

Browse files
committed
#401 support list_concepts
1 parent 230fc51 commit 067bdf1

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

R/geoflow_vocabulary.R

+26
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ geoflow_skos_vocabulary <- R6Class("geoflow_skos_vocabulary",
106106

107107
#'@description list_collections
108108
#'@param mimetype mimetype
109+
#'@param count_sub_collections count_sub_collections. Default is TRUE
110+
#'@param count_concepts count_concepts. Default is TRUE
109111
#'@return the response of the SPARQL query
110112
list_collections = function(mimetype = "text/csv",
111113
count_sub_collections = TRUE,
@@ -137,6 +139,30 @@ geoflow_skos_vocabulary <- R6Class("geoflow_skos_vocabulary",
137139
return(out)
138140
},
139141

142+
#'@description list_concepts
143+
#'@param lang lang
144+
#'@return the response of the SPARQL query
145+
list_concepts = function(lang = "en"){
146+
str = paste0("
147+
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
148+
149+
SELECT ?collection ?collectionLabel ?concept ?prefLabel WHERE {
150+
?collection a skos:Collection .
151+
OPTIONAL { ?collection skos:prefLabel ?collectionLabel }
152+
153+
?collection skos:member ?concept .
154+
?concept a skos:Concept .
155+
?concept skos:prefLabel ?prefLabel .
156+
157+
FILTER (LANG(?prefLabel) = \"", lang, "\")
158+
}
159+
ORDER BY ?collection ?concept
160+
")
161+
out = self$query(str = str, graphUri = graphUri, mimetype = mimetype)
162+
out = out[with(out, order(collection, prefLabel)),]
163+
return(out)
164+
},
165+
140166
#'@description query_from_uri
141167
#'@param uri uri
142168
#'@param graphUri graphUri

man/geoflow_skos_vocabulary.Rd

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

0 commit comments

Comments
 (0)