From a32ed7270a41f1026cae959bc0f7588f9962a04d Mon Sep 17 00:00:00 2001 From: daxid <david.rouquet@tetras-libre.fr> Date: Sat, 11 Jan 2025 11:22:26 +0100 Subject: [PATCH] generate json with surveyjs_json in ttl --- tetras_extraction/script/templates/activite.rq | 1 + tetras_extraction/script/templates/json_in_ttl.rq | 3 +++ tetras_extraction/script/templates/quiz.rq | 1 + 3 files changed, 5 insertions(+) diff --git a/tetras_extraction/script/templates/activite.rq b/tetras_extraction/script/templates/activite.rq index 440a438..5c430b7 100644 --- a/tetras_extraction/script/templates/activite.rq +++ b/tetras_extraction/script/templates/activite.rq @@ -18,6 +18,7 @@ template mt:activite(?act) { # Insert a Hugo shortcode to load the quiz if this is a quiz activity if (exists { ?act a :Exercice }, "\n{{< quiz >}}", "") st:call-template(mt:quiz, ?act) + st:call-template(mt:json_in_ttl, ?act) } where { ?act a :Activite . diff --git a/tetras_extraction/script/templates/json_in_ttl.rq b/tetras_extraction/script/templates/json_in_ttl.rq index e4eb26b..0ee874e 100644 --- a/tetras_extraction/script/templates/json_in_ttl.rq +++ b/tetras_extraction/script/templates/json_in_ttl.rq @@ -4,7 +4,10 @@ PREFIX st: <http://ns.inria.fr/sparql-template/> # Template for the JSON definition of QCU activities template mt:json_in_ttl(?quiz) { + st:nl() + mt:start_marker(?quiz) "/quiz.json" st:nl() ?json + st:nl() } where { ?quiz :surveyjs_json ?json diff --git a/tetras_extraction/script/templates/quiz.rq b/tetras_extraction/script/templates/quiz.rq index a23845b..2fd1298 100644 --- a/tetras_extraction/script/templates/quiz.rq +++ b/tetras_extraction/script/templates/quiz.rq @@ -45,6 +45,7 @@ where { optional { ?quiz :commentaireSugg_md ?incorrect_comment . } + FILTER(NOT EXISTS{?quiz :surveyjs_json ?json}) } # FIXME: some exercises have multiple incorrect comments, almost identical, # which creates multiple matches for the WHERE clause and thus duplicate files. -- GitLab