Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
198
Issues
198
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
df7374f0
Commit
df7374f0
authored
Dec 06, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[UserPage][Database] Authors to docs view.
parent
77283dfc
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
216 additions
and
131 deletions
+216
-131
Facet.hs
src/Gargantext/Database/Facet.hs
+177
-106
Ngrams.hs
src/Gargantext/Database/Ngrams.hs
+30
-24
NodeNgram.hs
src/Gargantext/Database/NodeNgram.hs
+8
-0
Utils.hs
src/Gargantext/Database/Utils.hs
+1
-1
No files found.
src/Gargantext/Database/Facet.hs
View file @
df7374f0
This diff is collapsed.
Click to expand it.
src/Gargantext/Database/Ngrams.hs
View file @
df7374f0
...
...
@@ -25,9 +25,9 @@ module Gargantext.Database.Ngrams where
import
Database.PostgreSQL.Simple
as
DPS
(
Connection
)
--
import Control.Lens.TH (makeLensesWith, abbreviatedFields)
--
import Data.Profunctor.Product.TH (makeAdaptorAndInstance)
--
import Opaleye
import
Control.Lens.TH
(
makeLensesWith
,
abbreviatedFields
)
import
Data.Profunctor.Product.TH
(
makeAdaptorAndInstance
)
import
Opaleye
import
Control.Lens
(
makeLenses
,
view
)
import
Data.ByteString.Internal
(
ByteString
)
import
Data.Map
(
Map
,
fromList
,
lookup
,
fromListWith
)
...
...
@@ -51,38 +51,44 @@ import Prelude (Enum, Bounded, minBound, maxBound)
import
qualified
Data.Set
as
DS
import
qualified
Database.PostgreSQL.Simple
as
DPS
{-
data Ngram
Poly id terms n = NgramDb { ngram
_id :: id
, ngram_terms :: terms
, ngram_n :: n
--
{-
data
Ngram
sPoly
id
terms
n
=
NgramsDb
{
ngrams
_id
::
id
,
ngram
s
_terms
::
terms
,
ngram
s
_n
::
n
}
deriving
(
Show
)
type NgramWrite = NgramPoly (Maybe (Column PGInt4))
--}
type
NgramsWrite
=
NgramsPoly
(
Maybe
(
Column
PGInt4
))
(
Column
PGText
)
(
Column
PGInt4
)
type NgramRead = NgramPoly (Column PGInt4)
(Column PGText)
(Column PGInt4)
type
NgramsRead
=
NgramsPoly
(
Column
PGInt4
)
(
Column
PGText
)
(
Column
PGInt4
)
type
NgramsReadNull
=
NgramsPoly
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGText
))
(
Column
(
Nullable
PGInt4
))
--type Ngram = NgramPoly Int Text Int
--{-
type
NgramsDb
=
NgramsPoly
Int
Text
Int
$(makeAdaptorAndInstance "pNgram
" ''Ngram
Poly)
$(makeLensesWith abbreviatedFields ''Ngram
Poly)
$
(
makeAdaptorAndInstance
"pNgram
sDb"
''
N
grams
Poly
)
-- $(makeLensesWith abbreviatedFields ''Ngrams
Poly)
ngram
Table :: Table NgramWrite Ngram
Read
ngram
Table = Table "ngrams" (pNgram NgramDb { ngram
_id = optional "id"
, ngram_terms = required "terms"
, ngram_n = required "n"
ngram
sTable
::
Table
NgramsWrite
Ngrams
Read
ngram
sTable
=
Table
"ngrams"
(
pNgramsDb
NgramsDb
{
ngrams
_id
=
optional
"id"
,
ngram
s
_terms
=
required
"terms"
,
ngram
s
_n
=
required
"n"
}
)
--{-
queryNgramsTable
::
Query
NgramsRead
queryNgramsTable
=
queryTable
ngramsTable
queryNgramTable :: Query NgramRead
queryNgramTable = queryTable ngramTable
dbGetNgrams :: DPS.Connection -> IO [NgramDb]
dbGetNgrams conn = runQuery conn queryNgramTable
-}
dbGetNgramsDb
::
DPS
.
Connection
->
IO
[
NgramsDb
]
dbGetNgramsDb
conn
=
runQuery
conn
queryNgramsTable
--}
-- | Main Ngrams Types
-- | Typed Ngrams
...
...
src/Gargantext/Database/NodeNgram.hs
View file @
df7374f0
...
...
@@ -65,6 +65,14 @@ type NodeNgramRead =
(
Column
PGFloat8
)
(
Column
PGInt4
)
type
NodeNgramReadNull
=
NodeNgramPoly
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGFloat8
))
(
Column
(
Nullable
PGInt4
))
type
NodeNgram
=
NodeNgramPoly
(
Maybe
Int
)
Int
Int
Double
Int
...
...
src/Gargantext/Database/Utils.hs
View file @
df7374f0
...
...
@@ -79,5 +79,5 @@ fromField' field mb = do
Success
a
->
pure
a
Error
_err
->
returnError
ConversionFailed
field
"cannot parse hyperdata"
-- | Opaleye leftJoin* functions
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment