ID: ca6f78020f9fed2be8dde9f37bd7672e6c26eee1
76 lines
—
2K —
View raw
| <?xml version="1.0" encoding="UTF-8"?>
{% 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:type 'book' ;
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)
}
""",
{
'@context': {
'library': 'dokk:library:',
'license': 'dokk:license:',
'library:author': { '@container': '@set' },
'library:license': { '@container': '@set' }
},
'library:title': {}
})
%}
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:opds="http://opds-spec.org/2010/catalog">
<link rel="start" href="/library/opds.xml" type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
<link rel="self" href="/library/opds/books.xml" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
<id>urn:uuid:1ad42a21-f98f-44a9-b37a-7c4496ab661d</id>
<title>DOKK Library Books</title>
<updated>{{ now() }}</updated>
<author>
<name>DOKK</name>
<uri>https://dokk.org</uri>
</author>
{% for item in data["@graph"]|sort(attribute="library:title") %}
<entry>
<title>{{ item['library:title'] }}</title>
{% for author in item["library:author"]|sort() %}
<author>
<name>{{ author }}</name>
</author>
{% endfor%}
{% for license in item["library:license"]|sort(attribute="license:id") %}
<rights>{{ license['license:id'] }}</rights>
{% endfor%}
<updated></updated>
<dc:language></dc:language>
<dc:identifier></dc:identifier>
<link rel="http://opds-spec.org/acquisition" href="https://blob.dokk.org/pdf/{{ item['@id'][8:] }}.pdf" type="application/pdf" />
</entry>
{% endfor %}
</feed>
|