Skip to content

Commit

Permalink
Update skosprovider_sqlalchemy
Browse files Browse the repository at this point in the history
  • Loading branch information
Wim-De-Clercq committed May 2, 2023
1 parent ce8d02a commit 1aceda4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion atramhasis/scripts/import_file.py
Expand Up @@ -226,7 +226,7 @@ def provider_to_db(provider, conceptscheme, session):
import provider data into the database
"""
session.add(conceptscheme)
import_provider(provider, conceptscheme, session)
import_provider(provider, session, conceptscheme)
session.commit()


Expand Down
18 changes: 9 additions & 9 deletions atramhasis/scripts/initializedb.py
Expand Up @@ -37,6 +37,7 @@ def main(argv=sys.argv):
db_session = sessionmaker(bind=engine)()
import_provider(
trees,
db_session,
ConceptScheme(
id=1,
uri='urn:x-skosprovider:trees',
Expand All @@ -45,10 +46,10 @@ def main(argv=sys.argv):
Label('Different types of trees', 'prefLabel', 'en')
]
),
db_session
)
import_provider(
geo,
db_session,
ConceptScheme(
id=2,
uri='urn:x-skosprovider:geo',
Expand All @@ -57,10 +58,10 @@ def main(argv=sys.argv):
Label('Geography', 'prefLabel', 'en')
]
),
db_session
)
import_provider(
styles_and_cultures,
db_session,
ConceptScheme(
id=3,
uri='https://id.erfgoed.net/thesauri/stijlen_en_culturen',
Expand All @@ -69,10 +70,10 @@ def main(argv=sys.argv):
Label('Styles and Cultures', 'prefLabel', 'en')
]
),
db_session
)
import_provider(
materials,
db_session,
ConceptScheme(
id=4,
uri='https://id.erfgoed.net/thesauri/materialen',
Expand All @@ -81,10 +82,10 @@ def main(argv=sys.argv):
Label('Materials', 'prefLabel', 'en')
]
),
db_session
)
import_provider(
eventtypes,
db_session,
ConceptScheme(
id=5,
uri='https://id.erfgoed.net/thesauri/gebeurtenistypes',
Expand All @@ -93,10 +94,10 @@ def main(argv=sys.argv):
Label('Event types', 'prefLabel', 'en')
]
),
db_session
)
import_provider(
heritagetypes,
db_session,
ConceptScheme(
id=6,
uri='https://id.erfgoed.net/thesauri/erfgoedtypes',
Expand All @@ -105,10 +106,10 @@ def main(argv=sys.argv):
Label('Heritage types', 'prefLabel', 'en')
]
),
db_session
)
import_provider(
periods,
db_session,
ConceptScheme(
id=7,
uri='https://id.erfgoed.net/thesauri/dateringen',
Expand All @@ -117,10 +118,10 @@ def main(argv=sys.argv):
Label('Periods', 'prefLabel', 'en')
]
),
db_session
)
import_provider(
species,
db_session,
ConceptScheme(
id=8,
uri='https://id.erfgoed.net/thesauri/soorten',
Expand All @@ -129,10 +130,10 @@ def main(argv=sys.argv):
Label('Species', 'prefLabel', 'en')
]
),
db_session
)
import_provider(
bluebirds,
db_session,
ConceptScheme(
id=9,
uri='https://id.bluebirds.org',
Expand All @@ -141,7 +142,6 @@ def main(argv=sys.argv):
Label('Blue birds', 'prefLabel', 'en')
]
),
db_session
)
db_session.commit()
db_session.close()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -7,7 +7,7 @@ openapi-spec-validator==0.4.0 # https://github.com/p1c2u/openapi-core/issues/44

# skosprovider
skosprovider==1.2.0
skosprovider_sqlalchemy==2.0.1
skosprovider_sqlalchemy==2.1.1
pyramid_skosprovider==1.2.0
skosprovider_rdf==1.3.0
skosprovider_getty==1.1.0
Expand Down
19 changes: 10 additions & 9 deletions tests/__init__.py
Expand Up @@ -78,14 +78,14 @@ def fill_db():
from skosprovider_sqlalchemy.models import ConceptScheme
with db_session() as session:
import_provider(trees,
ConceptScheme(id=1, uri='urn:x-skosprovider:trees'),
session)
session,
ConceptScheme(id=1, uri='urn:x-skosprovider:trees'))
import_provider(material_data.materials,
ConceptScheme(id=4, uri='urn:x-vioe:materials'),
session)
session,
ConceptScheme(id=4, uri='urn:x-vioe:materials'))
import_provider(data.geo,
ConceptScheme(id=2, uri='urn:x-vioe:geography'),
session)
session,
ConceptScheme(id=2, uri='urn:x-vioe:geography'))
import_provider(
DictionaryProvider(
{'id': 'MISSING_LABEL', 'default_language': 'nl'},
Expand All @@ -98,8 +98,9 @@ def fill_db():
],
}]
),
ConceptScheme(id=9, uri='urn:x-vioe:test'),
session)
session,
ConceptScheme(id=9, uri='urn:x-vioe:test')
)
import_provider(
DictionaryProvider(
{'id': 'manual-ids', 'default_language': 'nl'},
Expand All @@ -119,8 +120,8 @@ def fill_db():
],
}]
),
ConceptScheme(id=10, uri='urn:x-vioe:manual'),
session,
ConceptScheme(id=10, uri='urn:x-vioe:manual'),
)
session.add(ConceptScheme(id=3, uri='urn:x-vioe:styles'))
for scheme_id in (5, 6, 7, 8):
Expand Down

0 comments on commit 1aceda4

Please sign in to comment.