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
skos
Commits
922de1bbdf39
Commit
ea23e4da
authored
Nov 28, 2017
by
Denis Laxalde
Browse files
Set default value of "encoding" parameter of LCSV2RDF to 'utf-8'
parent
e882f62c4c6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
lcsv.py
View file @
922de1bb
...
...
@@ -38,7 +38,7 @@ class LCSV2RDF(object):
reference : W3C unofficial draft, http://jenit.github.io/linked-csv/
"""
def
__init__
(
self
,
stream
,
delimiter
,
encoding
,
def
__init__
(
self
,
stream
,
delimiter
,
encoding
=
'utf-8'
,
uri_generator
=
None
,
uri_cls
=
text_type
,
default_lang
=
None
):
""" check stream validity and init attribute"""
self
.
source_file
=
ucsvreader
(
stream
,
encoding
=
encoding
,
delimiter
=
delimiter
)
...
...
sobjects.py
View file @
922de1bb
...
...
@@ -156,7 +156,7 @@ class SKOSParser(datafeed.DataFeedParser):
source
=
self
.
source
,
raise_on_error
=
raise_on_error
,
**
kwargs
)
def
lcsv_extentities
(
stream
,
scheme_uri
,
delimiter
,
encoding
,
language_code
=
None
):
def
lcsv_extentities
(
stream
,
scheme_uri
,
delimiter
,
encoding
=
'utf-8'
,
language_code
=
None
):
"""Return external entities generator from SKOS LCSV stream or URL (by transforming it to RDF
first).
...
...
@@ -171,7 +171,7 @@ def lcsv_extentities(stream, scheme_uri, delimiter, encoding, language_code=None
"""
graph
=
rdfio
.
RDFLibRDFGraph
()
# add LCSV statements to the RDF graph
lcsv2rdf
=
lcsv
.
LCSV2RDF
(
stream
,
delimiter
,
encoding
,
default_lang
=
language_code
,
lcsv2rdf
=
lcsv
.
LCSV2RDF
(
stream
,
delimiter
,
encoding
=
encoding
,
default_lang
=
language_code
,
uri_cls
=
graph
.
uri
,
uri_generator
=
lambda
x
:
str
(
uuid4
())
+
x
)
for
(
subj
,
pred
,
obj
)
in
lcsv2rdf
.
triples
():
graph
.
add
(
subj
,
pred
,
obj
)
...
...
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