Skip to content

Commit

Permalink
Merge pull request #912 from OnroerendErfgoed/develop
Browse files Browse the repository at this point in the history
2.1.1
  • Loading branch information
goessebr authored Aug 1, 2024
2 parents 7ea582c + 43bee21 commit 85b85c4
Show file tree
Hide file tree
Showing 34 changed files with 199 additions and 194 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2.1.1 (01-08-2023)
------------------

- ConceptVisitLog has an integer concept_id in the ConceptVisitLog class #906
- skosprovider route /expand does not work #903
- Manual ID text box not writable #902


2.1.0 (22-07-2023)
------------------

Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ keywords:
- vocabulary
- python
license: GPL-3.0
version: 2.1.0
version: 2.1.1
date-released: '2024-06-20'
5 changes: 4 additions & 1 deletion atramhasis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def includeme(config):
for key, value in DEFAULT_SETTINGS.items():
if key not in settings:
settings[key] = value
# Regexes in path params clash with this validation.
settings["pyramid_openapi3.enable_endpoint_validation"] = False
configure_session(config)
config.include('pyramid_jinja2')
config.include('pyramid_tm')
Expand All @@ -44,9 +46,10 @@ def includeme(config):
config.include('pyramid_rewrite')
config.include("pyramid_openapi3")
config.include('atramhasis.routes')
# pyramid_skosprovider must be included after the atramhasis routes
# because it contains a regex in the path which consumes a lot of routes.
config.include('pyramid_skosprovider')
config.include('atramhasis.cache')
config.scan('pyramid_skosprovider')

config.add_translation_dirs('atramhasis:locale/')

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""alter ConceptVisitLog concept_id to string
Revision ID: 29306f749043
Revises: b2a7d7614973
Create Date: 2024-07-30 09:12:37.521748
"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '29306f749043'
down_revision = 'b2a7d7614973'


def upgrade():
with op.batch_alter_table('concept_visit_log') as batch_op:
batch_op.alter_column('concept_id', type_=sa.String, existing_type=sa.Integer)


def downgrade():
# Drop concept_visit_log which have non-integer concept_id
op.execute(
"DELETE FROM concept_visit_log "
"WHERE cast(cast(concept_id AS INTEGER) AS TEXT) != concept_id"
)
with op.batch_alter_table('concept_visit_log') as batch_op:
batch_op.alter_column('concept_id', type_=sa.Integer, existing_type=sa.String)
2 changes: 1 addition & 1 deletion atramhasis/data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ConceptschemeVisitLog(Base):
class ConceptVisitLog(Base):
__tablename__ = 'concept_visit_log'
id = Column(Integer, primary_key=True, autoincrement=True)
concept_id = Column(Integer, nullable=False)
concept_id = Column(String, nullable=False)
conceptscheme_id = Column(String(25), nullable=False)
visited_at = Column(DateTime, default=func.now(), nullable=False)
origin = Column(String(25), nullable=False)
Expand Down
18 changes: 9 additions & 9 deletions atramhasis/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3

info:
title: Atramhasis API
version: 2.1.0
version: 2.1.1

servers:
- url: '/'
Expand Down Expand Up @@ -142,7 +142,7 @@ paths:
description: The identifier for a certain concept or collection.
required: true
schema:
type: integer
type: string
responses:
200:
description: The concept was found in the conceptscheme.
Expand Down Expand Up @@ -172,7 +172,7 @@ paths:
description: The identifier for a certain concept or collection.
required: true
schema:
type: integer
type: string
requestBody:
required: true
description: Data to create concept or collection
Expand Down Expand Up @@ -222,7 +222,7 @@ paths:
description: The identifier for a certain concept or collection.
required: true
schema:
type: integer
type: string

