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
738e3f39
Commit
738e3f39
authored
Jul 18, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph Explorer] More informations to the user.
parent
42871df2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
15 deletions
+32
-15
graph.py
graph/graph.py
+2
-2
rest.py
graph/rest.py
+30
-13
No files found.
graph/graph.py
View file @
738e3f39
...
...
@@ -58,7 +58,7 @@ def get_graph( request=None , corpus=None
if
mapList_size
.
count
()
<
graph_constraints
[
'mapList'
]:
# Do not compute the graph if mapList is not big enough
return
{
'nodes'
:[],
'links'
:[
0
,
0
,
0
]}
return
{
'nodes'
:[
mapList_size
.
count
()
],
'links'
:[
0
,
0
,
0
]}
# case of corpus not big enough
...
...
@@ -119,7 +119,7 @@ def get_graph( request=None , corpus=None
elif
corpus_size_query
.
count
()
<=
graph_constraints
[
'corpusMin'
]:
# Do not compute the graph if corpus is not big enough
return
{
'nodes'
:[],
'links'
:[
0
,
0
]}
return
{
'nodes'
:[
corpus_size_query
.
count
()
],
'links'
:[
0
,
0
]}
else
:
# If graph_constraints are ok then compute the graph in live
...
...
graph/rest.py
View file @
738e3f39
...
...
@@ -143,7 +143,9 @@ class Graph(APIView):
# Test data length
if
len
(
data
[
'nodes'
])
>
1
and
len
(
data
[
'links'
])
>
1
:
# A graph needs more than 3 nodes and 3 links
# Others graphs are used to check the errors
if
len
(
data
[
'nodes'
])
>
3
and
len
(
data
[
'links'
])
>
3
:
# normal case --------------------------------
if
format_
==
'json'
:
return
JsonHttpResponse
(
...
...
@@ -152,37 +154,52 @@ class Graph(APIView):
)
# --------------------------------------------
elif
len
(
data
[
'nodes'
])
==
0
and
len
(
data
[
'links'
])
==
2
:
elif
len
(
data
[
'nodes'
])
==
1
and
len
(
data
[
'links'
])
==
2
:
# async data case
return
JsonHttpResponse
({
'msg'
:
'''Your corpus is too small.
Add more documents (more than
%
d documents)
'msg'
:
'''Problem: your corpus is too small (only
%
d documents).
Solution: Add more documents (more than
%
d documents)
in order to get a graph.
You can manage your corpus here:
http://
%
sgargantext.org/projects/
%
d/
'''
%
(
graph_constraints
[
'corpusMin'
],
"dev."
,
corpus
.
parent_id
),
'''
%
(
data
[
'nodes'
][
0
]
,
graph_constraints
[
'corpusMin'
]
,
"dev."
,
corpus
.
parent_id
),
},
status
=
400
)
elif
len
(
data
[
'nodes'
])
==
0
and
len
(
data
[
'links'
])
==
3
:
elif
len
(
data
[
'nodes'
])
==
1
and
len
(
data
[
'links'
])
==
3
:
# async data case
return
JsonHttpResponse
({
'msg'
:
'''Your map list is too small.
Add some terms (more than
%
d terms)
'msg'
:
'''Problem: your map list is too small (currently
%
d terms).
Solution: Add some terms (more than
%
d terms)
in order to get a graph.
You can manage your map terms here:
http://
%
sgargantext.org/projects/
%
d/corpora/
%
d/terms
'''
%
(
graph_constraints
[
'mapList'
],
"dev."
,
corpus
.
parent_id
,
corpus
.
id
),
'''
%
(
data
[
'nodes'
][
0
]
,
graph_constraints
[
'mapList'
]
,
"dev."
,
corpus
.
parent_id
,
corpus
.
id
),
},
status
=
400
)
elif
len
(
data
[
'nodes'
])
==
0
and
len
(
data
[
'links'
])
==
1
:
elif
len
(
data
[
'nodes'
])
==
0
and
len
(
data
[
'links'
])
==
0
:
# async data case
return
JsonHttpResponse
({
'msg'
:
'''Async graph generation
Wait a while and discover your graph
'msg'
:
'''Warning: Async graph generation.
Wait a while and discover your graph very soon.
Click on the link and see your current graph
processing on top of the list:
http://
%
sgargantext.org/projects/
%
d/corpora/
%
d/myGraph
'''
%
(
"dev."
,
corpus
.
parent_id
,
corpus
.
id
),
},
status
=
400
)
...
...
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