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
fb990118
Commit
fb990118
authored
Mar 16, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Api and init_gargantext
parent
8f19771d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
26 deletions
+26
-26
api.py
gargantext_web/api.py
+1
-1
init_gargantext.py
init_gargantext.py
+25
-25
No files found.
gargantext_web/api.py
View file @
fb990118
...
...
@@ -423,7 +423,7 @@ class NodesChildrenQueries(APIView):
)
# starting the query!
document_type_id
=
session
.
query
(
NodeType
.
id
)
.
filter
(
NodeType
.
name
==
'Document'
)
.
scalar
()
document_type_id
=
cache
.
NodeType
[
'Document'
]
.
id
##
session.query(NodeType.id).filter(NodeType.name == 'Document').scalar()
query
=
(
session
.
query
(
*
fields_list
)
.
select_from
(
Node
)
...
...
init_gargantext.py
View file @
fb990118
...
...
@@ -11,18 +11,18 @@ from node.models import *
# Reset: all data
tables_to_empty
=
[
Node
,
Node_Metadata
,
Metadata
,
NodeType
,
ResourceType
,
Resource
,
]
for
table
in
tables_to_empty
:
print
(
'Empty table "
%
s"...'
%
(
table
.
_meta
.
db_table
,
))
table
.
objects
.
all
()
.
delete
()
#
#
tables_to_empty = [
#
Node,
#
Node_Metadata,
#
Metadata,
#
NodeType,
#
ResourceType,
#
Resource,
#
]
#
for table in tables_to_empty:
#
print('Empty table "%s"...' % (table._meta.db_table, ))
#
table.objects.all().delete()
# Integration: metadata types
...
...
@@ -205,19 +205,19 @@ except:
corpus_pubmed
=
Node
(
parent
=
project
,
name
=
'PubMed corpus'
,
type
=
typeCorpus
,
user
=
me
)
corpus_pubmed
.
save
()
print
(
'Initialize resource...'
)
corpus_pubmed
.
add_resource
(
# file='./data_samples/pubmed.zip',
#file='./data_samples/pubmed_2013-04-01_HoneyBeesBeeBees.xml',
file
=
'/srv/gargantext_lib/data_samples/pubmed.xml'
,
type
=
typePubmed
,
user
=
me
)
for
resource
in
corpus_pubmed
.
get_resources
():
print
(
'Resource #
%
d -
%
s -
%
s'
%
(
resource
.
id
,
resource
.
digest
,
resource
.
file
))
# print('Parse corpus #%d...' % (corpus_pubmed.id, ))
#
print('Initialize resource...')
#
corpus_pubmed.add_resource(
#
# file='./data_samples/pubmed.zip',
#
#file='./data_samples/pubmed_2013-04-01_HoneyBeesBeeBees.xml',
#
file='/srv/gargantext_lib/data_samples/pubmed.xml',
#
type=typePubmed,
#
user=me
#
)
#
#
for resource in corpus_pubmed.get_resources():
#
print('Resource #%d - %s - %s' % (resource.id, resource.digest, resource.file))
#
#
#
print('Parse corpus #%d...' % (corpus_pubmed.id, ))
# corpus_pubmed.parse_resources(verbose=True)
# print('Extract corpus #%d...' % (corpus_pubmed.id, ))
# corpus_pubmed.children.all().extract_ngrams(['title',])
...
...
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