Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
f21c7122
Commit
f21c7122
authored
May 29, 2017
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] ISIDORE/SPARQLE fix duplicates in scan and corpus building. Improving query with date desc.
parent
dce1e317
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
20 deletions
+26
-20
bool2sparql-exe
gargantext/util/crawlers/sparql/bool2sparql-exe
+0
-0
bool2sparql.py
gargantext/util/crawlers/sparql/bool2sparql.py
+1
-1
ISIDORE.py
gargantext/util/parsers/ISIDORE.py
+25
-19
No files found.
gargantext/util/crawlers/sparql/bool2sparql-exe
View file @
f21c7122
No preview for this file type
gargantext/util/crawlers/sparql/bool2sparql.py
View file @
f21c7122
...
...
@@ -49,7 +49,7 @@ def isidore(query, count=False, offset=None, limit=None):
for
r
in
results
:
doc
=
dict
()
doc_values
=
dict
()
doc
[
"url"
],
doc
[
"
id"
],
doc
[
"
title"
],
doc
[
"date"
],
doc
[
"abstract"
],
doc
[
"source"
]
=
r
doc
[
"url"
],
doc
[
"title"
],
doc
[
"date"
],
doc
[
"abstract"
],
doc
[
"source"
]
=
r
for
k
in
doc
.
keys
():
doc_values
[
k
]
=
doc
[
k
]
.
value
...
...
gargantext/util/parsers/ISIDORE.py
View file @
f21c7122
...
...
@@ -31,6 +31,8 @@ class IsidoreParser(Parser):
,
"source"
:
"source"
}
uniq_id
=
set
()
for
doc
in
json_docs
:
hyperdata
=
{}
...
...
@@ -38,27 +40,31 @@ class IsidoreParser(Parser):
for
key
,
path
in
hyperdata_path
.
items
():
hyperdata
[
key
]
=
doc
.
get
(
path
,
""
)
# Source is the Journal Name
hyperdata
[
"source"
]
=
doc
.
get
(
"journal"
,
"ISIDORE Database"
)
# Working on the date
maybeDate
=
doc
.
get
(
"date"
,
None
)
if
hyperdata
[
"url"
]
not
in
uniq_id
:
# Removing the duplicates implicitly
uniq_id
.
add
(
hyperdata
[
"url"
])
# Source is the Journal Name
hyperdata
[
"source"
]
=
doc
.
get
(
"journal"
,
"ISIDORE Database"
)
# Working on the date
maybeDate
=
doc
.
get
(
"date"
,
None
)
if
maybeDate
is
None
:
date
=
datetime
.
now
()
else
:
try
:
# Model of date: 1958-01-01T00:00:00
date
=
datetime
.
strptime
(
maybeDate
,
'
%
Y-
%
m-
%
dT
%
H:
%
M:
%
S'
)
except
:
print
(
"FIX DATE ISIDORE please >
%
s<"
%
maybeDate
)
if
maybeDate
is
None
:
date
=
datetime
.
now
()
else
:
try
:
# Model of date: 1958-01-01T00:00:00
date
=
datetime
.
strptime
(
maybeDate
,
'
%
Y-
%
m-
%
dT
%
H:
%
M:
%
S'
)
except
:
print
(
"FIX DATE ISIDORE please >
%
s<"
%
maybeDate
)
date
=
datetime
.
now
()
hyperdata
[
"publication_date"
]
=
date
hyperdata
[
"publication_year"
]
=
str
(
date
.
year
)
hyperdata
[
"publication_month"
]
=
str
(
date
.
month
)
hyperdata
[
"publication_day"
]
=
str
(
date
.
day
)
hyperdata_list
.
append
(
hyperdata
)
hyperdata
[
"publication_date"
]
=
date
hyperdata
[
"publication_year"
]
=
str
(
date
.
year
)
hyperdata
[
"publication_month"
]
=
str
(
date
.
month
)
hyperdata
[
"publication_day"
]
=
str
(
date
.
day
)
hyperdata_list
.
append
(
hyperdata
)
return
hyperdata_list
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