Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
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
Christian Merten
haskell-gargantext
Commits
277e24b4
Commit
277e24b4
authored
Jan 31, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] getNodesWithType 1 : unexpectedNull correction.
parent
45283b1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
16 deletions
+23
-16
Node.hs
src/Data/Gargantext/Database/Node.hs
+4
-4
Main.hs
src/Data/Gargantext/Types/Main.hs
+11
-4
Node.hs
src/Data/Gargantext/Types/Node.hs
+8
-8
No files found.
src/Data/Gargantext/Database/Node.hs
View file @
277e24b4
...
@@ -33,7 +33,7 @@ import Opaleye
...
@@ -33,7 +33,7 @@ import Opaleye
data
PGTSVector
data
PGTSVector
type
NodeWrite
=
NodePoly
(
Maybe
(
Column
PGInt4
))
(
Column
PGInt4
)
type
NodeWrite
=
NodePoly
(
Maybe
(
Column
PGInt4
))
(
Column
PGInt4
)
(
Column
PGInt4
)
(
Maybe
(
Column
(
Nullable
PGInt4
)
))
(
Column
PGInt4
)
(
Column
(
Nullable
PGInt4
))
(
Column
(
PGText
))
(
Maybe
(
Column
PGTimestamptz
))
(
Column
(
PGText
))
(
Maybe
(
Column
PGTimestamptz
))
(
Column
PGJsonb
)
-- (Maybe (Column PGTSVector))
(
Column
PGJsonb
)
-- (Maybe (Column PGTSVector))
...
@@ -96,7 +96,7 @@ nodeTable :: Table NodeWrite NodeRead
...
@@ -96,7 +96,7 @@ nodeTable :: Table NodeWrite NodeRead
nodeTable
=
Table
"nodes"
(
pNode
Node
{
node_id
=
optional
"id"
nodeTable
=
Table
"nodes"
(
pNode
Node
{
node_id
=
optional
"id"
,
node_typename
=
required
"typename"
,
node_typename
=
required
"typename"
,
node_userId
=
required
"user_id"
,
node_userId
=
required
"user_id"
,
node_parentId
=
optional
"parent_id"
,
node_parentId
=
required
"parent_id"
,
node_name
=
required
"name"
,
node_name
=
required
"name"
,
node_date
=
optional
"date"
,
node_date
=
optional
"date"
,
node_hyperdata
=
required
"hyperdata"
,
node_hyperdata
=
required
"hyperdata"
...
@@ -127,8 +127,8 @@ selectNodeWithParentID node_id = proc () -> do
...
@@ -127,8 +127,8 @@ selectNodeWithParentID node_id = proc () -> do
selectNodesWithType
::
Column
PGInt4
->
Query
NodeRead
selectNodesWithType
::
Column
PGInt4
->
Query
NodeRead
selectNodesWithType
type_id
=
proc
()
->
do
selectNodesWithType
type_id
=
proc
()
->
do
row
@
(
Node
_
id
_tn
_uid
p_id
n
_d
_h
)
<-
queryNodeTable
-<
()
row
@
(
Node
_
tn
_
_
_
_
_
)
<-
queryNodeTable
-<
()
restrict
-<
_
tn
.==
type_id
restrict
-<
tn
.==
type_id
--let noParent = ifThenElse (isNull nullableBoss) (pgString "no") (pgString "a")
--let noParent = ifThenElse (isNull nullableBoss) (pgString "no") (pgString "a")
--returnA -< Node _id _tn _uid (pgInt4 0) (pgString "") _d _h
--returnA -< Node _id _tn _uid (pgInt4 0) (pgString "") _d _h
returnA
-<
row
returnA
-<
row
...
...
src/Data/Gargantext/Types/Main.hs
View file @
277e24b4
...
@@ -30,9 +30,6 @@ data Language = EN | FR -- | DE | IT | SP
...
@@ -30,9 +30,6 @@ data Language = EN | FR -- | DE | IT | SP
-- > SP == spanish (not implemented yet)
-- > SP == spanish (not implemented yet)
-- > ... add your language and help us to implement it (:
-- > ... add your language and help us to implement it (:
type
Ngrams
=
(
Text
,
Text
,
Text
)
type
ErrorMessage
=
String
-- All the Database is structred like a hierarchical Tree
-- All the Database is structred like a hierarchical Tree
...
@@ -80,7 +77,7 @@ data Metrics = Occurrences | Cooccurrences | Specclusion | Genclusion | Cvalue
...
@@ -80,7 +77,7 @@ data Metrics = Occurrences | Cooccurrences | Specclusion | Genclusion | Cvalue
-- | NodePoly indicates that Node has a Polymorphism Type
-- | NodePoly indicates that Node has a Polymorphism Type
type
Node
json
=
NodePoly
NodeId
NodeTypeId
NodeUserId
NodeParentId
NodeName
UTCTime
json
-- NodeVector
type
Node
json
=
NodePoly
NodeId
NodeTypeId
NodeUserId
(
Maybe
NodeParentId
)
NodeName
UTCTime
json
-- NodeVector
-- type Node json = NodePoly NodeId NodeTypeId UserId ParentId NodeName UTCTime json
-- type Node json = NodePoly NodeId NodeTypeId UserId ParentId NodeName UTCTime json
type
NodeTypeId
=
Int
type
NodeTypeId
=
Int
type
NodeId
=
Int
type
NodeId
=
Int
...
@@ -167,3 +164,13 @@ nodeTypes = [ (NodeUser , 1)
...
@@ -167,3 +164,13 @@ nodeTypes = [ (NodeUser , 1)
--
--
nodeTypeId
::
NodeType
->
NodeTypeId
nodeTypeId
::
NodeType
->
NodeTypeId
nodeTypeId
tn
=
fromMaybe
(
error
(
"Typename "
++
show
tn
++
" does not exist"
))
(
lookup
tn
nodeTypes
)
nodeTypeId
tn
=
fromMaybe
(
error
(
"Typename "
++
show
tn
++
" does not exist"
))
(
lookup
tn
nodeTypes
)
-- Temporary types to be removed
type
Ngrams
=
(
Text
,
Text
,
Text
)
type
ErrorMessage
=
String
src/Data/Gargantext/Types/Node.hs
View file @
277e24b4
...
@@ -22,13 +22,13 @@ data NodePoly id typename userId parentId name date hyperdata = Node { node_id
...
@@ -22,13 +22,13 @@ data NodePoly id typename userId parentId name date hyperdata = Node { node_id
}
deriving
(
Show
)
}
deriving
(
Show
)
data
Statu
t
=
Statut
{
statut
_Date
::
Maybe
UTCTime
data
Statu
s
=
Status
{
status
_Date
::
Maybe
UTCTime
,
statu
t
_Error
::
Maybe
Text
,
statu
s
_Error
::
Maybe
Text
,
statu
t
_Action
::
Maybe
Text
,
statu
s
_Action
::
Maybe
Text
,
statu
t
_Complete
::
Maybe
Bool
,
statu
s
_Complete
::
Maybe
Bool
,
statu
t
_Progress
::
Maybe
Int
,
statu
s
_Progress
::
Maybe
Int
}
deriving
(
Show
,
Generic
)
}
deriving
(
Show
,
Generic
)
$
(
deriveJSON
(
unPrefix
"statu
t_"
)
''
S
tatut
)
$
(
deriveJSON
(
unPrefix
"statu
s_"
)
''
S
tatus
)
data
HyperdataDocument
=
HyperdataDocument
{
hyperdataDocument_Bdd
::
Maybe
Text
data
HyperdataDocument
=
HyperdataDocument
{
hyperdataDocument_Bdd
::
Maybe
Text
...
@@ -38,7 +38,7 @@ data HyperdataDocument = HyperdataDocument { hyperdataDocument_Bdd
...
@@ -38,7 +38,7 @@ data HyperdataDocument = HyperdataDocument { hyperdataDocument_Bdd
,
hyperdataDocument_Title
::
Maybe
Text
,
hyperdataDocument_Title
::
Maybe
Text
,
hyperdataDocument_Authors
::
Maybe
Text
,
hyperdataDocument_Authors
::
Maybe
Text
,
hyperdataDocument_Abstract
::
Maybe
Text
,
hyperdataDocument_Abstract
::
Maybe
Text
,
hyperdataDocument_Statuses
::
Maybe
[
Statu
t
]
,
hyperdataDocument_Statuses
::
Maybe
[
Statu
s
]
,
hyperdataDocument_Publication_date
::
Maybe
Text
,
hyperdataDocument_Publication_date
::
Maybe
Text
,
hyperdataDocument_Publication_year
::
Maybe
Text
,
hyperdataDocument_Publication_year
::
Maybe
Text
,
hyperdataDocument_Publication_month
::
Maybe
Text
,
hyperdataDocument_Publication_month
::
Maybe
Text
...
@@ -63,7 +63,7 @@ $(deriveJSON (unPrefix "resource_") ''Resource)
...
@@ -63,7 +63,7 @@ $(deriveJSON (unPrefix "resource_") ''Resource)
data
HyperdataCorpus
=
HyperdataCorpus
{
hyperdataCorpus_Action
::
Maybe
Text
data
HyperdataCorpus
=
HyperdataCorpus
{
hyperdataCorpus_Action
::
Maybe
Text
,
hyperdataCorpus_Statuses
::
Maybe
[
Statu
t
]
,
hyperdataCorpus_Statuses
::
Maybe
[
Statu
s
]
,
hyperdataCorpus_Languages
::
Maybe
LanguageNodes
,
hyperdataCorpus_Languages
::
Maybe
LanguageNodes
,
hyperdataCorpus_Resources
::
Maybe
[
Resource
]
,
hyperdataCorpus_Resources
::
Maybe
[
Resource
]
,
hyperdataCorpus_Language_id
::
Maybe
Text
,
hyperdataCorpus_Language_id
::
Maybe
Text
...
...
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