ID: 716b80390391347a619c3f0d58341567490ac760
69 lines
—
2K —
View raw
| {% extends "templates/base.tpl" %}
{% block title %}Library{% endblock %}
{% set data = query("""
PREFIX library: <dokk:library:>
PREFIX license: <dokk:license:>
CONSTRUCT {
?item library:title ?title;
library:author ?author ;
library:license ?license .
?license license:id ?license_id ;
license:name ?license_name .
}
WHERE {
?item library:title ?title ;
library:author ?author ;
library:license ?license .
OPTIONAL {
?license license:id ?license_id_optional ;
license:name ?license_name_optional .
}
BIND(COALESCE(?license_id_optional, SUBSTR(STR(?license), 14)) AS ?license_id)
BIND(COALESCE(?license_name_optional, SUBSTR(STR(?license), 14)) AS ?license_name)
}
ORDER BY UCASE(?title)
""",
{
'@context': {
'library': 'dokk:library:',
'license': 'dokk:license:',
'library:author': { '@container': '@set' },
'library:license': { '@container': '@set' }
},
'library:title': {}
})
%}
{% block body %}
<div class="library">
{% for item in data["@graph"]|sort(attribute="library:title") %}
<p>
<div>
<a href="/library/{{ item['@id'][8:] }}">{{ item['library:title'] }}</a>
</div>
<div>
Authors:
{% for author in item["library:author"]|sort() %}
{{ author }}
{% endfor%}
</div>
<div>
License:
{% for license in item["library:license"]|sort(attribute="license:id") %}
{{ license['license:id'] }}
{% endfor%}
</div>
</p>
<br/><br/>
{% endfor %}
</div>
{% endblock %}
|