Expand focus from paintings to more artworks
Replace all references to 'painting' with 'artwork'
This commit is contained in:
		
							parent
							
								
									df8ff30b64
								
							
						
					
					
						commit
						036a4be5ed
					
				
							
								
								
									
										78
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										78
									
								
								app.py
									
									
									
									
									
								
							| 
						 | 
					@ -1,10 +1,10 @@
 | 
				
			||||||
#!/usr/bin/python3
 | 
					#!/usr/bin/python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from flask import Flask, render_template, url_for, redirect, request, g, jsonify, session
 | 
					from flask import Flask, render_template, url_for, redirect, request, g, jsonify, session
 | 
				
			||||||
from depicts import (utils, wdqs, commons, mediawiki, painting, database,
 | 
					from depicts import (utils, wdqs, commons, mediawiki, artwork, database,
 | 
				
			||||||
                     wd_catalog, human, wikibase, wikidata_oauth, wikidata_edit)
 | 
					                     wd_catalog, human, wikibase, wikidata_oauth, wikidata_edit)
 | 
				
			||||||
from depicts.pager import Pagination, init_pager
 | 
					from depicts.pager import Pagination, init_pager
 | 
				
			||||||
from depicts.model import (DepictsItem, DepictsItemAltLabel, Edit, PaintingItem,
 | 
					from depicts.model import (DepictsItem, DepictsItemAltLabel, Edit, ArtworkItem,
 | 
				
			||||||
                           Language)
 | 
					                           Language)
 | 
				
			||||||
from depicts.error_mail import setup_error_mail
 | 
					from depicts.error_mail import setup_error_mail
 | 
				
			||||||
from requests_oauthlib import OAuth1Session
 | 
					from requests_oauthlib import OAuth1Session
 | 
				
			||||||
| 
						 | 
					@ -94,7 +94,7 @@ def user_settings():
 | 
				
			||||||
    return 'flipped. find more is ' + display
 | 
					    return 'flipped. find more is ' + display
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def existing_edit(item_id, depicts_id):
 | 
					def existing_edit(item_id, depicts_id):
 | 
				
			||||||
    q = Edit.query.filter_by(painting_id=item_id, depicts_id=depicts_id)
 | 
					    q = Edit.query.filter_by(artwork_id=item_id, depicts_id=depicts_id)
 | 
				
			||||||
    return q.count() != 0
 | 
					    return q.count() != 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route('/save/Q<int:item_id>', methods=['POST'])
 | 
					@app.route('/save/Q<int:item_id>', methods=['POST'])
 | 
				
			||||||
| 
						 | 
					@ -105,12 +105,12 @@ def save(item_id):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    token = wikidata_oauth.get_token()
 | 
					    token = wikidata_oauth.get_token()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    painting_item = PaintingItem.query.get(item_id)
 | 
					    artwork_item = ArtworkItem.query.get(item_id)
 | 
				
			||||||
    if painting_item is None:
 | 
					    if artwork_item is None:
 | 
				
			||||||
        painting_entity = mediawiki.get_entity_with_cache(f'Q{item_id}')
 | 
					        artwork_entity = mediawiki.get_entity_with_cache(f'Q{item_id}')
 | 
				
			||||||
        label = wikibase.get_entity_label(painting_entity)
 | 
					        label = wikibase.get_entity_label(artwork_entity)
 | 
				
			||||||
        painting_item = PaintingItem(item_id=item_id, label=label, entity=painting_entity)
 | 
					        artwork_item = ArtworkItem(item_id=item_id, label=label, entity=artwork_entity)
 | 
				
			||||||
        database.session.add(painting_item)
 | 
					        database.session.add(artwork_item)
 | 
				
			||||||
        database.session.commit()
 | 
					        database.session.commit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for depicts_qid in depicts:
 | 
					    for depicts_qid in depicts:
 | 
				
			||||||
| 
						 | 
					@ -136,7 +136,7 @@ def save(item_id):
 | 
				
			||||||
        lastrevid = saved['pageinfo']['lastrevid']
 | 
					        lastrevid = saved['pageinfo']['lastrevid']
 | 
				
			||||||
        assert saved['success'] == 1
 | 
					        assert saved['success'] == 1
 | 
				
			||||||
        edit = Edit(username=username,
 | 
					        edit = Edit(username=username,
 | 
				
			||||||
                    painting_id=item_id,
 | 
					                    artwork_id=item_id,
 | 
				
			||||||
                    depicts_id=depicts_id,
 | 
					                    depicts_id=depicts_id,
 | 
				
			||||||
                    lastrevid=lastrevid)
 | 
					                    lastrevid=lastrevid)
 | 
				
			||||||
        database.session.add(edit)
 | 
					        database.session.add(edit)
 | 
				
			||||||
