Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
20e087cf
Commit
20e087cf
authored
Jan 04, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Database] Cosmetics.
parent
b5925f0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
28 deletions
+0
-28
Flow.hs
src/Gargantext/Database/Flow.hs
+0
-11
Node.hs
src/Gargantext/Database/Schema/Node.hs
+0
-17
No files found.
src/Gargantext/Database/Flow.hs
View file @
20e087cf
...
...
@@ -198,8 +198,6 @@ subFlowAnnuaire username _cName = do
(
username
,
userId
,
rootId
,
corpusId
)
pure
(
userId
,
rootId
,
corpusId
)
------------------------------------------------------------------------
toInsert
::
[
HyperdataDocument
]
->
Map
HashId
HyperdataDocument
toInsert
=
DM
.
fromList
.
map
(
\
d
->
(
maybe
err
identity
(
_hyperdataDocument_uniqId
d
),
d
))
...
...
@@ -223,16 +221,12 @@ mergeData rs = catMaybes . map toDocumentWithId . DM.toList
<*>
Just
hpd
------------------------------------------------------------------------
data
DocumentIdWithNgrams
=
DocumentIdWithNgrams
{
documentWithId
::
!
DocumentWithId
,
document_ngrams
::
!
(
Map
(
NgramsT
Ngrams
)
Int
)
}
deriving
(
Show
)
-- TODO add Terms (Title + Abstract)
-- add f :: Text -> Text
-- newtype Ngrams = Ngrams Text
-- TODO group terms
extractNgramsT
::
HyperdataDocument
->
Cmd
err
(
Map
(
NgramsT
Ngrams
)
Int
)
extractNgramsT
doc
=
do
...
...
@@ -250,7 +244,6 @@ extractNgramsT doc = do
documentIdWithNgrams
::
(
HyperdataDocument
->
Cmd
err
(
Map
(
NgramsT
Ngrams
)
Int
))
->
[
DocumentWithId
]
->
Cmd
err
[
DocumentIdWithNgrams
]
documentIdWithNgrams
f
=
mapM
toDocumentIdWithNgrams
...
...
@@ -272,8 +265,6 @@ indexNgrams ng2nId = do
terms2id
<-
insertNgrams
(
map
_ngramsT
$
DM
.
keys
ng2nId
)
pure
$
DM
.
mapKeys
(
indexNgramsT
terms2id
)
ng2nId
------------------------------------------------------------------------
------------------------------------------------------------------------
flowList
::
HasNodeError
err
=>
UserId
->
CorpusId
->
Map
(
NgramsT
NgramsIndexed
)
(
Map
NodeId
Int
)
->
Cmd
err
ListId
flowList
uId
cId
ngs
=
do
...
...
@@ -324,6 +315,4 @@ insertLists lId lngs =
insertNodeNgrams
[
NodeNgram
Nothing
lId
ngr
(
fromIntegral
$
listTypeId
l
)
(
listTypeId
l
)
|
(
l
,
ngr
)
<-
map
(
second
_ngramsId
)
lngs
]
------------------------------------------------------------------------
------------------------------------------------------------------------
src/Gargantext/Database/Schema/Node.hs
View file @
20e087cf
...
...
@@ -62,11 +62,6 @@ nodeError ne = throwError $ _NodeError # ne
catchNodeError
::
(
MonadError
e
m
,
HasNodeError
e
)
=>
m
a
->
(
NodeError
->
m
a
)
->
m
a
catchNodeError
f
g
=
catchError
f
(
\
e
->
maybe
(
throwError
e
)
g
(
e
^?
_NodeError
))
------------------------------------------------------------------------
type
AnnuaireId
=
Int
type
DocId
=
Int
type
TypeId
=
Int
------------------------------------------------------------------------
instance
FromField
HyperdataAny
where
fromField
=
fromField'
...
...
@@ -140,7 +135,6 @@ instance QueryRunnerColumnDefault PGInt4 (Maybe NodeParentId)
queryRunnerColumnDefault
=
fieldQueryRunnerColumn
------------------------------------------------------------------------
-- WIP
-- TODO Classe HasDefault where
-- default NodeType = Hyperdata
...
...
@@ -166,7 +160,6 @@ type NodeRead = NodePoly (Column PGInt4 )
(
Column
PGTimestamptz
)
(
Column
PGJsonb
)
type
NodeReadNull
=
NodePoly
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
...
...
@@ -212,7 +205,6 @@ type NodeSearchRead = NodePolySearch (Column PGInt4 )
(
Column
PGJsonb
)
(
Column
PGTSVector
)
type
NodeSearchReadNull
=
NodePolySearch
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
...
...
@@ -222,7 +214,6 @@ type NodeSearchReadNull = NodePolySearch (Column (Nullable PGInt4 ))
(
Column
(
Nullable
PGJsonb
))
(
Column
(
Nullable
PGTSVector
))
--{-
nodeTableSearch
::
Table
NodeSearchWrite
NodeSearchRead
nodeTableSearch
=
Table
"nodes"
(
pNodeSearch
NodeSearch
{
_ns_id
=
optional
"id"
...
...
@@ -242,14 +233,12 @@ nodeTableSearch = Table "nodes" (pNodeSearch NodeSearch { _ns_id = optio
queryNodeSearchTable
::
Query
NodeSearchRead
queryNodeSearchTable
=
queryTable
nodeTableSearch
selectNode
::
Column
PGInt4
->
Query
NodeRead
selectNode
id
=
proc
()
->
do
row
<-
queryNodeTable
-<
()
restrict
-<
_node_id
row
.==
id
returnA
-<
row
runGetNodes
::
Query
NodeRead
->
Cmd
err
[
NodeAny
]
runGetNodes
=
runOpaQuery
...
...
@@ -291,20 +280,17 @@ deleteNodes ns = mkCmd $ \conn ->
fromIntegral
<$>
runDelete
conn
nodeTable
(
\
(
Node
n_id
_
_
_
_
_
_
)
->
in_
((
map
pgInt4
ns
))
n_id
)
-- TODO: NodeType should match with `a'
getNodesWith
::
JSONB
a
=>
Int
->
proxy
a
->
Maybe
NodeType
->
Maybe
Offset
->
Maybe
Limit
->
Cmd
err
[
Node
a
]
getNodesWith
parentId
_
nodeType
maybeOffset
maybeLimit
=
runOpaQuery
$
selectNodesWith
parentId
nodeType
maybeOffset
maybeLimit
-- TODO: Why is the second parameter ignored?
-- TODO: Why not use getNodesWith?
getNodesWithParentId
::
Int
->
Maybe
Text
->
Cmd
err
[
NodeAny
]
getNodesWithParentId
n
_
=
runOpaQuery
$
selectNodesWithParentID
n
------------------------------------------------------------------------
getDocumentsV3WithParentId
::
Int
->
Cmd
err
[
Node
HyperdataDocumentV3
]
getDocumentsV3WithParentId
n
=
runOpaQuery
$
selectNodesWith'
n
(
Just
NodeDocument
)
...
...
@@ -342,7 +328,6 @@ getNodesWithType :: Column PGInt4 -> Cmd err [Node HyperdataDocument]
getNodesWithType
=
runOpaQuery
.
selectNodesWithType
------------------------------------------------------------------------
------------------------------------------------------------------------
defaultUser
::
HyperdataUser
defaultUser
=
HyperdataUser
(
Just
$
(
pack
.
show
)
EN
)
...
...
@@ -418,8 +403,6 @@ nodeDashboardW maybeName maybeDashboard pId = node NodeDashboard name dashboard
name
=
maybe
"Dashboard"
identity
maybeName
dashboard
=
maybe
arbitraryDashboard
identity
maybeDashboard
------------------------------------------------------------------------
node
::
(
ToJSON
a
,
Hyperdata
a
)
=>
NodeType
->
Name
->
a
->
Maybe
ParentId
->
UserId
->
NodeWrite
node
nodeType
name
hyperData
parentId
userId
=
Node
Nothing
(
pgInt4
typeId
)
(
pgInt4
userId
)
(
pgInt4
<$>
parentId
)
(
pgStrictText
name
)
Nothing
(
pgJSONB
$
cs
$
encode
hyperData
)
...
...
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