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
147
Issues
147
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
4500b970
Commit
4500b970
authored
Feb 08, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DB] NodesNgramsRepo.
parent
f1f4726a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
121 additions
and
107 deletions
+121
-107
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+10
-24
Flow.hs
src/Gargantext/Database/Flow.hs
+1
-2
Ngrams.hs
src/Gargantext/Database/Schema/Ngrams.hs
+5
-1
Node.hs
src/Gargantext/Database/Schema/Node.hs
+58
-50
schema.sql
src/Gargantext/Database/Schema/schema.sql
+31
-8
Node.hs
src/Gargantext/Database/Types/Node.hs
+16
-22
No files found.
src/Gargantext/API/Ngrams.hs
View file @
4500b970
...
@@ -71,6 +71,8 @@ import GHC.Generics (Generic)
...
@@ -71,6 +71,8 @@ import GHC.Generics (Generic)
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
-- import Gargantext.Database.Schema.Ngrams (NgramsTypeId, ngramsTypeId, NgramsTableData(..))
-- import Gargantext.Database.Schema.Ngrams (NgramsTypeId, ngramsTypeId, NgramsTableData(..))
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
)
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
)
import
Gargantext.Database.Utils
(
fromField'
)
import
Database.PostgreSQL.Simple.FromField
(
FromField
,
fromField
)
import
qualified
Gargantext.Database.Schema.Ngrams
as
Ngrams
import
qualified
Gargantext.Database.Schema.Ngrams
as
Ngrams
-- import Gargantext.Database.Schema.NodeNgram hiding (Action)
-- import Gargantext.Database.Schema.NodeNgram hiding (Action)
import
Gargantext.Prelude
import
Gargantext.Prelude
...
@@ -404,6 +406,14 @@ instance Action NgramsPatch (Maybe NgramsElement) where
...
@@ -404,6 +406,14 @@ instance Action NgramsPatch (Maybe NgramsElement) where
newtype
NgramsTablePatch
=
NgramsTablePatch
(
PatchMap
NgramsTerm
NgramsPatch
)
newtype
NgramsTablePatch
=
NgramsTablePatch
(
PatchMap
NgramsTerm
NgramsPatch
)
deriving
(
Eq
,
Show
,
Generic
,
ToJSON
,
FromJSON
,
Semigroup
,
Monoid
,
Validity
,
Transformable
)
deriving
(
Eq
,
Show
,
Generic
,
ToJSON
,
FromJSON
,
Semigroup
,
Monoid
,
Validity
,
Transformable
)
instance
FromField
NgramsTablePatch
where
fromField
=
fromField'
instance
FromField
(
PatchMap
NgramsType
(
PatchMap
NodeId
NgramsTablePatch
))
where
fromField
=
fromField'
--instance (Ord k, Action pv (Maybe v)) => Action (PatchMap k pv) (Map k v) where
--instance (Ord k, Action pv (Maybe v)) => Action (PatchMap k pv) (Map k v) where
--
--
type
instance
ConflictResolution
NgramsTablePatch
=
type
instance
ConflictResolution
NgramsTablePatch
=
...
@@ -722,28 +732,4 @@ getTableNgrams _cId maybeTabType listIds mlimit moffset = do
...
@@ -722,28 +732,4 @@ getTableNgrams _cId maybeTabType listIds mlimit moffset = do
getTableNgrams'
listIds
ngramsType
getTableNgrams'
listIds
ngramsType
&
mapped
.
v_data
.
_NgramsTable
%~
(
take
limit_
.
drop
offset_
)
&
mapped
.
v_data
.
_NgramsTable
%~
(
take
limit_
.
drop
offset_
)
{-
v <- view repoVar
repo <- liftIO $ readMVar v
let ngrams = repo ^.. r_state
. at listId . _Just
. at ngramsType . _Just
. taking limit_ (dropping offset_ each)
let ngrams' = case List.null ngrams of
True -> [] -- buildRepoFromDb (TODO sync with DB at shutdown)
False -> ngrams
pure $ Versioned (repo ^. r_version) (NgramsTable ngrams')
-}
{-
buildRepoFromDb listId = do
ngramsTableDatas <-
Ngrams.getNgramsTableDb NodeDocument ngramsType (Ngrams.NgramsTableParam listId cId) limit_ offset_
-- printDebug "ngramsTableDatas" ngramsTableDatas
pure $ Versioned 1 $ NgramsTable (toNgramsElement ngramsTableDatas)
-}
src/Gargantext/Database/Flow.hs
View file @
4500b970
...
@@ -60,7 +60,7 @@ import Gargantext.API.Ngrams (NgramsElement(..), insertNewListOfNgramsElements,
...
@@ -60,7 +60,7 @@ import Gargantext.API.Ngrams (NgramsElement(..), insertNewListOfNgramsElements,
import
qualified
Data.Map
as
DM
import
qualified
Data.Map
as
DM
type
FlowCmdM
env
err
m
=
type
FlowCmdM
env
err
m
=
(
CmdM
env
err
m
(
CmdM
env
err
m
,
RepoCmdM
env
err
m
,
RepoCmdM
env
err
m
,
HasNodeError
err
,
HasNodeError
err
)
)
...
@@ -349,4 +349,3 @@ insertLists lId lngs = insertNodeNgrams [ NodeNgram lId (_ngramsId ng) Nothing (
...
@@ -349,4 +349,3 @@ insertLists lId lngs = insertNodeNgrams [ NodeNgram lId (_ngramsId ng) Nothing (
|
(
l
,(
ngt
,
ng
))
<-
lngs
|
(
l
,(
ngt
,
ng
))
<-
lngs
]
]
------------------------------------------------------------------------
------------------------------------------------------------------------
src/Gargantext/Database/Schema/Ngrams.hs
View file @
4500b970
...
@@ -25,6 +25,7 @@ Ngrams connection to the Database.
...
@@ -25,6 +25,7 @@ Ngrams connection to the Database.
module
Gargantext.Database.Schema.Ngrams
where
module
Gargantext.Database.Schema.Ngrams
where
import
Data.Aeson
(
FromJSON
,
FromJSONKey
)
import
Control.Lens
(
makeLenses
,
view
,
over
)
import
Control.Lens
(
makeLenses
,
view
,
over
)
import
Control.Monad
(
mzero
)
import
Control.Monad
(
mzero
)
import
Data.ByteString.Internal
(
ByteString
)
import
Data.ByteString.Internal
(
ByteString
)
...
@@ -100,7 +101,10 @@ dbGetNgramsDb = runOpaQuery queryNgramsTable
...
@@ -100,7 +101,10 @@ dbGetNgramsDb = runOpaQuery queryNgramsTable
-- ngrams in authors field of document has Authors Type
-- ngrams in authors field of document has Authors Type
-- ngrams in text (title or abstract) of documents has Terms Type
-- ngrams in text (title or abstract) of documents has Terms Type
data
NgramsType
=
Authors
|
Institutes
|
Sources
|
NgramsTerms
data
NgramsType
=
Authors
|
Institutes
|
Sources
|
NgramsTerms
deriving
(
Eq
,
Show
,
Ord
,
Enum
,
Bounded
)
deriving
(
Eq
,
Show
,
Ord
,
Enum
,
Bounded
,
Generic
)
instance
FromJSON
NgramsType
instance
FromJSONKey
NgramsType
newtype
NgramsTypeId
=
NgramsTypeId
Int
newtype
NgramsTypeId
=
NgramsTypeId
Int
deriving
(
Eq
,
Show
,
Ord
,
Num
)
deriving
(
Eq
,
Show
,
Ord
,
Num
)
...
...
src/Gargantext/Database/Schema/Node.hs
View file @
4500b970
...
@@ -155,32 +155,33 @@ instance QueryRunnerColumnDefault PGInt4 NodeId
...
@@ -155,32 +155,33 @@ instance QueryRunnerColumnDefault PGInt4 NodeId
------------------------------------------------------------------------
------------------------------------------------------------------------
$
(
makeAdaptorAndInstance
"pNode"
''
N
odePoly
)
$
(
makeAdaptorAndInstance
"pNode"
''
N
odePoly
)
$
(
makeLensesWith
abbreviatedFields
''
N
odePoly
)
$
(
makeLensesWith
abbreviatedFields
''
N
odePoly
)
$
(
makeAdaptorAndInstance
"pNodeSearch"
''
N
odePolySearch
)
$
(
makeAdaptorAndInstance
"pNodeSearch"
''
N
odePolySearch
)
$
(
makeLensesWith
abbreviatedFields
''
N
odePolySearch
)
$
(
makeLensesWith
abbreviatedFields
''
N
odePolySearch
)
type
NodeWrite
=
NodePoly
(
Maybe
(
Column
PGInt4
)
)
type
NodeWrite
=
NodePoly
(
Maybe
(
Column
PGInt4
)
)
(
Column
PGInt4
)
(
Column
PGInt4
)
(
Column
PGInt4
)
(
Column
PGInt4
)
(
Maybe
(
Column
PGInt4
)
)
(
Maybe
(
Column
PGInt4
)
)
(
Column
PGText
)
(
Column
PGText
)
(
Maybe
(
Column
PGTimestamptz
))
(
Maybe
(
Column
PGTimestamptz
))
(
Column
PGJsonb
)
(
Column
PGJsonb
)
type
NodeRead
=
NodePoly
(
Column
PGInt4
)
type
NodeRead
=
NodePoly
(
Column
PGInt4
)
(
Column
PGInt4
)
(
Column
PGInt4
)
(
Column
PGInt4
)
(
Column
PGInt4
)
(
Column
PGInt4
)
(
Column
PGInt4
)
(
Column
PGText
)
(
Column
PGText
)
(
Column
PGTimestamptz
)
(
Column
PGTimestamptz
)
(
Column
PGJsonb
)
(
Column
PGJsonb
)
type
NodeReadNull
=
NodePoly
(
Column
(
Nullable
PGInt4
))
type
NodeReadNull
=
NodePoly
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGText
))
(
Column
(
Nullable
PGText
))
(
Column
(
Nullable
PGTimestamptz
))
(
Column
(
Nullable
PGTimestamptz
))
(
Column
(
Nullable
PGJsonb
))
(
Column
(
Nullable
PGJsonb
))
nodeTable
::
Table
NodeWrite
NodeRead
nodeTable
::
Table
NodeWrite
NodeRead
nodeTable
=
Table
"nodes"
(
pNode
Node
{
_node_id
=
optional
"id"
nodeTable
=
Table
"nodes"
(
pNode
Node
{
_node_id
=
optional
"id"
...
@@ -201,32 +202,38 @@ queryNodeTable = queryTable nodeTable
...
@@ -201,32 +202,38 @@ queryNodeTable = queryTable nodeTable
------------------------------------------------------------------------
------------------------------------------------------------------------
-- | Node(Read|Write)Search is slower than Node(Write|Read) use it
-- | Node(Read|Write)Search is slower than Node(Write|Read) use it
-- for full text search only
-- for full text search only
type
NodeSearchWrite
=
NodePolySearch
(
Maybe
(
Column
PGInt4
))
type
NodeSearchWrite
=
(
Column
PGInt4
)
NodePolySearch
(
Column
PGInt4
)
(
Maybe
(
Column
PGInt4
)
)
(
Column
(
Nullable
PGInt4
))
(
Column
PGInt4
)
(
Column
(
PGText
))
(
Column
PGInt4
)
(
Maybe
(
Column
PGTimestamptz
))
(
Column
(
Nullable
PGInt4
)
)
(
Column
PGJsonb
)
(
Column
PGText
)
(
Maybe
(
Column
PGTSVector
))
(
Maybe
(
Column
PGTimestamptz
))
(
Column
PGJsonb
)
type
NodeSearchRead
=
NodePolySearch
(
Column
PGInt4
)
(
Maybe
(
Column
PGTSVector
)
)
(
Column
PGInt4
)
(
Column
PGInt4
)
type
NodeSearchRead
=
(
Column
(
Nullable
PGInt4
))
NodePolySearch
(
Column
(
PGText
))
(
Column
PGInt4
)
(
Column
PGTimestamptz
)
(
Column
PGInt4
)
(
Column
PGJsonb
)
(
Column
PGInt4
)
(
Column
PGTSVector
)
(
Column
(
Nullable
PGInt4
))
(
Column
PGText
)
type
NodeSearchReadNull
=
NodePolySearch
(
Column
(
Nullable
PGInt4
))
(
Column
PGTimestamptz
)
(
Column
(
Nullable
PGInt4
))
(
Column
PGJsonb
)
(
Column
(
Nullable
PGInt4
))
(
Column
PGTSVector
)
(
Column
(
Nullable
PGInt4
))
(
Column
(
Nullable
PGText
))
type
NodeSearchReadNull
=
(
Column
(
Nullable
PGTimestamptz
))
NodePolySearch
(
Column
(
Nullable
PGJsonb
))
(
Column
(
Nullable
PGInt4
)
)
(
Column
(
Nullable
PGTSVector
))
(
Column
(
Nullable
PGInt4
)
)
(
Column
(
Nullable
PGInt4
)
)
(
Column
(
Nullable
PGInt4
)
)
(
Column
(
Nullable
PGText
)
)
(
Column
(
Nullable
PGTimestamptz
))
(
Column
(
Nullable
PGJsonb
)
)
(
Column
(
Nullable
PGTSVector
)
)
--{-
--{-
nodeTableSearch
::
Table
NodeSearchWrite
NodeSearchRead
nodeTableSearch
::
Table
NodeSearchWrite
NodeSearchRead
...
@@ -336,7 +343,8 @@ type JSONB = QueryRunnerColumnDefault PGJsonb
...
@@ -336,7 +343,8 @@ type JSONB = QueryRunnerColumnDefault PGJsonb
getNode
::
JSONB
a
=>
NodeId
->
proxy
a
->
Cmd
err
(
Node
a
)
getNode
::
JSONB
a
=>
NodeId
->
proxy
a
->
Cmd
err
(
Node
a
)
getNode
nId
_
=
do
getNode
nId
_
=
do
fromMaybe
(
error
$
"Node does node exist: "
<>
show
nId
)
.
headMay
<$>
runOpaQuery
(
limit
1
$
selectNode
(
pgNodeId
nId
))
fromMaybe
(
error
$
"Node does node exist: "
<>
show
nId
)
.
headMay
<$>
runOpaQuery
(
limit
1
$
selectNode
(
pgNodeId
nId
))
getNodesWithType
::
Column
PGInt4
->
Cmd
err
[
Node
HyperdataDocument
]
getNodesWithType
::
Column
PGInt4
->
Cmd
err
[
Node
HyperdataDocument
]
getNodesWithType
=
runOpaQuery
.
selectNodesWithType
getNodesWithType
=
runOpaQuery
.
selectNodesWithType
...
...
src/Gargantext/Database/Schema/schema.sql
View file @
4500b970
CREATE
EXTENSION
IF
NOT
EXISTS
plpgsql
WITH
SCHEMA
pg_catalog
;
CREATE
EXTENSION
IF
NOT
EXISTS
plpgsql
WITH
SCHEMA
pg_catalog
;
COMMENT
ON
EXTENSION
plpgsql
IS
'PL/pgSQL procedural language'
;
COMMENT
ON
EXTENSION
plpgsql
IS
'PL/pgSQL procedural language'
;
-- needed for rights management
-- CREATE EXTENSION IF NOT EXISTS acl WITH SCHEMA public;
-- CREATE USER WITH ...
-- CREATE USER WITH ...
-- createdb "gargandb"
-- createdb "gargandb"
...
@@ -23,6 +21,7 @@ CREATE TABLE public.auth_user (
...
@@ -23,6 +21,7 @@ CREATE TABLE public.auth_user (
ALTER
TABLE
public
.
auth_user
OWNER
TO
gargantua
;
ALTER
TABLE
public
.
auth_user
OWNER
TO
gargantua
;
-- TODO add publication_date
-- TODO add publication_date
-- TODO typename -> type_id
-- TODO typename -> type_id
CREATE
TABLE
public
.
nodes
(
CREATE
TABLE
public
.
nodes
(
...
@@ -40,7 +39,6 @@ CREATE TABLE public.nodes (
...
@@ -40,7 +39,6 @@ CREATE TABLE public.nodes (
ALTER
TABLE
public
.
nodes
OWNER
TO
gargantua
;
ALTER
TABLE
public
.
nodes
OWNER
TO
gargantua
;
CREATE
TABLE
public
.
ngrams
(
CREATE
TABLE
public
.
ngrams
(
id
SERIAL
,
id
SERIAL
,
terms
character
varying
(
255
),
terms
character
varying
(
255
),
...
@@ -49,7 +47,9 @@ CREATE TABLE public.ngrams (
...
@@ -49,7 +47,9 @@ CREATE TABLE public.ngrams (
);
);
ALTER
TABLE
public
.
ngrams
OWNER
TO
gargantua
;
ALTER
TABLE
public
.
ngrams
OWNER
TO
gargantua
;
-- TODO: delete ID
--------------------------------------------------------------
--------------------------------------------------------------
-- TODO: delete delete this table
CREATE
TABLE
public
.
nodes_ngrams
(
CREATE
TABLE
public
.
nodes_ngrams
(
id
SERIAL
,
id
SERIAL
,
node_id
integer
NOT
NULL
,
node_id
integer
NOT
NULL
,
...
@@ -64,13 +64,21 @@ CREATE TABLE public.nodes_ngrams (
...
@@ -64,13 +64,21 @@ CREATE TABLE public.nodes_ngrams (
-- PRIMARY KEY (node_id,ngrams_id)
-- PRIMARY KEY (node_id,ngrams_id)
);
);
ALTER
TABLE
public
.
nodes_ngrams
OWNER
TO
gargantua
;
ALTER
TABLE
public
.
nodes_ngrams
OWNER
TO
gargantua
;
--------------------------------------------------------------
CREATE
TABLE
public
.
nodes_ngrams_repo
(
version
integer
NOT
NULL
,
patches
jsonb
DEFAULT
'{}'
::
jsonb
NOT
NULL
,
PRIMARY
KEY
(
version
)
);
ALTER
TABLE
public
.
nodes_ngrams_repo
OWNER
TO
gargantua
;
--------------------------------------------------------------
--
--
-- Name: nodes_ngrams_ngrams; Type: TABLE; Schema: public; Owner: gargantua
--
--
-- TODO: delete delete this table
CREATE
TABLE
public
.
nodes_ngrams_ngrams
(
CREATE
TABLE
public
.
nodes_ngrams_ngrams
(
node_id
integer
NOT
NULL
REFERENCES
public
.
nodes
(
id
)
ON
DELETE
CASCADE
,
node_id
integer
NOT
NULL
REFERENCES
public
.
nodes
(
id
)
ON
DELETE
CASCADE
,
ngram1_id
integer
NOT
NULL
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
,
ngram1_id
integer
NOT
NULL
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
,
ngram2_id
integer
NOT
NULL
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
,
ngram2_id
integer
NOT
NULL
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
,
weight
double
precision
,
weight
double
precision
,
...
@@ -79,7 +87,7 @@ CREATE TABLE public.nodes_ngrams_ngrams (
...
@@ -79,7 +87,7 @@ CREATE TABLE public.nodes_ngrams_ngrams (
ALTER
TABLE
public
.
nodes_ngrams_ngrams
OWNER
TO
gargantua
;
ALTER
TABLE
public
.
nodes_ngrams_ngrams
OWNER
TO
gargantua
;
---------------------------------------------------------
CREATE
TABLE
public
.
nodes_nodes
(
CREATE
TABLE
public
.
nodes_nodes
(
node1_id
integer
NOT
NULL
,
node1_id
integer
NOT
NULL
,
node2_id
integer
NOT
NULL
,
node2_id
integer
NOT
NULL
,
...
@@ -89,8 +97,23 @@ CREATE TABLE public.nodes_nodes (
...
@@ -89,8 +97,23 @@ CREATE TABLE public.nodes_nodes (
PRIMARY
KEY
(
node1_id
,
node2_id
)
PRIMARY
KEY
(
node1_id
,
node2_id
)
);
);
ALTER
TABLE
public
.
nodes_nodes
OWNER
TO
gargantua
;
ALTER
TABLE
public
.
nodes_nodes
OWNER
TO
gargantua
;
---------------------------------------------------------
-- If needed for rights management at row level
-- CREATE EXTENSION IF NOT EXISTS acl WITH SCHEMA public;
CREATE
TABLE
public
.
rights
(
user_id
INTEGER
NOT
NULL
REFERENCES
public
.
auth_user
(
id
)
ON
DELETE
CASCADE
,
node_id
INTEGER
NOT
NULL
REFERENCES
public
.
nodes
(
id
)
ON
DELETE
CASCADE
,
rights
INTEGER
NOT
NULL
,
PRIMARY
KEY
(
user_id
,
node_id
)
);
ALTER
TABLE
public
.
rights
OWNER
TO
gargantua
;
CREATE
INDEX
rights_userId_nodeId
ON
public
.
rights
USING
btree
(
user_id
,
node_id
);
------------------------------------------------------------
-- INDEXES
-- INDEXES
CREATE
UNIQUE
INDEX
ON
public
.
auth_user
(
username
);
CREATE
UNIQUE
INDEX
ON
public
.
auth_user
(
username
);
...
...
src/Gargantext/Database/Types/Node.hs
View file @
4500b970
...
@@ -28,8 +28,7 @@ import Prelude (Enum, Bounded, minBound, maxBound)
...
@@ -28,8 +28,7 @@ import Prelude (Enum, Bounded, minBound, maxBound)
import
GHC.Generics
(
Generic
)
import
GHC.Generics
(
Generic
)
import
Control.Lens
hiding
(
elements
)
import
Control.Lens
hiding
(
elements
,
(
&
))
import
qualified
Control.Lens
as
L
import
Control.Applicative
((
<*>
))
import
Control.Applicative
((
<*>
))
import
Control.Monad
(
mzero
)
import
Control.Monad
(
mzero
)
...
@@ -41,7 +40,7 @@ import Data.ByteString.Lazy (ByteString)
...
@@ -41,7 +40,7 @@ import Data.ByteString.Lazy (ByteString)
import
Data.Either
import
Data.Either
import
Data.Eq
(
Eq
)
import
Data.Eq
(
Eq
)
import
Data.Monoid
(
mempty
)
import
Data.Monoid
(
mempty
)
import
Data.Text
(
Text
,
unpack
)
import
Data.Text
(
Text
,
unpack
,
pack
)
import
Data.Time
(
UTCTime
)
import
Data.Time
(
UTCTime
)
import
Data.Time.Segment
(
jour
,
timesAfter
,
Granularity
(
D
))
import
Data.Time.Segment
(
jour
,
timesAfter
,
Granularity
(
D
))
import
Data.Swagger
import
Data.Swagger
...
@@ -72,9 +71,10 @@ instance FromField NodeId where
...
@@ -72,9 +71,10 @@ instance FromField NodeId where
if
(
n
::
Int
)
>
0
then
return
$
NodeId
n
if
(
n
::
Int
)
>
0
then
return
$
NodeId
n
else
mzero
else
mzero
instance
ToJSON
NodeId
instance
ToJSON
NodeId
instance
FromJSON
NodeId
instance
FromJSON
NodeId
instance
ToSchema
NodeId
instance
FromJSONKey
NodeId
instance
ToSchema
NodeId
instance
FromHttpApiData
NodeId
where
instance
FromHttpApiData
NodeId
where
parseUrlPiece
n
=
pure
$
NodeId
$
(
read
.
cs
)
n
parseUrlPiece
n
=
pure
$
NodeId
$
(
read
.
cs
)
n
...
@@ -237,11 +237,8 @@ instance ToSchema Event where
...
@@ -237,11 +237,8 @@ instance ToSchema Event where
declareNamedSchema
proxy
=
genericDeclareNamedSchema
defaultSchemaOptions
proxy
declareNamedSchema
proxy
=
genericDeclareNamedSchema
defaultSchemaOptions
proxy
------------------------------------------------------------------------
------------------------------------------------------------------------
instance
Arbitrary
Text
where
type
Text'
=
Text
arbitrary
=
elements
$
map
(
\
c
->
pack
[
c
])
[
'a'
..
'z'
]
instance
Arbitrary
Text'
where
arbitrary
=
elements
[
"ici"
,
"la"
]
data
Resource
=
Resource
{
resource_path
::
Maybe
Text
data
Resource
=
Resource
{
resource_path
::
Maybe
Text
,
resource_scraper
::
Maybe
Text
,
resource_scraper
::
Maybe
Text
...
@@ -500,27 +497,24 @@ docExample = "{\"doi\":\"sdfds\",\"publication_day\":6,\"language_iso2\":\"en\",
...
@@ -500,27 +497,24 @@ docExample = "{\"doi\":\"sdfds\",\"publication_day\":6,\"language_iso2\":\"en\",
instance
ToSchema
HyperdataCorpus
where
instance
ToSchema
HyperdataCorpus
where
declareNamedSchema
proxy
=
genericDeclareNamedSchema
defaultSchemaOptions
proxy
declareNamedSchema
proxy
=
genericDeclareNamedSchema
defaultSchemaOptions
proxy
L
.&
mapped
.
schema
.
description
?~
"a corpus"
&
mapped
.
schema
.
description
?~
"a corpus"
L
.&
mapped
.
schema
.
example
?~
toJSON
hyperdataCorpus
&
mapped
.
schema
.
example
?~
toJSON
hyperdataCorpus
instance
ToSchema
HyperdataAnnuaire
where
instance
ToSchema
HyperdataAnnuaire
where
declareNamedSchema
proxy
=
genericDeclareNamedSchema
defaultSchemaOptions
proxy
declareNamedSchema
proxy
=
genericDeclareNamedSchema
defaultSchemaOptions
proxy
L
.&
mapped
.
schema
.
description
?~
"an annuaire"
&
mapped
.
schema
.
description
?~
"an annuaire"
L
.&
mapped
.
schema
.
example
?~
toJSON
hyperdataAnnuaire
&
mapped
.
schema
.
example
?~
toJSON
hyperdataAnnuaire
instance
ToSchema
HyperdataDocument
where
instance
ToSchema
HyperdataDocument
where
declareNamedSchema
proxy
=
genericDeclareNamedSchema
defaultSchemaOptions
proxy
declareNamedSchema
proxy
=
genericDeclareNamedSchema
defaultSchemaOptions
proxy
L
.&
mapped
.
schema
.
description
?~
"a document"
&
mapped
.
schema
.
description
?~
"a document"
L
.&
mapped
.
schema
.
example
?~
toJSON
hyperdataDocument
&
mapped
.
schema
.
example
?~
toJSON
hyperdataDocument
instance
ToSchema
HyperdataAny
where
instance
ToSchema
HyperdataAny
where
declareNamedSchema
proxy
=
declareNamedSchema
proxy
=
pure
$
genericNameSchema
defaultSchemaOptions
proxy
mempty
pure
$
genericNameSchema
defaultSchemaOptions
proxy
mempty
L
.
&
schema
.
description
?~
"a node"
&
schema
.
description
?~
"a node"
L
.
&
schema
.
example
?~
emptyObject
-- TODO
&
schema
.
example
?~
emptyObject
-- TODO
instance
ToSchema
hyperdata
=>
instance
ToSchema
hyperdata
=>
...
...
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