| 
						 | 
					@ -184,19 +184,19 @@ def property_query_page(property_id):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route('/')
 | 
					@app.route('/')
 | 
				
			||||||
def start():
 | 
					def start():
 | 
				
			||||||
    return random_painting()
 | 
					    return random_artwork()
 | 
				
			||||||
    username = wikidata_oauth.get_username()
 | 
					    username = wikidata_oauth.get_username()
 | 
				
			||||||
    username = None
 | 
					    username = None
 | 
				
			||||||
    return render_template('start.html', username=username)
 | 
					    return render_template('start.html', username=username)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route('/next')
 | 
					@app.route('/next')
 | 
				
			||||||
def random_painting():
 | 
					def random_artwork():
 | 
				
			||||||
    q = render_template('query/painting_no_depicts.sparql')
 | 
					    q = render_template('query/artwork_no_depicts.sparql')
 | 
				
			||||||
    rows = wdqs.run_query_with_cache(q)
 | 
					    rows = wdqs.run_query_with_cache(q)
 | 
				
			||||||
    has_depicts = True
 | 
					    has_depicts = True
 | 
				
			||||||
    while has_depicts:
 | 
					    while has_depicts:
 | 
				
			||||||
        item_id = wdqs.row_id(random.choice(rows))
 | 
					        item_id = wdqs.row_id(random.choice(rows))
 | 
				
			||||||
        if PaintingItem.query.get(item_id):
 | 
					        if ArtworkItem.query.get(item_id):
 | 
				
			||||||
            continue
 | 
					            continue
 | 
				
			||||||
        entity = mediawiki.get_entity_with_cache(f'Q{item_id}', refresh=True)
 | 
					        entity = mediawiki.get_entity_with_cache(f'Q{item_id}', refresh=True)
 | 
				
			||||||
        en_label = wikibase.get_en_label(entity)
 | 
					        en_label = wikibase.get_en_label(entity)
 | 
				
			||||||
| 
						 | 
					@ -259,7 +259,7 @@ def oauth_callback():
 | 
				
			||||||
    session['owner_secret'] = oauth_tokens.get('oauth_token_secret')
 | 
					    session['owner_secret'] = oauth_tokens.get('oauth_token_secret')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    next_page = session.get('after_login')
 | 
					    next_page = session.get('after_login')
 | 
				
			||||||
    return redirect(next_page) if next_page else random_painting()
 | 
					    return redirect(next_page) if next_page else random_artwork()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route('/oauth/disconnect')
 | 
					@app.route('/oauth/disconnect')
 | 
				
			||||||
def oauth_disconnect():
 | 
					def oauth_disconnect():
 | 
				
			||||||
