Author | zPlus <zplus@peers.community> 2024-12-14 13:01:38 |
Committer | zPlus <zplus@peers.community> 2024-12-14 13:01:38 |
Commit | bb0728c (patch) |
Tree | 98fcca8 |
Parent(s) |
-rwxr-xr-x | app.py | 28 | ||
-rw-r--r-- | pages/library.html | 4 | ||
-rw-r--r-- | pages/templates/library/item.tpl | 18 |
index 71ade47..ed12e32 | |||
old size: 12K - new size: 12K | |||
@@ -106,8 +106,7 @@ def library(): | |||
106 | 106 | ||
107 | 107 | # Get a list of authors for searching | |
108 | 108 | authors = query(""" | |
109 | - | PREFIX library: <dokk:library:> | |
110 | - | PREFIX license: <dokk:license:> | |
109 | + | PREFIX library: <dokk:vocab:library:> | |
111 | 110 | ||
112 | 111 | SELECT DISTINCT ?name | |
113 | 112 | WHERE { | |
@@ -118,14 +117,15 @@ def library(): | |||
118 | 117 | ||
119 | 118 | # Get a list of licenses for searching | |
120 | 119 | licenses = query(""" | |
121 | - | PREFIX library: <dokk:library:> | |
122 | - | PREFIX license: <dokk:license:> | |
120 | + | PREFIX library: <dokk:vocab:library:> | |
121 | + | PREFIX license: <dokk:vocab:license:> | |
123 | 122 | ||
124 | 123 | SELECT DISTINCT ?id | |
125 | 124 | WHERE { | |
126 | - | [] library:license [ | |
127 | - | license:id ?id | |
128 | - | ] . | |
125 | + | [] a library:Item; | |
126 | + | license:licensed_under [ | |
127 | + | license:id ?id | |
128 | + | ] | |
129 | 129 | } | |
130 | 130 | ORDER BY ?id | |
131 | 131 | """)['results']['bindings'] | |
@@ -147,20 +147,20 @@ def library(): | |||
147 | 147 | query_filters += f'FILTER(?license_id IN ({query_filters_license}))' | |
148 | 148 | ||
149 | 149 | items = query(f""" | |
150 | - | PREFIX library: <dokk:library:> | |
151 | - | PREFIX license: <dokk:license:> | |
150 | + | PREFIX library: <dokk:vocab:library:> | |
151 | + | PREFIX license: <dokk:vocab:license:> | |
152 | 152 | ||
153 | 153 | CONSTRUCT {{ | |
154 | 154 | ?item library:title ?title; | |
155 | 155 | library:author ?author ; | |
156 | - | library:license ?license . | |
156 | + | license:licensed_under ?license . | |
157 | 157 | ?license license:id ?license_id ; | |
158 | 158 | license:name ?license_name . | |
159 | 159 | }} | |
160 | 160 | WHERE {{ | |
161 | 161 | ?item library:title ?title ; | |
162 | 162 | library:author ?author ; | |
163 | - | library:license ?license . | |
163 | + | license:licensed_under ?license . | |
164 | 164 | ||
165 | 165 | OPTIONAL {{ | |
166 | 166 | ?license license:id ?license_id_optional ; | |
@@ -176,10 +176,10 @@ def library(): | |||
176 | 176 | """, | |
177 | 177 | { | |
178 | 178 | '@context': { | |
179 | - | 'library': 'dokk:library:', | |
180 | - | 'license': 'dokk:license:', | |
179 | + | 'library': 'dokk:vocab:library:', | |
180 | + | 'license': 'dokk:vocab:license:', | |
181 | 181 | 'library:author': { '@container': '@set' }, | |
182 | - | 'library:license': { '@container': '@set' } | |
182 | + | 'license:licensed_under': { '@container': '@set' } | |
183 | 183 | }, | |
184 | 184 | 'library:title': {} | |
185 | 185 | }) |
index 4e8db50..60ee007 | |||
old size: 2K - new size: 2K | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | {% for item in items["@graph"]|sort(attribute="library:title") %} | |
39 | 39 | <p> | |
40 | 40 | <div> | |
41 | - | <a href="/library/{{ item['@id'][8:] }}">{{ item['library:title'] }}</a> | |
41 | + | <a href="/library/{{ item['@id'][5:] }}">{{ item['library:title'] }}</a> | |
42 | 42 | </div> | |
43 | 43 | ||
44 | 44 | <div> | |
@@ -50,7 +50,7 @@ | |||
50 | 50 | ||
51 | 51 | <div> | |
52 | 52 | License: | |
53 | - | {% for license in item["library:license"]|sort(attribute="license:id") %} | |
53 | + | {% for license in item["license:licensed_under"]|sort(attribute="license:id") %} | |
54 | 54 | {{ license['license:id'] }} | |
55 | 55 | {% endfor%} | |
56 | 56 | </div> |
index 5430ab9..7337c3f | |||
old size: 2K - new size: 2K | |||
@@ -1,13 +1,13 @@ | |||
1 | 1 | {% extends "templates/base.tpl" %} | |
2 | 2 | ||
3 | 3 | {% set data = query(""" | |
4 | - | PREFIX library: <dokk:library:> | |
5 | - | PREFIX license: <dokk:license:> | |
4 | + | PREFIX library: <dokk:vocab:library:> | |
5 | + | PREFIX license: <dokk:vocab:license:> | |
6 | 6 | ||
7 | 7 | CONSTRUCT { | |
8 | 8 | ?item library:title ?title ; | |
9 | 9 | library:author ?author ; | |
10 | - | library:license ?license . | |
10 | + | license:licensed_under ?license . | |
11 | 11 | ||
12 | 12 | ?license license:id ?license_id ; | |
13 | 13 | license:name ?license_name . | |
@@ -16,9 +16,9 @@ | |||
16 | 16 | ?item | |
17 | 17 | library:title ?title ; | |
18 | 18 | library:author ?author ; | |
19 | - | library:license ?license . | |
19 | + | license:licensed_under ?license . | |
20 | 20 | ||
21 | - | FILTER (?item = <dokk:library:""" + item_id + """>) | |
21 | + | FILTER (?item = <dokk:""" + item_id + """>) | |
22 | 22 | ||
23 | 23 | OPTIONAL { | |
24 | 24 | ?license license:id ?license_id_optional ; | |
@@ -31,10 +31,10 @@ | |||
31 | 31 | """, | |
32 | 32 | { | |
33 | 33 | "@context": { | |
34 | - | "library": "dokk:library:", | |
35 | - | "license": "dokk:license:", | |
34 | + | "library": "dokk:vocab:library:", | |
35 | + | "license": "dokk:vocab:license:", | |
36 | 36 | "library:author": { "@container": "@set" }, | |
37 | - | "library:license": { "@container": "@set" } | |
37 | + | "license:licensed_under": { "@container": "@set" } | |
38 | 38 | }, | |
39 | 39 | "library:title": {} | |
40 | 40 | } | |
@@ -64,7 +64,7 @@ | |||
64 | 64 | ||
65 | 65 | <p> | |
66 | 66 | <b>License</b> | |
67 | - | {% for license in data["library:license"]|sort(attribute="license:id") %} | |
67 | + | {% for license in data["license:licensed_under"]|sort(attribute="license:id") %} | |
68 | 68 | <a href="{{ url('license', id=license['license:id']) }}">{{ license['license:id'] }}</a> | |
69 | 69 | {% endfor%} | |
70 | 70 | </p> |