Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
seda
Commits
4cec18e07edf
Commit
1fa37c0a
authored
Oct 14, 2016
by
Sylvain Thénault
Browse files
Minor refactoring of initial schemes import code to ease overriding
by e.g. saem_ref which want to assign ark to created schemes.
parent
ece22f65f9e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
dataimport.py
View file @
4cec18e0
...
...
@@ -105,6 +105,11 @@ def lcsv_check(cnx, store, fname, scheme_uri):
list
(
lcsv2rdf
.
triples
())
def
init_seda_scheme
(
cnx
,
title
):
description
=
u
'edition 2009'
if
title
.
startswith
(
'SEDA :'
)
else
None
return
cnx
.
create_entity
(
'ConceptScheme'
,
title
=
title
,
description
=
description
)
def
import_seda_schemes
(
cnx
,
lcsv_import
=
lcsv_import
):
"""Import all LCSV data files defined in LCSV_FILES"""
if
cnx
.
repo
.
system_source
.
dbdriver
==
'postgres'
:
...
...
@@ -116,9 +121,7 @@ def import_seda_schemes(cnx, lcsv_import=lcsv_import):
for
title
,
rtypes
,
etypes
,
fname
in
LCSV_FILES
:
if
not
cnx
.
find
(
'ConceptScheme'
,
title
=
title
):
print
(
'importing'
,
title
.
encode
(
'utf-8'
))
description
=
u
'edition 2009'
if
title
.
startswith
(
'SEDA :'
)
else
None
scheme
=
cnx
.
create_entity
(
'ConceptScheme'
,
title
=
title
,
description
=
description
)
scheme
=
init_seda_scheme
(
cnx
,
title
)
lcsv_import
(
cnx
,
store
,
fname
,
scheme
.
cwuri
)
if
not
isinstance
(
rtypes
,
tuple
):
rtypes
=
(
rtypes
,)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment