Skip to content

Commit

Permalink
Update demo scaffold. Refs #490
Browse files Browse the repository at this point in the history
  • Loading branch information
koenedaele committed May 20, 2020
1 parent a190f85 commit 518b2ed
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ def main(global_config, **settings):
# Set up atramhasis db
config.include('atramhasis:data.db')

#Add skos support
config.include('{{package}}.skos')

# Set up translations
config.add_translation_dirs('{{package}}:locale/')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,39 @@

import logging

from skosprovider.registry import Registry
from skosprovider.uri import UriPatternGenerator
from skosprovider_sqlalchemy.providers import SQLAlchemyProvider

from skosprovider_getty.providers import AATProvider, TGNProvider
from skosprovider_heritagedata.providers import HeritagedataProvider

from skosprovider_sqlalchemy.providers import SQLAlchemyProvider

import requests
from cachecontrol import CacheControl
from cachecontrol.heuristics import ExpiresAfter

from datetime import date

log = logging.getLogger(__name__)
LICENSES = [
'https://creativecommons.org/licenses/by/4.0/',
'http://data.vlaanderen.be/doc/licentie/modellicentie-gratis-hergebruik/v1.0'
]


def includeme(config):
def create_registry(request):
registry = Registry(instance_scope='threaded_thread')

dataseturigenerator = UriPatternGenerator('https://id.erfgoed.net/datasets/thesauri/%s')

TREES = SQLAlchemyProvider(
{'id': 'TREES', 'conceptscheme_id': 1},
config.registry.dbmaker
request.db
)

GEO = SQLAlchemyProvider(
{'id': 'GEOGRAPHY', 'conceptscheme_id': 2},
config.registry.dbmaker
request.db
)

STYLES = SQLAlchemyProvider(
Expand All @@ -40,13 +46,10 @@ def includeme(config):
'publisher': ['https://id.erfgoed.net/actoren/501'],
'created': [date(2008,2,14)],
'language': ['nl-BE'],
'license': [
'https://creativecommons.org/licenses/by/4.0/',
'http://data.vlaanderen.be/doc/licentie/modellicentie-gratis-hergebruik/v1.0'
]
'license': LICENSES
}
},
config.registry.dbmaker,
request.db,
uri_generator=UriPatternGenerator('https://id.erfgoed.net/thesauri/stijlen_en_culturen/%s')
)

Expand All @@ -59,13 +62,10 @@ def includeme(config):
'publisher': ['https://id.erfgoed.net/actoren/501'],
'created': [date(2011,3,16)],
'language': ['nl-BE'],
'license': [
'https://creativecommons.org/licenses/by/4.0/',
'http://data.vlaanderen.be/doc/licentie/modellicentie-gratis-hergebruik/v1.0'
]
'license': LICENSES
}
},
config.registry.dbmaker,
request.db,
uri_generator=UriPatternGenerator('https://id.erfgoed.net/thesauri/materialen/%s')
)

Expand All @@ -78,13 +78,10 @@ def includeme(config):
'publisher': ['https://id.erfgoed.net/actoren/501'],
'created': [date(2010,8,13)],
'language': ['nl-BE'],
'license': [
'https://creativecommons.org/licenses/by/4.0/',
'http://data.vlaanderen.be/doc/licentie/modellicentie-gratis-hergebruik/v1.0'
]
'license': LICENSES
}
},
config.registry.dbmaker,
request.db,
uri_generator=UriPatternGenerator('https://id.erfgoed.net/thesauri/gebeurtenistypes/%s')
)

Expand All @@ -97,13 +94,10 @@ def includeme(config):
'publisher': ['https://id.erfgoed.net/actoren/501'],
'created': [date(2008,2,14)],
'language': ['nl-BE'],
'license': [
'https://creativecommons.org/licenses/by/4.0/',
'http://data.vlaanderen.be/doc/licentie/modellicentie-gratis-hergebruik/v1.0'
]
'license': LICENSES
}
},
config.registry.dbmaker,
request.db,
uri_generator=UriPatternGenerator('https://id.erfgoed.net/thesauri/erfgoedtypes/%s')
)

Expand All @@ -116,13 +110,10 @@ def includeme(config):
'publisher': ['https://id.erfgoed.net/actoren/501'],
'created': [date(2008,2,14)],
'language': ['nl-BE'],
'license': [
'https://creativecommons.org/licenses/by/4.0/',
'http://data.vlaanderen.be/doc/licentie/modellicentie-gratis-hergebruik/v1.0'
]
'license': LICENSES
}
},
config.registry.dbmaker,
request.db,
uri_generator=UriPatternGenerator('https://id.erfgoed.net/thesauri/dateringen/%s')
)

Expand All @@ -135,13 +126,10 @@ def includeme(config):
'publisher': ['https://id.erfgoed.net/actoren/501'],
'created': [date(2011,5,23)],
'language': ['nl-BE', 'la'],
'license': [
'https://creativecommons.org/licenses/by/4.0/',
'http://data.vlaanderen.be/doc/licentie/modellicentie-gratis-hergebruik/v1.0'
]
'license': LICENSES
}
},
config.registry.dbmaker,
request.db,
uri_generator=UriPatternGenerator('https://id.erfgoed.net/thesauri/soorten/%s')
)

Expand Down Expand Up @@ -173,16 +161,16 @@ def includeme(config):
session=eh_session
)

skosregis = config.get_skos_registry()
skosregis.register_provider(TREES)
skosregis.register_provider(GEO)
skosregis.register_provider(STYLES)
skosregis.register_provider(MATERIALS)
skosregis.register_provider(EVENTTYPES)
skosregis.register_provider(HERITAGETYPES)
skosregis.register_provider(PERIODS)
skosregis.register_provider(SPECIES)
skosregis.register_provider(AAT)
skosregis.register_provider(TGN)
skosregis.register_provider(EH_PERIOD)
skosregis.register_provider(EH_MONUMENT_TYPE)
registry.register_provider(TREES)
registry.register_provider(GEO)
registry.register_provider(STYLES)
registry.register_provider(MATERIALS)
registry.register_provider(EVENTTYPES)
registry.register_provider(HERITAGETYPES)
registry.register_provider(PERIODS)
registry.register_provider(SPECIES)
registry.register_provider(AAT)
registry.register_provider(TGN)
registry.register_provider(EH_PERIOD)
registry.register_provider(EH_MONUMENT_TYPE)
return registry
3 changes: 3 additions & 0 deletions atramhasis/scaffolds/atramhasis_demo/development.ini_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ sqlalchemy.url = sqlite:///%(here)s/{{package}}.sqlite

atramhasis.session_factory.secret = test123

skosprovider.skosregistry_location = request
skosprovider.skosregistry_factory = {{package}}.skos.create_registry

jinja2.i18n.domain = atramhasis

# Run dojo from source (src) or distribution (dist)
Expand Down
3 changes: 3 additions & 0 deletions atramhasis/scaffolds/atramhasis_scaffold/development.ini_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ sqlalchemy.url = sqlite:///%(here)s/{{package}}.sqlite

atramhasis.session_factory.secret = test123

skosprovider.skosregistry_location = request
skosprovider.skosregistry_factory = {{package}}.skos.create_registry

# cache
cache.tree.backend = dogpile.cache.memory
cache.tree.arguments.cache_size = 5000
Expand Down

0 comments on commit 518b2ed

Please sign in to comment.