Skip to content
Snippets Groups Projects
Select Git revision
  • 54805aa640af410d883e3bc8df0a1283a3ef4fa1
  • annotation-on-video default protected
  • demo_ci
  • 3-upstream-01022023
  • master
  • gh3538-captions
  • 16-adapt-for-images-annot
  • 15-api-for-annotations-on-video
  • 15-annotations-on-videos
  • video_for_annotations
  • wip-1-annotations-on-videos
  • 9-videoviewer-tests
  • 9_wip_videotests
  • 6-fix-tests-and-ci
  • _fix_ci
  • wip-webpack-from-git
16 results

setupJest.js

Blame
  • quiz.rq 1.61 KiB
    PREFIX : <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/>
    PREFIX mt: <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/template/>
    PREFIX st: <http://ns.inria.fr/sparql-template/>
    
    template mt:quiz(?quiz) {
        st:nl()
        mt:start_marker(?quiz) "/quiz.json" st:nl()
        '{'
        box {
            '"elements": ['
            box {
                "{"
                box {
                    st:call-template(mt:qcu, ?quiz)
                    st:call-template(mt:qcm, ?quiz)
                    #st:call-template(mt:json_in_ttl, ?quiz)
                }
                "}"
            }
            ']'
        }
        # Optional correct/incorrect comments for the quiz.
        # Unfortunately, STTL doesn't have a concise syntax for blocks
        # that depend on a variable being bound, we have to use
        # SPARQL functions and st:format
        coalesce(st:format(
            '%s"correctComment": "%s"',
            mt:sep(),
            mt:json_escape(?correct_comment)
        ), "")
        coalesce(st:format(
            '%s"incorrectComment": "%s"',
            mt:sep(),
            mt:json_escape(?incorrect_comment)
        ), "")
        '}'
        st:nl()
    }
    where {
        ?quiz a :Exercice .
        ?quiz :id ?id .
        optional {
            ?quiz :commentaireSucces_md ?correct_comment .
        }
        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.
    # We'll have to deal with them at some point, but for now just filter the first
    # one arbitrarily to avoid messing with the output.
    LIMIT 1