responses:
200:
Expand Down Expand Up @@ -692,7 +692,7 @@ paths:
description: The identifier for a certain concept or collection.
required: true
schema:
type: integer
type: string
- name: language
in: query
description: Returns the label with the corresponding language-tag if present.
Expand Down Expand Up @@ -748,7 +748,7 @@ paths:
description: The identifier for a certain concept or collection.
required: true
schema:
type: integer
type: string
responses:
200:
description: The concept/collection was found in the conceptscheme.
Expand Down Expand Up @@ -900,7 +900,7 @@ components:
type: object
properties:
id:
type: integer
type: string
Label:
type: object
properties:
Expand Down Expand Up @@ -952,7 +952,7 @@ components:
type: object
properties:
id:
type: integer
type: string
type:
type: string
labels:
Expand Down Expand Up @@ -990,7 +990,7 @@ components:
- type: object
properties:
id:
type: integer
type: string
uri:
type: string
ConceptTree:
Expand Down
6 changes: 3 additions & 3 deletions atramhasis/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ def _add_provider(graph, provider, dataseturi, request):
graph.add((dataseturi, VOID.subset, pd))
graph.add((pd, DCTERMS.identifier, Literal(pid)))
graph.add((pd, VOID.rootResource, URIRef(provider.concept_scheme.uri)))
graph.add((pd, FOAF.homepage, URIRef(request.route_url('conceptscheme', scheme_id=pid))))
graph.add((pd, FOAF.homepage, URIRef(request.route_url('skosprovider.conceptscheme', scheme_id=pid))))
_add_labels(graph, provider.concept_scheme, pd)
_add_metadataset(graph, pd, metadataset)
fmap = [
('rdf', FORMATS.RDF_XML, 'atramhasis.rdf_full_export_ext'),
('ttl', FORMATS.Turtle, 'atramhasis.rdf_full_export_turtle_ext')
('rdf', FORMATS.RDF_XML, 'skosprovider.conceptscheme.cs.rdf'),
('ttl', FORMATS.Turtle, 'skosprovider.conceptscheme.cs.ttl')
]
for f in fmap:
graph.add((pd, VOID.feature, f[1]))
Expand Down
67 changes: 17 additions & 50 deletions atramhasis/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,22 @@ def includeme(config):
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route("sitemap", "/sitemap_index.xml")

# APIs with extensions instead of accept headers
config.add_route('atramhasis.rdf_void_turtle_ext', pattern='/void.ttl', accept='text/turtle')
config.add_route('atramhasis.rdf_full_export_ext', pattern='/conceptschemes/{scheme_id}/c.rdf')
config.add_route('atramhasis.rdf_full_export_turtle_ext', pattern='/conceptschemes/{scheme_id}/c.ttl')
config.add_route('atramhasis.rdf_conceptscheme_export_ext', pattern='/conceptschemes/{scheme_id}.rdf')
config.add_route('atramhasis.rdf_conceptscheme_export_turtle_ext', pattern='/conceptschemes/{scheme_id}.ttl')
config.add_route('atramhasis.rdf_individual_export_ext', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}.rdf')
config.add_route('atramhasis.rdf_individual_export_turtle_ext', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}.ttl')
config.add_route('atramhasis.rdf_conceptscheme_jsonld_ext', pattern='/conceptschemes/{scheme_id}.jsonld')
config.add_route('atramhasis.rdf_individual_jsonld_ext', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}.jsonld')
# The routes below extend the existing skosprovider routes with extensions
config.add_route('skosprovider.conceptscheme.cs.rdf', pattern='/conceptschemes/{scheme_id}/c.rdf')
config.add_route('skosprovider.conceptscheme.cs.ttl', pattern='/conceptschemes/{scheme_id}/c.ttl')
config.add_route('skosprovider.conceptscheme.rdf', pattern='/conceptschemes/{scheme_id}.rdf')
config.add_route('skosprovider.conceptscheme.ttl', pattern='/conceptschemes/{scheme_id}.ttl')
config.add_route('skosprovider.conceptscheme.csv', pattern='/conceptschemes/{scheme_id}/c.csv')
config.add_route('skosprovider.c.rdf', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}.rdf')
config.add_route('skosprovider.c.ttl', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}.ttl')

config.add_route('conceptschemes', pattern='/conceptschemes', accept='text/html', request_method="GET")
config.add_route('conceptscheme', pattern='/conceptschemes/{scheme_id}', accept='text/html', request_method="GET")
config.add_route('concept', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}', accept='text/html',
request_method="GET")
config.add_route('search_result', pattern='/conceptschemes/{scheme_id}/c', accept='text/html')
config.add_route('scheme_root', pattern='/conceptschemes/{scheme_id}/c/', accept='text/html')
# tree
config.add_route('scheme_tree_html', pattern='/conceptschemes/{scheme_id}/tree', accept='text/html')
config.add_route('scheme_tree', pattern='/conceptschemes/{scheme_id}/tree', accept='application/json')

