@@ -284,10 +284,34 @@ export class ShaclQuizFormNode extends Node {
284284
285285 let createIndividualsOfClass = row . class
286286
287- let input = document . createElement ( "input" )
288- input . type = "text"
289- input . style = "margin-right: 10px"
290- container . appendChild ( input )
287+ query = `
288+ PREFIX ff: <https://foerderfunke.org/default#>
289+ PREFIX sh: <http://www.w3.org/ns/shacl#>
290+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
291+ SELECT * WHERE {
292+ ?propertyShape sh:path <${ datafield } > ;
293+ sh:in/rdf:rest*/rdf:first ?option .
294+ ?option ff:title ?label .
295+ }`
296+ rows = await runSparqlSelectQueryOnStore ( query , datafieldsStore )
297+
298+ let input
299+ if ( rows . length === 0 ) {
300+ input = document . createElement ( "input" )
301+ input . type = "text"
302+ input . style . marginRight = "10px"
303+ container . appendChild ( input )
304+ } else {
305+ input = document . createElement ( "select" )
306+ input . style . marginRight = "10px"
307+ container . appendChild ( input )
308+ for ( let row of rows ) {
309+ let option = document . createElement ( "option" )
310+ option . value = row . option
311+ option . textContent = row . label
312+ input . appendChild ( option )
313+ }
314+ }
291315
292316 let submitBtn = document . createElement ( "input" )
293317 submitBtn . type = "button"
0 commit comments