]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/Node_NodeNgramsNodeNgrams.hs
[MERGE] Phylo
[gargantext.git] / src / Gargantext / Database / Schema / Node_NodeNgramsNodeNgrams.hs
1 {-|
2 Module : Gargantext.Database.Schema.Node_NodeNgrams_NodeNgrams
3 Description :
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 lgrams: listed ngrams
11
12 Node_NodeNgrams_NodeNgrams table is used to group ngrams
13 - first NodeId :: Referential / space node (corpus)
14 - NodeNgrams where Node is List
15 - lgrams1_id, lgrams2_id where all lgrams2_id will be added to lgrams1_id
16 - weight: score the relation
17
18 Next Step benchmark:
19 - recursive queries of postgres
20 - group with: https://en.wikipedia.org/wiki/Nested_set_model
21
22 -}
23
24 {-# OPTIONS_GHC -fno-warn-orphans #-}
25
26 {-# LANGUAGE Arrows #-}
27 {-# LANGUAGE FunctionalDependencies #-}
28 {-# LANGUAGE QuasiQuotes #-}
29 {-# LANGUAGE TemplateHaskell #-}
30
31 module Gargantext.Database.Schema.Node_NodeNgramsNodeNgrams
32 where
33
34 {-
35 import Gargantext.Database.Schema.Prelude
36 import Gargantext.Database.Admin.Types.Node (CorpusId)
37 import Gargantext.Database.Schema.Node()
38 import Gargantext.Prelude
39
40 data Node_NodeNgrams_NodeNgrams_Poly node_id nng1_id nng2_id weight =
41 Node_NodeNgrams_NodeNgrams { _nnn_node_id :: !node_id
42 , _nnn_nng1_id :: !nng1_id
43 , _nnn_nng2_id :: !nng2_id
44 , _nnn_weight :: !weight
45 } deriving (Show)
46
47 type Node_NodeNgrams_NodeNgrams_Write =
48 Node_NodeNgrams_NodeNgrams_Poly
49 (Column SqlInt4 )
50 (Maybe (Column SqlInt4 ))
51 (Column SqlInt4 )
52 (Maybe (Column SqlFloat8))
53
54 type Node_NodeNgrams_NodeNgrams_Read =
55 Node_NodeNgrams_NodeNgrams_Poly
56 (Column SqlInt4 )
57 (Column SqlInt4 )
58 (Column SqlInt4 )
59 (Column SqlFloat8)
60
61 type ListNgramsId = Int
62
63 type Node_NodeNgrams_NodeNgrams =
64 Node_NodeNgrams_NodeNgrams_Poly CorpusId (Maybe ListNgramsId) ListNgramsId (Maybe Double)
65
66 $(makeAdaptorAndInstance "pNode_NodeNgrams_NodeNgrams"
67 ''Node_NodeNgrams_NodeNgrams_Poly)
68 $(makeLensesWith abbreviatedFields
69 ''Node_NodeNgrams_NodeNgrams_Poly)
70
71
72 node_NodeNgrams_NodeNgrams_Table :: Table Node_NodeNgrams_NodeNgrams_Write Node_NodeNgrams_NodeNgrams_Read
73 node_NodeNgrams_NodeNgrams_Table =
74 Table "node_nodengrams_nodengrams"
75 ( pNode_NodeNgrams_NodeNgrams Node_NodeNgrams_NodeNgrams
76 { _nnn_node_id = requiredTableField "node_id"
77 , _nnn_nng1_id = optionalTableField "node_ngrams1_id"
78 , _nnn_nng2_id = requiredTableField "node_ngrams2_id"
79 , _nnn_weight = optionalTableField "weight"
80 }
81 )
82
83 instance DefaultFromField SqlInt4 (Maybe Int) where
84 defaultFromField = fromPGSFromField
85
86 instance DefaultFromField SqlFloat8 (Maybe Double) where
87 defaultFromField = fromPGSFromField
88 -}