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
165
Issues
165
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
gargantext
haskell-gargantext
Commits
3be142c7
Commit
3be142c7
authored
Sep 20, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TREE] Realistic tree.
parent
3b5bca7c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
Main.hs
src/Gargantext/Core/Types/Main.hs
+19
-11
Node.hs
src/Gargantext/Database/Types/Node.hs
+1
-1
No files found.
src/Gargantext/Core/Types/Main.hs
View file @
3be142c7
...
@@ -56,18 +56,27 @@ gargNode = [userTree]
...
@@ -56,18 +56,27 @@ gargNode = [userTree]
-- | User Tree simplified
-- | User Tree simplified
userTree
::
Tree
NodeTree
userTree
::
Tree
NodeTree
userTree
=
NodeT
(
NodeTree
"user A"
NodeUser
1
)
[
projectTree
]
userTree
=
TreeN
(
NodeTree
"user name"
NodeUser
1
)
$
[
leafT
$
NodeTree
"MyPage"
UserPage
0
]
<>
[
annuaireTree
,
projectTree
]
-- | Project Tree
-- | Project Tree
projectTree
::
Tree
NodeTree
projectTree
::
Tree
NodeTree
projectTree
=
NodeT
(
NodeTree
"Project A"
Project
2
)
[
corpusTree
]
projectTree
=
TreeN
(
NodeTree
"Project CNRS/IMT"
Project
2
)
[
corpusTree
10
"A"
,
corpusTree
20
"B"
]
type
Individu
=
Document
-- | Corpus Tree
-- | Corpus Tree
corpusTree
::
Tree
NodeTree
annuaireTree
::
Tree
NodeTree
corpusTree
=
NodeT
(
NodeTree
"Corpus A"
NodeCorpus
3
)
(
[
leafT
$
NodeTree
"Doc"
Document
4
]
annuaireTree
=
TreeN
(
NodeTree
"Annuaire"
Annuaire
41
)
(
[
leafT
$
NodeTree
"IMT"
Individu
42
]
<>
[
leafT
(
NodeTree
"List A"
Lists
5
)
]
<>
[
leafT
$
NodeTree
"CNRS"
Individu
43
]
<>
[
leafT
(
NodeTree
"Metrics A"
Metrics
6
)
]
)
<>
[
leafT
(
NodeTree
"Class A"
Classification
7
)]
corpusTree
::
NodeId
->
Text
->
Tree
NodeTree
corpusTree
nId
t
=
TreeN
(
NodeTree
(
"Corpus "
<>
t
)
NodeCorpus
nId
)
(
[
leafT
$
NodeTree
"Documents"
Document
(
nId
+
1
)]
-- <> [ leafT $ NodeTree "My lists" Lists 5]
-- <> [ leafT (NodeTree "Metrics A" Metrics 6) ]
-- <> [ leafT (NodeTree "Class A" Classification 7)]
)
)
-- TODO make instances of Nodes
-- TODO make instances of Nodes
...
@@ -88,7 +97,6 @@ data Lists = StopList | MainList | MapList | GroupList
...
@@ -88,7 +97,6 @@ data Lists = StopList | MainList | MapList | GroupList
-- | Community Manager Use Case
-- | Community Manager Use Case
type
Annuaire
=
NodeCorpus
type
Annuaire
=
NodeCorpus
type
Individu
=
Document
-- | Favorites Node enable Node categorization
-- | Favorites Node enable Node categorization
type
Favorites
=
Node
HyperdataFavorites
type
Favorites
=
Node
HyperdataFavorites
...
@@ -134,11 +142,11 @@ type Offset = Int
...
@@ -134,11 +142,11 @@ type Offset = Int
------------------------------------------------------------------------
------------------------------------------------------------------------
-- All the Database is structred like a hierarchical Tree
-- All the Database is structred like a hierarchical Tree
data
Tree
a
=
NodeT
a
[
Tree
a
]
data
Tree
a
=
TreeN
a
[
Tree
a
]
deriving
(
Show
,
Read
,
Eq
,
Generic
)
deriving
(
Show
,
Read
,
Eq
,
Generic
)
instance
ToJSON
(
Tree
NodeTree
)
where
instance
ToJSON
(
Tree
NodeTree
)
where
toJSON
(
NodeT
node
nodes
)
=
toJSON
(
TreeN
node
nodes
)
=
object
[
"node"
A
..=
toJSON
node
,
"children"
A
..=
toJSON
nodes
]
object
[
"node"
A
..=
toJSON
node
,
"children"
A
..=
toJSON
nodes
]
instance
FromJSON
(
Tree
NodeTree
)
instance
FromJSON
(
Tree
NodeTree
)
...
@@ -151,4 +159,4 @@ instance Arbitrary (Tree NodeTree) where
...
@@ -151,4 +159,4 @@ instance Arbitrary (Tree NodeTree) where
-- data Tree a = NodeT a [Tree a]
-- data Tree a = NodeT a [Tree a]
-- same as Data.Tree
-- same as Data.Tree
leafT
::
a
->
Tree
a
leafT
::
a
->
Tree
a
leafT
x
=
NodeT
x
[]
leafT
x
=
TreeN
x
[]
src/Gargantext/Database/Types/Node.hs
View file @
3be142c7
...
@@ -274,7 +274,7 @@ type NodeCorpus = Node HyperdataCorpus
...
@@ -274,7 +274,7 @@ type NodeCorpus = Node HyperdataCorpus
type
Document
=
Node
HyperdataDocument
type
Document
=
Node
HyperdataDocument
------------------------------------------------------------------------
------------------------------------------------------------------------
data
NodeType
=
NodeUser
|
Project
|
Folder
|
NodeCorpus
|
Annuaire
|
Document
|
UserPage
|
DocumentCopy
|
Favorites
data
NodeType
=
NodeUser
|
Project
|
Folder
|
NodeCorpus
|
Annuaire
|
Document
|
Individu
|
UserPage
|
DocumentCopy
|
Favorites
|
Classification
|
Classification
|
Lists
|
Lists
|
Metrics
|
Occurrences
|
Metrics
|
Occurrences
...
...
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