| 
						 | 
					@ -268,13 +268,13 @@ def oauth_disconnect():
 | 
				
			||||||
            del session[key]
 | 
					            del session[key]
 | 
				
			||||||
    return redirect(url_for('browse_page'))
 | 
					    return redirect(url_for('browse_page'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def create_claim(painting_id, depicts_id, token):
 | 
					def create_claim(artwork_id, depicts_id, token):
 | 
				
			||||||
    painting_qid = f'Q{painting_id}'
 | 
					    artwork_qid = f'Q{artwork_id}'
 | 
				
			||||||
    value = json.dumps({'entity-type': 'item',
 | 
					    value = json.dumps({'entity-type': 'item',
 | 
				
			||||||
                        'numeric-id': depicts_id})
 | 
					                        'numeric-id': depicts_id})
 | 
				
			||||||
    params = {
 | 
					    params = {
 | 
				
			||||||
        'action': 'wbcreateclaim',
 | 
					        'action': 'wbcreateclaim',
 | 
				
			||||||
        'entity': painting_qid,
 | 
					        'entity': artwork_qid,
 | 
				
			||||||
        'property': 'P180',
 | 
					        'property': 'P180',
 | 
				
			||||||
        'snaktype': 'value',
 | 
					        'snaktype': 'value',
 | 
				
			||||||
        'value': value,
 | 
					        'value': value,
 | 
				
			||||||
| 
						 | 
					@ -332,7 +332,7 @@ def get_institution(entity, other):
 | 
				
			||||||
@app.route("/item/Q<int:item_id>")
 | 
					@app.route("/item/Q<int:item_id>")
 | 
				
			||||||
def item_page(item_id):
 | 
					def item_page(item_id):
 | 
				
			||||||
    qid = f'Q{item_id}'
 | 
					    qid = f'Q{item_id}'
 | 
				
			||||||
    item = painting.Painting(qid)
 | 
					    item = artwork.Artwork(qid)
 | 
				
			||||||
    from_redirect = qid in session and session.pop(qid) == 'from redirect'
 | 
					    from_redirect = qid in session and session.pop(qid) == 'from redirect'
 | 
				
			||||||
    entity = mediawiki.get_entity_with_cache(qid, refresh=not from_redirect)
 | 
					    entity = mediawiki.get_entity_with_cache(qid, refresh=not from_redirect)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -355,12 +355,12 @@ def item_page(item_id):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    people = human.from_name(label) if label else None
 | 
					    people = human.from_name(label) if label else None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    painting_item = PaintingItem.query.get(item_id)
 | 
					    artwork_item = ArtworkItem.query.get(item_id)
 | 
				
			||||||
    if painting_item is None:
 | 
					    if artwork_item is None:
 | 
				
			||||||
        painting_item = PaintingItem(item_id=item_id, label=label, entity=entity)
 | 
					        artwork_item = ArtworkItem(item_id=item_id, label=label, entity=entity)
 | 
				
			||||||
        database.session.add(painting_item)
 | 
					        database.session.add(artwork_item)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    catalog = wd_catalog.get_catalog_from_painting(entity)
 | 
					    catalog = wd_catalog.get_catalog_from_artwork(entity)
 | 
				
			||||||
    if not catalog.get('institution'):
 | 
					    if not catalog.get('institution'):
 | 
				
			||||||
        catalog['institution'] = get_institution(entity, other)
 | 
					        catalog['institution'] = get_institution(entity, other)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -447,9 +447,9 @@ def get_other(entity):
 | 
				
			||||||
def list_edits():
 | 
					def list_edits():
 | 
				
			||||||
    edit_list = Edit.query.order_by(Edit.timestamp.desc())
 | 
					    edit_list = Edit.query.order_by(Edit.timestamp.desc())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    painting_count = (database.session
 | 
					    item_count = (database.session
 | 
				
			||||||
                              .query(func.count(distinct(Edit.painting_id)))
 | 
					                          .query(func.count(distinct(Edit.artwork_id)))
 | 
				
			||||||
                              .scalar())
 | 
					                          .scalar())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    user_count = (database.session
 | 
					    user_count = (database.session
 | 
				
			||||||
                          .query(func.count(distinct(Edit.username)))
 | 
					                          .query(func.count(distinct(Edit.username)))
 | 
				
			||||||
| 
						 | 
					@ -458,7 +458,7 @@ def list_edits():
 | 
				
			||||||
    return render_template('list_edits.html',
 | 
					    return render_template('list_edits.html',
 | 
				
			||||||
                           edits=Edit.query,
 | 
					                           edits=Edit.query,
 | 
				
			||||||
                           edit_list=edit_list,
 | 
					                           edit_list=edit_list,
 | 
				
			||||||
                           painting_count=painting_count,
 | 
					                           item_count=item_count,
 | 
				
			||||||
                           user_count=user_count)
 | 
					                           user_count=user_count)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route("/user/<username>")
 | 
					@app.route("/user/<username>")
 | 
				
			||||||
| 
						 | 
					@ -466,16 +466,16 @@ def user_page(username):
 | 
				
			||||||
    edit_list = (Edit.query.filter_by(username=username)
 | 
					    edit_list = (Edit.query.filter_by(username=username)
 | 
				
			||||||
                           .order_by(Edit.timestamp.desc()))
 | 
					                           .order_by(Edit.timestamp.desc()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    painting_count = (database.session
 | 
					    item_count = (database.session
 | 
				
			||||||
                              .query(func.count(distinct(Edit.painting_id)))
 | 
					                          .query(func.count(distinct(Edit.artwork_id)))
 | 
				
			||||||
                              .filter_by(username=username)
 | 
					                          .filter_by(username=username)
 | 
				
			||||||
                              .scalar())
 | 
					                          .scalar())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return render_template('user_page.html',
 | 
					    return render_template('user_page.html',
 | 
				
			||||||
                           username=username,
 | 
					                           username=username,
 | 
				
			||||||
                           edits=Edit.query,
 | 
					                           edits=Edit.query,
 | 
				
			||||||
                           edit_list=edit_list,
 | 
					                           edit_list=edit_list,
 | 
				
			||||||
                           painting_count=painting_count)
 | 
					                           item_count=item_count)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route("/next/Q<int:item_id>")
 | 
					@app.route("/next/Q<int:item_id>")
 | 
				
			||||||
def next_page(item_id):
 | 
					def next_page(item_id):
 | 
				
			||||||
| 
						 | 
					@ -569,11 +569,11 @@ def get_facets(params):
 | 
				
			||||||
        if values
 | 
					        if values
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_painting_params():
 | 
					def get_artwork_params():
 | 
				
			||||||
    return [(pid, qid) for pid, qid in request.args.items()
 | 
					    return [(pid, qid) for pid, qid in request.args.items()
 | 
				
			||||||
            if pid.startswith('P') and qid.startswith('Q')]
 | 
					            if pid.startswith('P') and qid.startswith('Q')]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def filter_painting(params):
 | 
					def filter_artwork(params):
 | 
				
			||||||
    flat = '_'.join(f'{pid}={qid}' for pid, qid in params)
 | 
					    flat = '_'.join(f'{pid}={qid}' for pid, qid in params)
 | 
				
			||||||
    q = render_template('query/find_more.sparql', params=params)
 | 
					    q = render_template('query/find_more.sparql', params=params)
 | 
				
			||||||
    bindings = wdqs.run_query_with_cache(q, flat)
 | 
					    bindings = wdqs.run_query_with_cache(q, flat)
 | 
				
			||||||
| 
						 | 
					@ -582,8 +582,8 @@ def filter_painting(params):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route('/catalog')
 | 
					@app.route('/catalog')
 | 
				
			||||||
def catalog_page():
 | 
					def catalog_page():
 | 
				
			||||||
    params = get_painting_params()
 | 
					    params = get_artwork_params()
 | 
				
			||||||
    bindings = filter_painting(params)
 | 
					    bindings = filter_artwork(params)
 | 
				
			||||||
    page = utils.get_int_arg('page') or 1
 | 
					    page = utils.get_int_arg('page') or 1
 | 
				
			||||||
    page_size = 45
 | 
					    page_size = 45
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -655,7 +655,7 @@ def debug_show_user():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route('/browse')
 | 
					@app.route('/browse')
 | 
				
			||||||
def browse_page():
 | 
					def browse_page():
 | 
				
			||||||
    params = get_painting_params()
 | 
					    params = get_artwork_params()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not params:
 | 
					    if not params:
 | 
				
			||||||
        return browse_index()
 | 
					        return browse_index()
 | 
				
			||||||
| 
						 | 
					@ -664,7 +664,7 @@ def browse_page():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    item_labels = get_labels(qid for pid, qid in params)
 | 
					    item_labels = get_labels(qid for pid, qid in params)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bindings = filter_painting(params)
 | 
					    bindings = filter_artwork(params)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    facets = get_facets(params)
 | 
					    facets = get_facets(params)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@ class QueryResultRow:
 | 
				
			||||||
                for k, v in self.row.items()
 | 
					                for k, v in self.row.items()
 | 
				
			||||||
                if not k.startswith('item')]
 | 
					                if not k.startswith('item')]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Painting:
 | 
					class Artwork:
 | 
				
			||||||
    def __init__(self, qid):
 | 
					    def __init__(self, qid):
 | 
				
			||||||
        self.entity = mediawiki.get_entity_with_cache(qid)
 | 
					        self.entity = mediawiki.get_entity_with_cache(qid)
 | 
				
			||||||
        self.item_id = int(qid[1:])
 | 
					        self.item_id = int(qid[1:])
 | 
				
			||||||
| 
						 | 
					@ -45,8 +45,8 @@ class DepictsItemAltLabel(Base):
 | 
				
			||||||
    def __init__(self, alt_label):
 | 
					    def __init__(self, alt_label):
 | 
				
			||||||
        self.alt_label = alt_label
 | 
					        self.alt_label = alt_label
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PaintingItem(Base):
 | 
					class ArtworkItem(Base):
 | 
				
			||||||
    __tablename__ = 'painting'
 | 
					    __tablename__ = 'artwork'
 | 
				
			||||||
    item_id = Column(Integer, primary_key=True, autoincrement=False)
 | 
					    item_id = Column(Integer, primary_key=True, autoincrement=False)
 | 
				
			||||||
    label = Column(String)
 | 
					    label = Column(String)
 | 
				
			||||||
    entity = Column(postgresql.JSON)
 | 
					    entity = Column(postgresql.JSON)
 | 
				
			||||||
| 
						 | 
					@ -80,15 +80,15 @@ class Language(Base):
 | 
				
			||||||
class Edit(Base):
 | 
					class Edit(Base):
 | 
				
			||||||
    __tablename__ = 'edit'
 | 
					    __tablename__ = 'edit'
 | 
				
			||||||
    username = Column(String, primary_key=True)
 | 
					    username = Column(String, primary_key=True)
 | 
				
			||||||
    painting_id = Column(Integer, ForeignKey('painting.item_id'), primary_key=True)
 | 
					    artwork_id = Column(Integer, ForeignKey('artwork.item_id'), primary_key=True)
 | 
				
			||||||
    depicts_id = Column(Integer, ForeignKey('depicts.item_id'), primary_key=True)
 | 
					    depicts_id = Column(Integer, ForeignKey('depicts.item_id'), primary_key=True)
 | 
				
			||||||
    timestamp = Column(DateTime, default=now_utc())
 | 
					    timestamp = Column(DateTime, default=now_utc())
 | 
				
			||||||
    lastrevid = Column(Integer, nullable=True)
 | 
					    lastrevid = Column(Integer, nullable=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    painting_qid = column_property('Q' + cast(painting_id, String))
 | 
					    artwork_qid = column_property('Q' + cast(artwork_id, String))
 | 
				
			||||||
    depicts_qid = column_property('Q' + cast(depicts_id, String))
 | 
					    depicts_qid = column_property('Q' + cast(depicts_id, String))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    painting = relationship('PaintingItem')
 | 
					    artwork = relationship('ArtworkItem')
 | 
				
			||||||
    depicts = relationship('DepictsItem')
 | 
					    depicts = relationship('DepictsItem')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -176,7 +176,7 @@ def check_catalog(entity, catalog):
 | 
				
			||||||
            'description': description,
 | 
					            'description': description,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_catalog_from_painting(entity):
 | 
					def get_catalog_from_artwork(entity):
 | 
				
			||||||
    catalog_ids = find_catalog_id(entity)
 | 
					    catalog_ids = find_catalog_id(entity)
 | 
				
			||||||
    catalog_detail = []
 | 
					    catalog_detail = []
 | 
				
			||||||
    for property_id in sorted(catalog_ids):
 | 
					    for property_id in sorted(catalog_ids):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,10 @@
 | 
				
			||||||
{% extends "base.html" %}
 | 
					{% extends "base.html" %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% block title %}Wikidata painting depicts{% endblock %}
 | 
					{% block title %}Wikidata Art Depiction Explorer{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% block content %}
 | 
					{% block content %}
 | 
				
			||||||
<div class="m-3">
 | 
					<div class="m-3">
 | 
				
			||||||
  <p><a href="{{ url_for('random_painting') }}">random painting</a>
 | 
					  <p><a href="{{ url_for('random_artwork') }}">random artwork</a>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {% if not g.user %}
 | 
					  {% if not g.user %}
 | 
				
			||||||
  | <a href="{{ url_for('start_oauth') }}">connect to Wikidata account</a>
 | 
					  | <a href="{{ url_for('start_oauth') }}">connect to Wikidata account</a>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@
 | 
				
			||||||
                    <div>
 | 
					                    <div>
 | 
				
			||||||
                      <a href="#">${ hit.label }</a>
 | 
					                      <a href="#">${ hit.label }</a>
 | 
				
			||||||
                      <span v-if="hit.alt_label">(${ hit.alt_label })</span>
 | 
					                      <span v-if="hit.alt_label">(${ hit.alt_label })</span>
 | 
				
			||||||
                      — ${ hit.count } existing paintings
 | 
					                      — ${ hit.count } existing artworks
 | 
				
			||||||
                      (${ hit.qid })
 | 
					                      (${ hit.qid })
 | 
				
			||||||
                      <a :href="'https://www.wikidata.org/wiki/' + hit.qid">view on Wikidata</a>
 | 
					                      <a :href="'https://www.wikidata.org/wiki/' + hit.qid">view on Wikidata</a>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,7 @@
 | 
				
			||||||
    {% endfor %}
 | 
					    {% endfor %}
 | 
				
			||||||
  </p>
 | 
					  </p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <p>{{ '{:,d}'.format(total) }} paintings found</p>
 | 
					  <p>{{ '{:,d}'.format(total) }} artworks found</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<p class="mb-3">
 | 
					<p class="mb-3">
 | 
				
			||||||
  <a href="#" id="toggle-filters" class="btn btn-primary">toggle filters</a>
 | 
					  <a href="#" id="toggle-filters" class="btn btn-primary">toggle filters</a>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,8 +30,8 @@ span.description { color: rgb(96, 96, 96); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <div class="m-2">
 | 
					  <div class="m-2">
 | 
				
			||||||
  <a href="https://www.wikidata.org/wiki/{{ qid }}" class="btn btn-primary">view on Wikidata</a>
 | 
					  <a href="https://www.wikidata.org/wiki/{{ qid }}" class="btn btn-primary">view on Wikidata</a>
 | 
				
			||||||
  <a href="{{ url_for('random_painting') }}" class="btn btn-primary">skip this photo</a>
 | 
					  <a href="{{ url_for('random_artwork') }}" class="btn btn-primary">skip this artwork</a>
 | 
				
			||||||
  <a href="{{ url_for('browse_page') }}" class="btn btn-primary">browse paintings</a>
 | 
					  <a href="{{ url_for('browse_page') }}" class="btn btn-primary">browse artworks</a>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -109,7 +109,7 @@ span.description { color: rgb(96, 96, 96); }
 | 
				
			||||||
      {% raw %}
 | 
					      {% raw %}
 | 
				
			||||||
      <div id="app" class="mt-2">
 | 
					      <div id="app" class="mt-2">
 | 
				
			||||||
        <div v-if="existing_depicts.length">
 | 
					        <div v-if="existing_depicts.length">
 | 
				
			||||||
          <div>this painting has {{ existing_depicts.length }} existing depicts statement</div>
 | 
					          <div>this artwork has {{ existing_depicts.length }} existing depicts statement</div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div class="mb-2" v-for="(hit, index) in existing_depicts">
 | 
					        <div class="mb-2" v-for="(hit, index) in existing_depicts">
 | 
				
			||||||
| 
						 | 
					@ -118,14 +118,14 @@ span.description { color: rgb(96, 96, 96); }
 | 
				
			||||||
            ({{ hit.qid }})
 | 
					            ({{ hit.qid }})
 | 
				
			||||||
             
 | 
					             
 | 
				
			||||||
            <span v-if="hit.description" class="description">{{ hit.description }}</span>
 | 
					            <span v-if="hit.description" class="description">{{ hit.description }}</span>
 | 
				
			||||||
            — {{ hit.count }} paintings
 | 
					            — {{ hit.count }} artworks
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <h3>what can you see in this painting?</h3>
 | 
					        <h3>what can you see in this artwork?</h3>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div v-if="people.length">
 | 
					        <div v-if="people.length">
 | 
				
			||||||
          <div>These people were born and died in the same years as appears in the title of the painting.</div>
 | 
					          <div>These people were born and died in the same years as appears in the title of the artwork.</div>
 | 
				
			||||||
          <div v-for="person in people">
 | 
					          <div v-for="person in people">
 | 
				
			||||||
            <a href="#" @click.prevent="add_person(person)">{{ person.label || '[name missing]' }}</a>,
 | 
					            <a href="#" @click.prevent="add_person(person)">{{ person.label || '[name missing]' }}</a>,
 | 
				
			||||||
            {{ person.year_of_birth }}-{{ person.year_of_death}} ({{ person.qid }})
 | 
					            {{ person.year_of_birth }}-{{ person.year_of_death}} ({{ person.qid }})
 | 
				
			||||||
| 
						 | 
					@ -135,7 +135,7 @@ span.description { color: rgb(96, 96, 96); }
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div v-if="new_depicts.length">
 | 
					        <div v-if="new_depicts.length">
 | 
				
			||||||
          <div>{{ new_depicts.length }} new items to add to painting depicts statement</div>
 | 
					          <div>{{ new_depicts.length }} new items to add to artwork depicts statement</div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div v-for="(hit, index) in new_depicts">
 | 
					        <div v-for="(hit, index) in new_depicts">
 | 
				
			||||||
| 
						 | 
					@ -144,7 +144,7 @@ span.description { color: rgb(96, 96, 96); }
 | 
				
			||||||
            {{ hit.label }}
 | 
					            {{ hit.label }}
 | 
				
			||||||
            <span v-if="hit.alt_label">({{ hit.alt_label }})</span>
 | 
					            <span v-if="hit.alt_label">({{ hit.alt_label }})</span>
 | 
				
			||||||
            <a href="#" @click.prevent="remove(index)" >remove</a>
 | 
					            <a href="#" @click.prevent="remove(index)" >remove</a>
 | 
				
			||||||
            — {{ hit.count }} existing paintings
 | 
					            — {{ hit.count }} existing artworks
 | 
				
			||||||
            ({{ hit.qid }})
 | 
					            ({{ hit.qid }})
 | 
				
			||||||
            <a :href="'https://www.wikidata.org/wiki/' + hit.qid">[wikidata]</a>
 | 
					            <a :href="'https://www.wikidata.org/wiki/' + hit.qid">[wikidata]</a>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
| 
						 | 
					@ -153,7 +153,7 @@ span.description { color: rgb(96, 96, 96); }
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <button type="submit" v-if="new_depicts.length" class="btn btn-primary">add these to painting on Wikidata</button>
 | 
					        <button type="submit" v-if="new_depicts.length" class="btn btn-primary">add these to artwork on Wikidata</button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <input class="form-control-lg my-2 w-100" autocomplete="off" v-model.trim="searchTerms" ref="search" @input="search" />
 | 
					        <input class="form-control-lg my-2 w-100" autocomplete="off" v-model.trim="searchTerms" ref="search" @input="search" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -162,7 +162,7 @@ span.description { color: rgb(96, 96, 96); }
 | 
				
			||||||
            <div>
 | 
					            <div>
 | 
				
			||||||
              <a href="#" @click.prevent="add_depicts(hit)">{{ hit.label }}</a>
 | 
					              <a href="#" @click.prevent="add_depicts(hit)">{{ hit.label }}</a>
 | 
				
			||||||
              <span v-if="hit.alt_label">({{ hit.alt_label }})</span>
 | 
					              <span v-if="hit.alt_label">({{ hit.alt_label }})</span>
 | 
				
			||||||
              — {{ hit.count }} existing paintings
 | 
					              — {{ hit.count }} existing artworks
 | 
				
			||||||
              ({{ hit.qid }})
 | 
					              ({{ hit.qid }})
 | 
				
			||||||
              <a :href="'https://www.wikidata.org/wiki/' + hit.qid">view on Wikidata</a>
 | 
					              <a :href="'https://www.wikidata.org/wiki/' + hit.qid">view on Wikidata</a>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,13 +7,13 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <p>{{ user_count }} users have tried this tool.</p>
 | 
					  <p>{{ user_count }} users have tried this tool.</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <p>{{ painting_count }} paintings have been cataloged.</p>
 | 
					  <p>{{ item_count }} artworks have been cataloged.</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <table class="table w-auto">
 | 
					  <table class="table w-auto">
 | 
				
			||||||
    <thead>
 | 
					    <thead>
 | 
				
			||||||
      <tr>
 | 
					      <tr>
 | 
				
			||||||
        <th>username</th>
 | 
					        <th>username</th>
 | 
				
			||||||
        <th>painting</th>
 | 
					        <th>artwork</th>
 | 
				
			||||||
        <th>depicts</th>
 | 
					        <th>depicts</th>
 | 
				
			||||||
        <th>when</th>
 | 
					        <th>when</th>
 | 
				
			||||||
      </tr>
 | 
					      </tr>
 | 
				
			||||||
| 
						 | 
					@ -22,9 +22,9 @@
 | 
				
			||||||
    {% for edit in edit_list %}
 | 
					    {% for edit in edit_list %}
 | 
				
			||||||
    <tr>
 | 
					    <tr>
 | 
				
			||||||
      <td><a href="{{ url_for('user_page', username=edit.username.replace('_', ' ')) }}">{{ edit.username }}</a></td>
 | 
					      <td><a href="{{ url_for('user_page', username=edit.username.replace('_', ' ')) }}">{{ edit.username }}</a></td>
 | 
				
			||||||
      <td><a href="{{ url_for('item_page', item_id=edit.painting_id) }}">{{ edit.painting.label }}</a>
 | 
					      <td><a href="{{ url_for('item_page', item_id=edit.artwork_id) }}">{{ edit.artwork.label }}</a>
 | 
				
			||||||
        ({{ edit.painting_qid }})
 | 
					        ({{ edit.artwork_qid }})
 | 
				
			||||||
        <a href="https://www.wikidata.org/wiki/{{ edit.painting_qid }}">[wikidata]</a>
 | 
					        <a href="https://www.wikidata.org/wiki/{{ edit.artwork_qid }}">[wikidata]</a>
 | 
				
			||||||
      </td>
 | 
					      </td>
 | 
				
			||||||
      <td><a href="https://www.wikidata.org/wiki/{{ edit.depicts_qid }}">{{ edit.depicts.label }}</a>
 | 
					      <td><a href="https://www.wikidata.org/wiki/{{ edit.depicts_qid }}">{{ edit.depicts.label }}</a>
 | 
				
			||||||
          ({{ edit.depicts_qid }})</td>
 | 
					          ({{ edit.depicts_qid }})</td>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@
 | 
				
			||||||
    <ul class="navbar-nav mr-auto">
 | 
					    <ul class="navbar-nav mr-auto">
 | 
				
			||||||
      {{ nav_item('browse_page', 'Browse') }}
 | 
					      {{ nav_item('browse_page', 'Browse') }}
 | 
				
			||||||
      {{ nav_item('list_edits', 'Recent changes') }}
 | 
					      {{ nav_item('list_edits', 'Recent changes') }}
 | 
				
			||||||
      {{ nav_item('random_painting', 'Random painting') }}
 | 
					      {{ nav_item('random_artwork', 'Random artwork') }}
 | 
				
			||||||
    </ul>
 | 
					    </ul>
 | 
				
			||||||
    </ul>
 | 
					    </ul>
 | 
				
			||||||
    <ul class="navbar-nav">
 | 
					    <ul class="navbar-nav">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,15 +12,15 @@
 | 
				
			||||||
        <h1>{{ self.title() }}</h1>
 | 
					        <h1>{{ self.title() }}</h1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div class="alert alert-primary" role="alert">
 | 
					        <div class="alert alert-primary" role="alert">
 | 
				
			||||||
        Thanks for contributing. Your edits have been saved to the painting on Wikidata. Use the links below to find other similar paintings to catalog.
 | 
					        Thanks for contributing. Your edits have been saved to the artwork on Wikidata. Use the links below to find other similar artworks to catalog.
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <p>
 | 
					  <p>
 | 
				
			||||||
  <a href="https://www.wikidata.org/wiki/{{ qid }}">view this painting on Wikidata</a>
 | 
					  <a href="https://www.wikidata.org/wiki/{{ qid }}">view this artwork on Wikidata</a>
 | 
				
			||||||
  |
 | 
					  |
 | 
				
			||||||
  <a href="{{ url_for('random_painting') }}">switch to another painting</a>
 | 
					  <a href="{{ url_for('random_artwork') }}">switch to another artwork</a>
 | 
				
			||||||
  |
 | 
					  |
 | 
				
			||||||
  <a href="{{ url_for('browse_page') }}">browse paintings</a>
 | 
					  <a href="{{ url_for('browse_page') }}">browse artworks</a>
 | 
				
			||||||
  </p>
 | 
					  </p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {% if session.no_find_more %}
 | 
					  {% if session.no_find_more %}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@
 | 
				
			||||||
    — {{ row.objectDescription.value }}
 | 
					    — {{ row.objectDescription.value }}
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ({{ '{:,d}'.format(row.count.value | int) }} paintings)
 | 
					    ({{ '{:,d}'.format(row.count.value | int) }} artworks)
 | 
				
			||||||
    {% if 'objectLabel' not in row %}
 | 
					    {% if 'objectLabel' not in row %}
 | 
				
			||||||
      <a href="https://wikidata.org/wiki/{{ qid }}">view in Wikidata</a>
 | 
					      <a href="https://wikidata.org/wiki/{{ qid }}">view in Wikidata</a>
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,12 +7,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <p>This user has added a total of {{ edits.count() }} depicts statements.</p>
 | 
					  <p>This user has added a total of {{ edits.count() }} depicts statements.</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <p>{{ painting_count }} paintings have been cataloged.</p>
 | 
					  <p>{{ item_count }} artworks have been cataloged.</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <table class="table w-auto">
 | 
					  <table class="table w-auto">
 | 
				
			||||||
    <thead>
 | 
					    <thead>
 | 
				
			||||||
      <tr>
 | 
					      <tr>
 | 
				
			||||||
        <th>painting</th>
 | 
					        <th>artwork</th>
 | 
				
			||||||
        <th>depicts</th>
 | 
					        <th>depicts</th>
 | 
				
			||||||
        <th>when</th>
 | 
					        <th>when</th>
 | 
				
			||||||
      </tr>
 | 
					      </tr>
 | 
				
			||||||
| 
						 | 
					@ -20,9 +20,9 @@
 | 
				
			||||||
    <tbody>
 | 
					    <tbody>
 | 
				
			||||||
    {% for edit in edit_list %}
 | 
					    {% for edit in edit_list %}
 | 
				
			||||||
    <tr>
 | 
					    <tr>
 | 
				
			||||||
      <td><a href="{{ url_for('item_page', item_id=edit.painting_id) }}">{{ edit.painting.label }}</a>
 | 
					      <td><a href="{{ url_for('item_page', item_id=edit.artwork_id) }}">{{ edit.artwork.label }}</a>
 | 
				
			||||||
        ({{ edit.painting_qid }})
 | 
					        ({{ edit.artwork_qid }})
 | 
				
			||||||
        <a href="https://www.wikidata.org/wiki/{{ edit.painting_qid }}">[wikidata]</a>
 | 
					        <a href="https://www.wikidata.org/wiki/{{ edit.artwork_qid }}">[wikidata]</a>
 | 
				
			||||||
      </td>
 | 
					      </td>
 | 
				
			||||||
      <td><a href="https://www.wikidata.org/wiki/{{ edit.depicts_qid }}">{{ edit.depicts.label }}</a>
 | 
					      <td><a href="https://www.wikidata.org/wiki/{{ edit.depicts_qid }}">{{ edit.depicts.label }}</a>
 | 
				
			||||||
          ({{ edit.depicts_qid }})</td>
 | 
					          ({{ edit.depicts_qid }})</td>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue