From 6e7fef1a1c47047b35942ee69f92ca6622717eba Mon Sep 17 00:00:00 2001 From: zPlus Date: Sat, 14 Dec 2024 11:27:59 +0100 Subject: [PATCH] Update Mimi&Eunice vocabulary. Mimi&Eunice vocabulary in the database has changed. Update queries and HTML templates with new vocabulary. --- app.py | 30 +++++++++++++---------- pages/mimi_and_eunice.html | 8 +++--- pages/templates/mimi_and_eunice/strip.tpl | 16 ++++++------ 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/app.py b/app.py index d8dc38a..71ade47 100755 --- a/app.py +++ b/app.py @@ -391,29 +391,33 @@ def mimi_and_eunice_strip(number): """ """ - iri = '' + iri = '' data = query(Template( ''' - PREFIX license: - PREFIX mimi_eunice: + prefix blob: + prefix license: + prefix comics: - DESCRIBE $iri ?license + DESCRIBE $iri ?license ?blob WHERE { - $iri mimi_eunice:license ?license + $iri comics:license ?license; + blob:at ?blob } ''').substitute(iri=iri), { '@context': { - 'license': 'dokk:license:', - 'mimi_eunice': 'dokk:mimi_and_eunice:', - 'mimi_eunice:tag': { '@container': '@set' }, - 'mimi_eunice:transcript': { '@container': '@set' } + 'blob': 'dokk:vocab:blob:', + 'license': 'dokk:vocab:license:', + 'comics': 'dokk:vocab:comicstrip:', + 'comics:tag': { '@container': '@set' }, + 'comics:transcript': { '@container': '@set' } + }, + 'comics:license': {}, + 'comics:transcript': { + 'comics:order': {} }, - 'mimi_eunice:license': {}, - 'mimi_eunice:transcript': { - 'mimi_eunice:order': {} - } + 'blob:at': {} }) return template('templates/mimi_and_eunice/strip.tpl', data=data['@graph'][0]) diff --git a/pages/mimi_and_eunice.html b/pages/mimi_and_eunice.html index d8c19b8..7d401ed 100644 --- a/pages/mimi_and_eunice.html +++ b/pages/mimi_and_eunice.html @@ -1,13 +1,13 @@ {% extends "templates/base.tpl" %} {% set data = query(""" - PREFIX mimi_eunice: - PREFIX xsd: + prefix comics: SELECT ?number ?title WHERE { - ?id mimi_eunice:title ?title . - BIND (SUBSTR(STR(?id), 22) as ?number) + [] comics:series ; + comics:number ?number; + comics:title ?title } ORDER BY ?number """) diff --git a/pages/templates/mimi_and_eunice/strip.tpl b/pages/templates/mimi_and_eunice/strip.tpl index ce8d9c9..02fd374 100644 --- a/pages/templates/mimi_and_eunice/strip.tpl +++ b/pages/templates/mimi_and_eunice/strip.tpl @@ -1,34 +1,34 @@ {% extends "templates/base.tpl" %} -{% block title %}Mimi&Eunice {{ data['@id'][12:] }}: {{ data['mimi_eunice:title'] }}{% endblock %} +{% block title %}Mimi&Eunice {{ data['comics:number'] }}: {{ data['comics:title'] }}{% endblock %} {% block body %}
-

{{ data['mimi_eunice:title'] }}

+

{{ data['comics:title'] }}

- Published: {{ data['mimi_eunice:published'] }} + Published: {{ data['comics:published'] }}

Liense: - {{ data['mimi_eunice:license']['license:id'] }} + {{ data['comics:license']['license:id'] }}

Tags: - {% for tag in data['mimi_eunice:tag']|sort %} + {% for tag in data['comics:tag']|sort %} {{ tag }} {% endfor %}

- +

Transcript - {% for line in data['mimi_eunice:transcript']|sort(attribute='mimi_eunice:order.@value') %} + {% for line in data['comics:transcript']|sort(attribute='comics:order.@value') %}

- {{ line['mimi_eunice:character'] }}: {{ line['mimi_eunice:text'] }} + {{ line['comics:character'] }}: {{ line['comics:text'] }}
{% endfor %}