Skip to content
Snippets Groups Projects
Commit 6d50750d authored by Eliott Sammier's avatar Eliott Sammier
Browse files

Add STTL templates from prototype

parent 10a5a23e
No related branches found
No related tags found
No related merge requests found
PREFIX : <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/>
PREFIX testtl: <http://www.semanticweb.org/eliott/test/>
PREFIX st: <http://ns.inria.fr/sparql-template/>
template testtl:array(?qcu) {
format { '"%s"' ?html }
}
where {
?qcu :aReponse ?choice .
?choice :html ?html
}
PREFIX : <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/>
PREFIX testtl: <http://www.semanticweb.org/eliott/test/>
PREFIX st: <http://ns.inria.fr/sparql-template/>
template st:profile {}
where {}
function st:process(?x) {
# Format literals as text without quotes
if (isLiteral(?x), st:format("%s", ?x), st:turtle(?x))
}
function testtl:sep() {
st:format(",%s", st:nl())
}
\ No newline at end of file
PREFIX : <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/>
PREFIX testtl: <http://www.semanticweb.org/eliott/test/>
PREFIX st: <http://ns.inria.fr/sparql-template/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
template {
?id " -> " ?title
}
where {
?subj a :ExerciceQC_QCU .
?subj :id ?id
optional {
?subj :titre ?title .
}
}
PREFIX : <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/>
PREFIX testtl: <http://www.semanticweb.org/eliott/test/>
PREFIX st: <http://ns.inria.fr/sparql-template/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
template {
"####### "
?id
format {
"""
+++
title = "%s"
+++
%s
"""
?title
?desc
}
"-------------------------------------------------------------------------"
st:call-template(testtl:quiz, ?subj)
}
where {
?subj a :Page .
?subj :id ?id .
?subj :titre ?title .
?subj :description ?desc
}
PREFIX : <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/>
PREFIX mt: <http://www.semanticweb.org/eliott/test/>
PREFIX st: <http://ns.inria.fr/sparql-template/>
template mt:qcu(?qcu) {
'"name": "' ?id '"' mt:sep()
'"type": "radiogroup"' mt:sep()
'"choices": ['
# box { st:call-template(mt:qcu_choices, ?qcu) }
box {
group {
'"' ?html '"'
; separator=mt:sep()
}
}
']' mt:sep()
'"correctAnswer": "' ?correct_choice '"'
}
where {
# ?qcu a :ExerciceQC_QCU
?qcu :id ?id .
optional {
?qcu :aReponse ?cchoice .
?cchoice :correct true
?cchoice :text ?correct_choice .
?qcu :aReponse ?choice .
?choice :text ?html
}
}
PREFIX : <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/>
PREFIX mt: <http://www.semanticweb.org/eliott/test/>
PREFIX st: <http://ns.inria.fr/sparql-template/>
template mt:qcu_choices(?qcu) {
group {
'"' ?html '"'
; separator=mt:sep()
}
}
where {
?qcu :aReponse ?choice .
?choice :text ?html
}
PREFIX : <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/>
PREFIX testtl: <http://www.semanticweb.org/eliott/test/>
PREFIX st: <http://ns.inria.fr/sparql-template/>
template testtl:quiz(?quiz) {
st:nl()
'{'
box {
'"elements": ['
box {
st:call-template(testtl:qcu, ?quiz)
}
']'
}
'}'
# format {
# """
# {
# "elements": [
# %s
# ]
# }
# """
# box { st:call-template(testtl:qcu, ?quiz) }
# }
}
where {
?quiz :id ?id .
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment