diff --git a/tetras_extraction/script/src/extract_page.py b/tetras_extraction/script/src/extract_page.py index 685fcacd585302bd5c3c049c127d3a0094987e0a..88bd027b2ffed0a422ed86ffa9de05071b23e37d 100644 --- a/tetras_extraction/script/src/extract_page.py +++ b/tetras_extraction/script/src/extract_page.py @@ -227,7 +227,7 @@ class ExerciceQC(Exercice): def save(self, graph: Graph): super().save(graph) for choice in self.choices.values(): - rdf_name = f"{self.id}_{choice.id}" # ex: pg157_2, pg173_rep21 + rdf_name = f"{self.id}_{choice.index}_{choice.id}" # ex: pg157_2, pg173_rep21 display_name = rdf_name + " | " + ("V" if choice.is_correct else "F") choice_node = NS[rdf_name] graph.add((choice_node, RDF.type, NS["Reponse"])) diff --git a/tetras_extraction/script/templates/qcu.rq b/tetras_extraction/script/templates/qcu.rq index c6fa414eed84df23c779e1c89707608e937e8148..cdc12e72437020f23dec551576615dd1333a818a 100644 --- a/tetras_extraction/script/templates/qcu.rq +++ b/tetras_extraction/script/templates/qcu.rq @@ -26,16 +26,18 @@ template mt:qcu(?qcu) { '"correctAnswer": ' coalesce(?correct_choice_index, "-1") } where { - ?qcu a :ExerciceQC_QCU + ?qcu a :ExerciceQC_QCU . ?qcu :id ?id . - optional { + #optional { ?qcu :aReponse ?choice . ?choice :index ?choice_index . - ?choice :html_md ?choice_html - } - optional { + ?choice :html_md ?choice_html . + #} + #optional { ?qcu :aReponse ?correct_choice . ?correct_choice :correct true . ?correct_choice :index ?correct_choice_index . - } + #} } +ORDER BY ?choice_index +