config.add_route('search_result_export', pattern='/conceptschemes/{scheme_id}/c.csv')
config.add_route('atramhasis.edit_conceptscheme', pattern='/conceptschemes/{scheme_id}',
accept='application/json', request_method='PUT')
config.add_route('atramhasis.get_conceptscheme', pattern='/conceptschemes/{scheme_id}', accept='application/json')
config.add_route('atramhasis.get_conceptschemes', pattern='/conceptschemes', accept='application/json')
config.add_route('atramhasis.get_concept', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}',
accept='application/json', request_method="GET")
config.add_route('atramhasis.add_concept', pattern='/conceptschemes/{scheme_id}/c', accept='application/json',
request_method="POST")
config.add_route('atramhasis.edit_concept', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}',
accept='application/json', request_method="PUT")
config.add_route('atramhasis.delete_concept', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}',
accept='application/json', request_method="DELETE")
# language
config.add_route('atramhasis.list_languages', pattern='/languages', accept='application/json',
request_method="GET")
config.add_route('atramhasis.get_language', pattern='/languages/{l_id}', accept='application/json',
Expand All @@ -68,33 +52,16 @@ def includeme(config):
config.add_route('atramhasis.delete_language', pattern='/languages/{l_id}', accept='application/json',
request_method="DELETE")
config.add_route('locale', '/locale')
config.add_route('labeltypes', '/labeltypes', accept='application/json', request_method="GET")
config.add_route('notetypes', '/notetypes', accept='application/json', request_method="GET")

# admin
config.add_route('admin', '/admin')
config.add_route('scheme_tree_invalidate', pattern='/admin/tree/invalidate/{scheme_id}', accept='application/json')
config.add_route('tree_invalidate', pattern='/admin/tree/invalidate', accept='application/json')

config.add_route('atramhasis.rdf_full_export_turtle', pattern='/conceptschemes/{scheme_id}/c', accept='text/turtle')
config.add_route('atramhasis.rdf_full_export_turtle_x', pattern='/conceptschemes/{scheme_id}/c',
accept='application/x-turtle')
config.add_route('atramhasis.rdf_full_export', pattern='/conceptschemes/{scheme_id}/c',
accept='application/rdf+xml')
config.add_route('atramhasis.rdf_conceptscheme_export', pattern='/conceptschemes/{scheme_id}',
accept='application/rdf+xml')
config.add_route('atramhasis.rdf_conceptscheme_export_turtle', pattern='/conceptschemes/{scheme_id}',
accept='text/turtle')
config.add_route('atramhasis.rdf_conceptscheme_export_turtle_x', pattern='/conceptschemes/{scheme_id}',
accept='application/x-turtle')
config.add_route('atramhasis.rdf_individual_export', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}',
accept='application/rdf+xml')
config.add_route('atramhasis.rdf_individual_export_turtle', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}',
accept='text/turtle')
config.add_route('atramhasis.rdf_individual_export_turtle_x', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}',
accept='application/x-turtle')
config.add_route('atramhasis.rdf_conceptscheme_jsonld', pattern='/conceptschemes/{scheme_id}',
accept='application/ld+json')
config.add_route('atramhasis.rdf_individual_jsonld', pattern='/conceptschemes/{scheme_id}/c/{c_id:.*}',
accept='application/ld+json')
# providers
config.add_route('atramhasis.providers', pattern='/providers')
config.add_route('atramhasis.provider', pattern='/providers/{id}')

