|
@ -46,21 +46,22 @@ def home(): |
|
|
''') |
|
|
''') |
|
|
sparql.setReturnFormat(JSON) |
|
|
sparql.setReturnFormat(JSON) |
|
|
results = sparql.query().convert() |
|
|
results = sparql.query().convert() |
|
|
return render_template('home.html') |
|
|
return render_template('home.html', results=results) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/browsethearchive") |
|
|
@app.route("/browsethearchive") |
|
|
def browsethearchive(): |
|
|
def browsethearchive(): |
|
|
sparql.setQuery(''' |
|
|
sparql.setQuery(''' |
|
|
SELECT ?work ?workLabel ?image ?date |
|
|
SELECT ?work ?workLabel ?image ?date WHERE { |
|
|
WHERE { |
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
|
?work wdt:P1 wd:Q1. |
|
|
?work wdt:P1 wd:Q1. |
|
|
OPTIONAL { ?work p:P30 ?statement. |
|
|
OPTIONAL { ?work wdt:P30 ?image. } |
|
|
?statement ps:P30 ?image; |
|
|
OPTIONAL { ?work wdt:P13 ?date. } |
|
|
pq:P54 wd:Q90.} |
|
|
FILTER(?work != wd:Q57) |
|
|
OPTIONAL { ?work wdt:P13 ?date. } |
|
|
} |
|
|
FILTER(?work != wd:Q57) |
|
|
ORDER BY (?workLabel) |
|
|
} |
|
|
|
|
|
ORDER BY (?workLabel) |
|
|
''') |
|
|
''') |
|
|
sparql.setReturnFormat(JSON) |
|
|
sparql.setReturnFormat(JSON) |
|
|
results = sparql.query().convert() |
|
|
results = sparql.query().convert() |
|
@ -80,118 +81,202 @@ def browsebycategory(): |
|
|
return render_template('browsebycategory.html') |
|
|
return render_template('browsebycategory.html') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
########################## |
|
|
|
|
|
# CATEGORIES TO BE BROWSED |
|
|
|
|
|
######################### |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######################### ARTIST INDEX |
|
|
######################### ARTIST INDEX |
|
|
@app.route("/artistsindex") |
|
|
@app.route("/artistsindex") |
|
|
def artistsindex(): |
|
|
def artistsindex(): |
|
|
sparql.setQuery(''' |
|
|
sparql.setQuery(''' |
|
|
SELECT ?creators ?creatorsLabel ?creatorsAltLabel ?creatorsDescription |
|
|
SELECT ?creators ?creatorsLabel ?creatorsAltLabel ?creatorsDescription |
|
|
WHERE { |
|
|
WHERE { |
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
|
{ |
|
|
?work wdt:P1 wd:Q1. |
|
|
SELECT ?creators (COUNT(DISTINCT ?a) AS ?count) WHERE { |
|
|
?work wdt:P9 ?creators. |
|
|
?a ?prop ?creators . |
|
|
FILTER (?creators != wd:Q82) |
|
|
?a wdt:P1 ?work . |
|
|
|
|
|
BIND (wdt:P9 AS ?prop) . |
|
|
|
|
|
BIND (wd:Q1 AS ?work) . |
|
|
|
|
|
} GROUP BY ?creators |
|
|
|
|
|
} . |
|
|
|
|
|
SERVICE wikibase:label { |
|
|
|
|
|
bd:serviceParam wikibase:language "en" . |
|
|
} |
|
|
} |
|
|
|
|
|
FILTER (?creators !=wd:Q82) |
|
|
|
|
|
} |
|
|
|
|
|
ORDER BY DESC(?count) ?creatorsLabel |
|
|
''') |
|
|
''') |
|
|
sparql.setReturnFormat(JSON) |
|
|
sparql.setReturnFormat(JSON) |
|
|
results = sparql.query().convert() |
|
|
results = sparql.query().convert() |
|
|
return render_template('artistsindex.html', results=results) |
|
|
return render_template('artistsindex.html', results=results) |
|
|
|
|
|
|
|
|
|
|
|
######################### PUBLISHERS INDEX |
|
|
|
|
|
@app.route("/publishersindex") |
|
|
|
|
|
def publishersindex(): |
|
|
|
|
|
sparql.setQuery(''' |
|
|
|
|
|
SELECT ?publishers ?publishersLabel ?publishersAltLabel ?publishersDescription WHERE { |
|
|
|
|
|
{ |
|
|
|
|
|
SELECT ?publishers (COUNT(DISTINCT ?a) AS ?count) WHERE { |
|
|
|
|
|
?a ?prop ?publishers . |
|
|
|
|
|
?a wdt:P1 ?work . |
|
|
|
|
|
BIND (wdt:P10 AS ?prop) . |
|
|
|
|
|
BIND (wd:Q1 AS ?work) . |
|
|
|
|
|
} GROUP BY ?publishers |
|
|
|
|
|
} . |
|
|
|
|
|
SERVICE wikibase:label { |
|
|
|
|
|
bd:serviceParam wikibase:language "en" . |
|
|
|
|
|
} |
|
|
|
|
|
FILTER(?publishers != wd:Q83) |
|
|
|
|
|
FILTER(?publishers != wd:Q71) |
|
|
|
|
|
} |
|
|
|
|
|
ORDER BY DESC(?count) ?publishersLabel |
|
|
|
|
|
''') |
|
|
|
|
|
sparql.setReturnFormat(JSON) |
|
|
|
|
|
results = sparql.query().convert() |
|
|
|
|
|
return render_template('publishersindex.html', results=results) |
|
|
|
|
|
|
|
|
|
|
|
######################### SELF PUBLISHED INDEX |
|
|
|
|
|
@app.route("/selfpublishedindex") |
|
|
|
|
|
def selfpublishedindex(): |
|
|
|
|
|
sparql.setQuery(''' |
|
|
|
|
|
SELECT ?work ?workLabel ?workAltLabel ?workDescription |
|
|
|
|
|
WHERE { |
|
|
|
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
|
|
|
|
?work wdt:P1 wd:Q1; |
|
|
|
|
|
wdt:P10 wd:Q71. |
|
|
|
|
|
FILTER(?work != wd:Q57) |
|
|
|
|
|
} |
|
|
|
|
|
''') |
|
|
|
|
|
sparql.setReturnFormat(JSON) |
|
|
|
|
|
results = sparql.query().convert() |
|
|
|
|
|
return render_template('selfpublishedindex.html', results=results) |
|
|
|
|
|
|
|
|
|
|
|
######################### ZINES INDEX |
|
|
|
|
|
@app.route("/zinesindex") |
|
|
|
|
|
def zinesindex(): |
|
|
|
|
|
sparql.setQuery(''' |
|
|
|
|
|
SELECT ?work ?workLabel ?workAltLabel ?workDescription |
|
|
|
|
|
WHERE { |
|
|
|
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
|
|
|
|
?work wdt:P1 wd:Q1; |
|
|
|
|
|
wdt:P16 wd:Q152. |
|
|
|
|
|
FILTER(?work != wd:Q57) |
|
|
|
|
|
} |
|
|
|
|
|
''') |
|
|
|
|
|
sparql.setReturnFormat(JSON) |
|
|
|
|
|
results = sparql.query().convert() |
|
|
|
|
|
return render_template('zinesindex.html', results=results) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
########################## |
|
|
|
|
|
# DETAILED INDIVIDUAL PAGES |
|
|
|
|
|
######################### |
|
|
|
|
|
|
|
|
######################### ARTWORK |
|
|
######################### ARTWORK |
|
|
@app.route("/artwork", methods=['GET']) |
|
|
@app.route("/artwork", methods=['GET']) |
|
|
def artwork(): |
|
|
def artwork(): |
|
|
artwork_id = request.args.get('id') |
|
|
artwork_id = request.args.get('id') |
|
|
|
|
|
|
|
|
# sparql.setQuery(''' |
|
|
sparql.setQuery(''' |
|
|
# SELECT ?workLabel ?workDescription |
|
|
SELECT ?workLabel ?workDescription |
|
|
# ?creators ?creatorsLabel ?creatorRoles ?creatorRolesLabel |
|
|
?creators ?creatorsLabel ?creatorRoles ?creatorRolesLabel |
|
|
# ?publishers ?publishersLabel ?publisherRoles ?publisherRolesLabel |
|
|
?publishers ?publishersLabel ?publisherRoles ?publisherRolesLabel |
|
|
# ?date ?dateType ?dateTypeLabel ?dateSource |
|
|
?date ?dateType ?dateTypeLabel ?dateSource |
|
|
# ?image ?depicts ?depictsLabel ?annotation ?license ?licenseLabel |
|
|
?image ?depics ?depicsLabel ?annotation ?license ?licenseLabel |
|
|
# ?descriptionPage ?accessURLdescriptionPage ?authordescriptionPage ?authordescriptionPageLabel ?datedescriptionPage ?sourcedescriptionPage |
|
|
?descriptionQID ?accessURLdescrip ?authordescrip ?authordescripLabel ?datedescrip |
|
|
# ?exhibitionHisPage ?accessURLexhibitionHisPage ?authorexhibitionHisPage ?authorexhibitionHisPageLabel ?dateexhibitionHisPage ?sourceexhibitionHisPage |
|
|
?exhibitionHistoryQID ?accessURLexhibitionHis ?authorexhibitionHis ?authorexhibitionHisLabel ?dateexhibitionHis |
|
|
# ?digitalFacsimile ?digitalFacsimileExternal |
|
|
?digitalFacsimile ?digitalFacsimileExternal |
|
|
# ?digitalArtefact ?format ?formatLabel |
|
|
?digitalArtefact ?format ?formatLabel |
|
|
# ?distributorLinks |
|
|
?distributorLinks |
|
|
# ?copiesCollections ?collections ?collectionsLabel ?imageCollections |
|
|
?copiesCollections ?collections ?collectionsLabel ?imageCollections |
|
|
# ?relatedWorks ?relatedWorksLabel ?daterelatedWorks |
|
|
?relatedWorks ?relatedWorksLabel ?dateRelatedWorks |
|
|
|
|
|
|
|
|
# WHERE { |
|
|
WHERE { |
|
|
# SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
|
# VALUES ?work {wd:'''+artwork_id+'''} |
|
|
VALUES ?work {wd:'''+artwork_id+'''} |
|
|
# OPTIONAL { ?work wdt:P9 ?creators. } |
|
|
OPTIONAL { ?work wdt:P9 ?creators. } |
|
|
# OPTIONAL { ?work p:P9 ?statement0. |
|
|
OPTIONAL { ?work p:P9 ?statement0. |
|
|
# ?statement0 ps:P9 ?creators; |
|
|
?statement0 ps:P9 ?creators; |
|
|
# pq:P49 ?creatorRoles. } |
|
|
pq:P49 ?creatorRoles. } |
|
|
|
|
|
|
|
|
# OPTIONAL { ?work wdt:P13 ?date. } |
|
|
OPTIONAL { ?work wdt:P13 ?date. } |
|
|
# OPTIONAL { ?work p:P13 ?statement1. |
|
|
OPTIONAL { ?work p:P13 ?statement1. |
|
|
# ?statement1 ps:P13 ?date; |
|
|
?statement1 ps:P13 ?date; |
|
|
# pq:P51 ?dateType. } |
|
|
pq:P51 ?dateType; |
|
|
# OPTIONAL { ?work p:P13 ?statement1. |
|
|
pq:P50 ?dateSource. } |
|
|
# ?statement1 ps:P13 ?date; |
|
|
|
|
|
# pq:P50 ?dateSource. } |
|
|
|
|
|
|
|
|
|
|
|
# OPTIONAL { ?work wdt:P10 ?publishers. } |
|
|
OPTIONAL { ?work wdt:P10 ?publishers. } |
|
|
# OPTIONAL { ?work p:P10 ?statement2. |
|
|
OPTIONAL { ?work p:P10 ?statement2. |
|
|
# ?statement2 ps:P10 ?publishers; |
|
|
?statement2 ps:P10 ?publishers; |
|
|
# pq:P49 ?publisherRoles. } |
|
|
pq:P49 ?publisherRoles. } |
|
|
|
|
|
|
|
|
# OPTIONAL { ?work wdt:P30 ?image. } |
|
|
OPTIONAL { ?work wdt:P30 ?image. } |
|
|
# OPTIONAL { ?work p:P30 ?statement3. |
|
|
OPTIONAL { ?work p:P30 ?statement3. |
|
|
# ?statement3 ps:P30 ?image; |
|
|
?statement3 ps:P30 ?image; |
|
|
# pq:P54 ?depicts.} |
|
|
pq:P54 ?depics; |
|
|
# OPTIONAL { ?work p:P30 ?statement3. |
|
|
pq:P55 ?annotation; |
|
|
# ?statement3 ps:P30 ?image; |
|
|
pq:P56 ?license.} |
|
|
# pq:P55 ?annotation.} |
|
|
|
|
|
# OPTIONAL { ?work p:P30 ?statement3. |
|
|
|
|
|
# ?statement3 ps:P30 ?image; |
|
|
|
|
|
# pq:P56 ?license.} |
|
|
|
|
|
|
|
|
|
|
|
# OPTIONAL { ?work wdt:P65 ?descriptionPage. } |
|
|
OPTIONAL { ?work wdt:P65 ?descriptionQID. } |
|
|
# OPTIONAL { ?description wdt:P4 ?accessURLdescriptionPage. } |
|
|
OPTIONAL { ?descriptionQID wdt:P4 ?accessURLdescrip; |
|
|
# OPTIONAL { ?description wdt:P9 ?authordescriptionPage. } |
|
|
wdt:P9 ?authordescrip; |
|
|
# OPTIONAL { ?description wdt:P13 ?datedescriptionPage. } |
|
|
wdt:P13 ?datedescrip; |
|
|
# OPTIONAL { ?description wdt:P50 ?sourcedescriptionPage. } |
|
|
wdt:P50 ?sourcedescrip. } |
|
|
|
|
|
|
|
|
# OPTIONAL { ?work wdt:P66 ?exhibitionHisPage. } |
|
|
OPTIONAL { ?work wdt:P66 ?exhibitionHistoryQID. } |
|
|
# OPTIONAL { ?exhibitionHisPage wdt:P4 ?accessURLexhibitionHisPage. } |
|
|
OPTIONAL { ?exhibitionHistoryQID wdt:P4 ?accessURLexhibitionHis; |
|
|
# OPTIONAL { ?exhibitionHisPage wdt:P9 ?authorexhibitionHisPage. } |
|
|
wdt:P9 ?authorexhibitionHis; |
|
|
# OPTIONAL { ?exhibitionHisPage wdt:P13 ?dateexhibitionHisPage. } |
|
|
wdt:P13 ?dateexhibitionHis; |
|
|
# OPTIONAL { ?exhibitionHisPage wdt:P50 ?sourceexhibitionHisPage. } |
|
|
wdt:P50 ?sourceexhibitionHis. } |
|
|
|
|
|
|
|
|
# OPTIONAL { ?work wdt:P32 ?digitalFacsimile. } |
|
|
OPTIONAL { ?work wdt:P32 ?digitalFacsimile. } |
|
|
# OPTIONAL { ?work wdt:P34 ?digitalFacsimileExternal. } |
|
|
OPTIONAL { ?work wdt:P34 ?digitalFacsimileExternal. } |
|
|
|
|
|
|
|
|
# OPTIONAL { ?work wdt:P35 ?digitalArtefact. } |
|
|
OPTIONAL { ?work wdt:P35 ?digitalArtefact. } |
|
|
# OPTIONAL { ?work p:P35 ?statement4. |
|
|
OPTIONAL { ?work p:P35 ?statement4. |
|
|
# ?statement4 ps:P35 ?digitalArtefact; |
|
|
?statement4 ps:P35 ?digitalArtefact; |
|
|
# pq:P16 ?format.} |
|
|
pq:P16 ?format.} |
|
|
|
|
|
|
|
|
# OPTIONAL { ?work wdt:P37 ?distributorLinks. } |
|
|
OPTIONAL { ?work wdt:P37 ?distributorLinks. } |
|
|
|
|
|
|
|
|
# OPTIONAL { ?work wdt:P43 ?copiesCollections. } |
|
|
OPTIONAL { ?work wdt:P43 ?copiesCollections. } |
|
|
# OPTIONAL { ?copiesCollections wdt:P47 ?collections. } |
|
|
OPTIONAL { ?copies_collections wdt:P47 ?collections; |
|
|
# OPTIONAL { ?copiesCollections wdt:P30 ?imageCollections. } |
|
|
wdt:P30 ?imageCollections. } |
|
|
|
|
|
|
|
|
# OPTIONAL { ?work wdt:P44 ?relatedWorks.} |
|
|
OPTIONAL { ?work wdt:P44 ?relatedWorks. } |
|
|
# OPTIONAL { ?relatedWorks wdt:P13 ?daterelatedWorks. } |
|
|
OPTIONAL { ?relatedWorks wdt:P13 ?dateRelatedWorks. } |
|
|
# } |
|
|
|
|
|
|
|
|
|
|
|
# ''') |
|
|
} |
|
|
# sparql.setReturnFormat(JSON) |
|
|
''') |
|
|
# artwork = sparql.query().convert() |
|
|
sparql.setReturnFormat(JSON) |
|
|
|
|
|
artwork = sparql.query().convert() |
|
|
# print(artwork) |
|
|
# print(artwork) |
|
|
|
|
|
|
|
|
artwork_url = "https://daap.bannerrepeater.org/wiki/Item:Q92" |
|
|
artwork_url = "https://daap.bannerrepeater.org/wiki/Item:Q92" |
|
|
artwork_title = "the human printer" |
|
|
artwork_title = "the human printer" |
|
|
artwork_description = "short description" |
|
|
artwork_description = "short description" |
|
|
return render_template('artwork.html', artwork_title=artwork_title, artwork_description=artwork_description) |
|
|
return render_template('artwork.html', artwork_title=artwork_title, artwork_description=artwork_description, artwork=artwork, artwork_id=artwork_id) |
|
|
|
|
|
|
|
|
######################### PERSON |
|
|
######################### PERSON |
|
|
@app.route("/person", methods=['GET']) |
|
|
@app.route("/person", methods=['GET']) |
|
|
def person(): |
|
|
def person(): |
|
|
person_id = request.args.get('id') |
|
|
person_id = request.args.get('id') |
|
|
sparql.setQuery(''' |
|
|
sparql.setQuery(''' |
|
|
|
|
|
SELECT ?person ?personLabel ?personDescription ?a ?aLabel ?propLabel ?b ?bLabel |
|
|
|
|
|
WHERE { |
|
|
|
|
|
VALUES ?person {wd:'''+person_id+'''} |
|
|
|
|
|
?person ?a ?b. |
|
|
|
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } |
|
|
|
|
|
?prop wikibase:directClaim ?a . |
|
|
|
|
|
} |
|
|
|
|
|
''') |
|
|
|
|
|
sparql.setReturnFormat(JSON) |
|
|
|
|
|
person_details = sparql.query().convert() |
|
|
|
|
|
print(person_details) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sparql2.setQuery(''' |
|
|
SELECT ?work ?workLabel ?image ?date |
|
|
SELECT ?work ?workLabel ?image ?date |
|
|
WHERE { |
|
|
WHERE { |
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
@ -203,10 +288,10 @@ def person(): |
|
|
} |
|
|
} |
|
|
ORDER BY (?workLabel) |
|
|
ORDER BY (?workLabel) |
|
|
''') |
|
|
''') |
|
|
sparql.setReturnFormat(JSON) |
|
|
sparql2.setReturnFormat(JSON) |
|
|
person_creatorof = sparql.query().convert() |
|
|
person_creatorof = sparql2.query().convert() |
|
|
|
|
|
|
|
|
sparql2.setQuery(''' |
|
|
sparql3.setQuery(''' |
|
|
SELECT ?work ?workLabel ?image ?date |
|
|
SELECT ?work ?workLabel ?image ?date |
|
|
WHERE { |
|
|
WHERE { |
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } |
|
@ -218,13 +303,13 @@ def person(): |
|
|
} |
|
|
} |
|
|
ORDER BY (?workLabel) |
|
|
ORDER BY (?workLabel) |
|
|
''') |
|
|
''') |
|
|
sparql2.setReturnFormat(JSON) |
|
|
sparql3.setReturnFormat(JSON) |
|
|
person_publisherof = sparql2.query().convert() |
|
|
person_publisherof = sparql2.query().convert() |
|
|
|
|
|
|
|
|
person_url = "" |
|
|
person_url = "" |
|
|
person_name = "the name" |
|
|
person_name = "the name" |
|
|
person_description = "short bio" |
|
|
person_description = "short bio" |
|
|
return render_template("person.html", person_id=person_id, person_creatorof=person_creatorof, person_publisherof=person_publisherof) |
|
|
return render_template("person.html", person_id=person_id, person_creatorof=person_creatorof, person_publisherof=person_publisherof, person_details=person_details) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -260,6 +345,6 @@ def upload(): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ALL NAME SPACES |
|
|
# ALL NAME |
|
|
# https://daap.bannerrepeater.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces|namespacealiases |
|
|
# https://daap.bannerrepeater.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces|namespacealiases |
|
|
|
|
|
|
|
|