2 Module : Gargantext.Database.Schema.NodeNgrams
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 NodeNgrams register Context of Ngrams (named Cgrams then)
14 {-# OPTIONS_GHC -fno-warn-orphans #-}
16 {-# LANGUAGE Arrows #-}
17 {-# LANGUAGE FunctionalDependencies #-}
18 {-# LANGUAGE QuasiQuotes #-}
19 {-# LANGUAGE TemplateHaskell #-}
21 module Gargantext.Database.Schema.NodeNgrams where
23 import Data.Text (Text)
24 import Gargantext.Core.Types
25 import Gargantext.Database.Schema.Ngrams (NgramsType)
26 import Gargantext.Prelude
29 data NodeNgramsPoly id
38 = NodeNgrams { _nng_id :: !id
39 , _nng_node_id :: !node_id'
40 , _nng_node_subtype :: !node_subtype
41 , _nng_ngrams_id :: !ngrams_id
42 , _nng_ngrams_type :: !ngrams_type
43 , _nng_ngrams_field :: !ngrams_field
44 , _nng_ngrams_tag :: !ngrams_tag
45 , _nng_ngrams_class :: !ngrams_class
46 , _nng_ngrams_weight :: !weight
47 } deriving (Show, Eq, Ord)
50 type NodeNgramsWrite = NodeNgramsPoly (Maybe (Column (SqlInt4)))
52 (Maybe (Column (SqlInt4)))
54 (Maybe (Column (SqlInt4)))
55 (Maybe (Column (SqlInt4)))
56 (Maybe (Column (SqlInt4)))
57 (Maybe (Column (SqlInt4)))
58 (Maybe (Column (SqlFloat8)))
60 type NodeNodeRead = NodeNgramsPoly (Column SqlInt4)
70 type NodeNgramsReadNull = NodeNgramsPoly (Column (Nullable SqlInt4))
71 (Column (Nullable SqlInt4))
72 (Column (Nullable SqlInt4))
73 (Column (Nullable SqlInt4))
75 (Column (Nullable SqlInt4))
76 (Column (Nullable SqlInt4))
77 (Column (Nullable SqlInt4))
78 (Column (Nullable SqlInt4))
79 (Column (Nullable SqlFloat8))
81 type NodeNgramsId = Int
83 type NgramsField = Int
85 type NgramsClass = Int
86 type NgramsText = Text
88 -- Example of list Ngrams
89 -- type ListNgrams = NodeNgramsPoly (Maybe Int) ListType Text
92 NodeNgramsPoly (Maybe NodeNgramsId) NodeId ListType NgramsText
93 NgramsType (Maybe NgramsField) (Maybe NgramsTag) (Maybe NgramsClass)