# other
config.add_route('labeltypes', '/labeltypes', accept='application/json', request_method="GET")
config.add_route('notetypes', '/notetypes', accept='application/json', request_method="GET")
4 changes: 2 additions & 2 deletions atramhasis/static/admin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion atramhasis/static/admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "atramhasis",
"version": "2.1.0",
"version": "2.1.1",
"description": "Node packages for building Atramhasis.",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,18 @@ define([
'sticky': false,
'channel': 'info'
});
this._reset(true);
this.parentNode.refresh_conceptschemes();
// Update the provider lists with the new data
this.providerController.loadProviders().then(lang.hitch(this, function() {
this._reset(true);
this.parentNode.refresh_conceptschemes();
}), lang.hitch(this, function (error) {
var message = this._parseError(error);
topic.publish('dGrowl', message, {
'title': 'Error updating provider list',
'sticky': true,
'channel': 'error'
});
}));
}),
lang.hitch(this, function (error) {
var message = this._parseError(error);
Expand All @@ -372,7 +382,17 @@ define([
'sticky': false,
'channel': 'info'
});
this._reset();
// Update the provider lists with the updated data
this.providerController.loadProviders().then(lang.hitch(this, function() {
this._reset();
}), lang.hitch(this, function (error) {
var message = this._parseError(error);
topic.publish('dGrowl', message, {
'title': 'Error updating provider list',
'sticky': true,
'channel': 'error'
});
}));
}),
lang.hitch(this, function (error) {
var message = this._parseError(error);
Expand Down
4 changes: 2 additions & 2 deletions atramhasis/static/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion atramhasis/static/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "atramhasis",
"version": "2.1.0",
"version": "2.1.1",
"description": "Node packages for public part of Atramhasis.",
"repository": {
"type": "git",
Expand Down
12 changes: 6 additions & 6 deletions atramhasis/templates/concept.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% block head %}
{{ super() }}
<meta name="og:type" content="website" />
<meta name="og:url" content="{{ request.route_url('concept', scheme_id=scheme_id, c_id=concept.concept_id) }}" />
<meta name="og:url" content="{{ request.route_url('skosprovider.c', scheme_id=scheme_id, c_id=concept.concept_id) }}" />
<meta name="og:title" content="{{ concept.label(locale).label|safe }}" />
{% if concept.notes|length > 0 %}
<meta name="og:description" content="{{ concept.notes[0]|safe }}" />
Expand All @@ -13,7 +13,7 @@
{% if concept.notes|length > 0 %}
<meta name="twitter:description" content="{{ concept.notes[0]|safe }}" />
{% endif %}
<link rel="canonical" href="{{ request.route_url('concept', scheme_id=scheme_id, c_id=concept.concept_id) }}" />
<link rel="canonical" href="{{ request.route_url('skosprovider.c', scheme_id=scheme_id, c_id=concept.concept_id) }}" />
{% endblock %}
{% block html_title %}{{ concept.label(locale).label|title }}{% endblock %}

Expand All @@ -31,9 +31,9 @@
<div class="clearfix">
<ul class="downloadtop right">
<li>DOWNLOAD</li>
<li><a href="{{ request.route_path('atramhasis.rdf_individual_export_ext', scheme_id=scheme_id, c_id=concept.concept_id) }}">RDF/XML</a></li>
<li><a href="{{ request.route_path('atramhasis.rdf_individual_jsonld_ext', scheme_id=scheme_id, c_id=concept.concept_id) }}">JSON-LD</a></li>
<li><a href="{{ request.route_path('atramhasis.rdf_individual_export_turtle_ext', scheme_id=scheme_id, c_id=concept.concept_id) }}">N3/Turtle</a></li>
<li><a href="{{ request.route_path('skosprovider.c.rdf', scheme_id=scheme_id, c_id=concept.concept_id) }}">RDF/XML</a></li>
<li><a href="{{ request.route_path('skosprovider.c.jsonld', scheme_id=scheme_id, c_id=concept.concept_id) }}">JSON-LD</a></li>
<li><a href="{{ request.route_path('skosprovider.c.ttl', scheme_id=scheme_id, c_id=concept.concept_id) }}">N3/Turtle</a></li>
</ul>
</div>
{% if concept %}
Expand All @@ -53,7 +53,7 @@
<dd class="word-wrap-element"><a href="{{ concept.uri }}">{{ concept.uri }}</a></dd>
{% endif %}
<dt>schema</dt>
<dd><a href="{{ request.route_path('conceptscheme', scheme_id=scheme_id) }}">{{ get_conceptscheme_label(concept.conceptscheme, request.locale_name) }}</a></dd>
<dd><a href="{{ request.route_path('skosprovider.conceptscheme', scheme_id=scheme_id) }}">{{ get_conceptscheme_label(concept.conceptscheme, request.locale_name) }}</a></dd>
{% if concept.labels %}
{{ print_labels(concept.labels) }}
{% endif %}
Expand Down
Loading

0 comments on commit 85b85c4

Please sign in to comment.