2 Module : Gargantext.Database.Schema.Node_NodeNgrams_NodeNgrams
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
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
19 - recursive queries of postgres
20 - group with: https://en.wikipedia.org/wiki/Nested_set_model
24 {-# OPTIONS_GHC -fno-warn-orphans #-}
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 #-}
37 module Gargantext.Database.Schema.Node_NodeNgramsNodeNgrams
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
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
54 type Node_NodeNgrams_NodeNgrams_Write =
55 Node_NodeNgrams_NodeNgrams_Poly
57 (Maybe (Column PGInt4 ))
59 (Maybe (Column PGFloat8))
61 type Node_NodeNgrams_NodeNgrams_Read =
62 Node_NodeNgrams_NodeNgrams_Poly
68 type ListNgramsId = Int
70 type Node_NodeNgrams_NodeNgrams =
71 Node_NodeNgrams_NodeNgrams_Poly CorpusId (Maybe ListNgramsId) ListNgramsId (Maybe Double)
73 $(makeAdaptorAndInstance "pNode_NodeNgrams_NodeNgrams"
74 ''Node_NodeNgrams_NodeNgrams_Poly)
75 $(makeLensesWith abbreviatedFields
76 ''Node_NodeNgrams_NodeNgrams_Poly)
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"
90 instance QueryRunnerColumnDefault PGInt4 (Maybe Int) where
91 queryRunnerColumnDefault = fieldQueryRunnerColumn
93 instance QueryRunnerColumnDefault PGFloat8 (Maybe Double) where
94 queryRunnerColumnDefault = fieldQueryRunnerColumn