]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/Node_NodeNgramsNodeNgrams.hs
[DB/FACT] fix warnings
[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 FlexibleContexts #-}
28 {-# LANGUAGE FlexibleInstances #-}
29 {-# LANGUAGE FunctionalDependencies #-}
30 {-# LANGUAGE MultiParamTypeClasses #-}
31 {-# LANGUAGE NoImplicitPrelude #-}
32 {-# LANGUAGE OverloadedStrings #-}
33 {-# LANGUAGE QuasiQuotes #-}
34 {-# LANGUAGE RankNTypes #-}
35 {-# LANGUAGE TemplateHaskell #-}
36
37 module Gargantext.Database.Schema.Node_NodeNgramsNodeNgrams
38 where
39
40 import Control.Lens.TH (makeLensesWith, abbreviatedFields)
41 import Data.Maybe (Maybe)
42 import Gargantext.Database.Schema.Prelude
43 import Gargantext.Database.Admin.Types.Node (CorpusId)
44 import Gargantext.Database.Schema.Node()
45 import Gargantext.Prelude
46
47 data Node_NodeNgrams_NodeNgrams_Poly node_id nng1_id nng2_id weight =
48 Node_NodeNgrams_NodeNgrams { _nnn_node_id :: !node_id
49 , _nnn_nng1_id :: !nng1_id
50 , _nnn_nng2_id :: !nng2_id
51 , _nnn_weight :: !weight
52 } deriving (Show)
53
54 type Node_NodeNgrams_NodeNgrams_Write =
55 Node_NodeNgrams_NodeNgrams_Poly
56 (Column PGInt4 )
57 (Maybe (Column PGInt4 ))
58 (Column PGInt4 )
59 (Maybe (Column PGFloat8))
60
61 type Node_NodeNgrams_NodeNgrams_Read =
62 Node_NodeNgrams_NodeNgrams_Poly
63 (Column PGInt4 )
64 (Column PGInt4 )
65 (Column PGInt4 )
66 (Column PGFloat8)
67
68 type ListNgramsId = Int
69
70 type Node_NodeNgrams_NodeNgrams =
71 Node_NodeNgrams_NodeNgrams_Poly CorpusId (Maybe ListNgramsId) ListNgramsId (Maybe Double)
72
73 $(makeAdaptorAndInstance "pNode_NodeNgrams_NodeNgrams"
74 ''Node_NodeNgrams_NodeNgrams_Poly)
75 $(makeLensesWith abbreviatedFields
76 ''Node_NodeNgrams_NodeNgrams_Poly)
77
78
79 node_NodeNgrams_NodeNgrams_Table :: Table Node_NodeNgrams_NodeNgrams_Write Node_NodeNgrams_NodeNgrams_Read
80 node_NodeNgrams_NodeNgrams_Table =
81 Table "node_nodengrams_nodengrams"
82 ( pNode_NodeNgrams_NodeNgrams Node_NodeNgrams_NodeNgrams
83 { _nnn_node_id = required "node_id"
84 , _nnn_nng1_id = optional "node_ngrams1_id"
85 , _nnn_nng2_id = required "node_ngrams2_id"
86 , _nnn_weight = optional "weight"
87 }
88 )
89
90 instance QueryRunnerColumnDefault PGInt4 (Maybe Int) where
91 queryRunnerColumnDefault = fieldQueryRunnerColumn
92
93 instance QueryRunnerColumnDefault PGFloat8 (Maybe Double) where
94 queryRunnerColumnDefault = fieldQueryRunnerColumn
95