2 Module : Gargantext.Database.NodeNgram
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 Here is a longer description of this module, containing some
11 commentary with @some markup@.
14 {-# OPTIONS_GHC -fno-warn-orphans #-}
16 {-# LANGUAGE Arrows #-}
17 {-# LANGUAGE FlexibleInstances #-}
18 {-# LANGUAGE FunctionalDependencies #-}
19 {-# LANGUAGE MultiParamTypeClasses #-}
20 {-# LANGUAGE NoImplicitPrelude #-}
21 {-# LANGUAGE TemplateHaskell #-}
24 module Gargantext.Database.NodeNgram where
27 import Data.Profunctor.Product.TH (makeAdaptorAndInstance)
28 import Control.Lens.TH (makeLensesWith, abbreviatedFields)
32 data NodeNgramPoly id node_id ngram_id weight
33 = NodeNgram { nodeNgram_NodeNgramId :: id
34 , nodeNgram_NodeNgramNodeId :: node_id
35 , nodeNgram_NodeNgramNgramId :: ngram_id
36 , nodeNgram_NodeNgramWeight :: weight
39 type NodeNgramWrite = NodeNgramPoly (Column PGInt4 )
44 type NodeNgramRead = NodeNgramPoly (Column PGInt4 )
49 type NodeNgram = NodeNgramPoly Int Int Int Double
51 $(makeAdaptorAndInstance "pNodeNgram" ''NodeNgramPoly)
52 $(makeLensesWith abbreviatedFields ''NodeNgramPoly)
55 nodeNgramTable :: Table NodeNgramWrite NodeNgramRead
56 nodeNgramTable = Table "nodes_ngrams" ( pNodeNgram NodeNgram
57 { nodeNgram_NodeNgramId = required "id"
58 , nodeNgram_NodeNgramNodeId = required "node_id"
59 , nodeNgram_NodeNgramNgramId = required "ngram_id"
60 , nodeNgram_NodeNgramWeight = required "weight"
64 queryNodeNgramTable :: Query NodeNgramRead
65 queryNodeNgramTable = queryTable nodeNgramTable