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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
10
Merge Requests
10
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
c3fc3946
Commit
c3fc3946
authored
May 17, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] New route for new corpus or new documents in existing corpus.
parent
5e332ef8
Pipeline
#400
failed with stage
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
1 deletion
+110
-1
API.hs
src/Gargantext/API.hs
+5
-1
New.hs
src/Gargantext/API/Corpus/New.hs
+37
-0
Count.hs
src/Gargantext/API/Count.hs
+1
-0
test.txt
src/Gargantext/API/test.txt
+1
-0
Crawlers.hs
src/Gargantext/Text/Crawlers.hs
+21
-0
Client.sh
src/Gargantext/Text/Parsers/Client.sh
+45
-0
No files found.
src/Gargantext/API.hs
View file @
c3fc3946
...
...
@@ -76,6 +76,7 @@ import Gargantext.API.Node
import
Gargantext.API.Search
(
SearchAPI
,
search
,
SearchQuery
)
import
Gargantext.API.Types
import
Gargantext.API.Upload
import
qualified
Gargantext.API.Corpus.New
as
New
import
Gargantext.Core.Types
(
HasInvalidError
(
..
))
import
Gargantext.Database.Facet
import
Gargantext.Database.Schema.Node
(
HasNodeError
(
..
),
NodeError
)
...
...
@@ -262,7 +263,7 @@ type GargAPI' =
:<|>
"count"
:>
Summary
"Count endpoint"
:>
ReqBody
'[
J
SON
]
Query
:>
CountAPI
-- Corpus endpoint
-- Corpus endpoint
--> TODO rename s/search/filter/g
:<|>
"search"
:>
Summary
"Search endpoint"
:>
ReqBody
'[
J
SON
]
SearchQuery
:>
QueryParam
"offset"
Int
...
...
@@ -280,6 +281,8 @@ type GargAPI' =
:>
Capture
"id"
NodeId
:>
TreeAPI
:<|>
"upload"
:>
ApiUpload
:<|>
"new"
:>
New
.
Api
-- :<|> "scraper" :> WithCallbacks ScraperAPI
...
...
@@ -324,6 +327,7 @@ serverGargAPI -- orchestrator
:<|>
graphAPI
-- TODO: mock
:<|>
treeAPI
:<|>
upload
:<|>
New
.
api
-- :<|> orchestrator
where
fakeUserId
=
1
-- TODO
...
...
src/Gargantext/API/Corpus/New.hs
0 → 100644
View file @
c3fc3946
{-|
Module : Gargantext.API.Corpus.New
Description : New corpus API
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
New corpus means either:
- new corpus
- new data in existing corpus
-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE OverloadedStrings #-}
module
Gargantext.API.Corpus.New
where
import
Servant
import
Gargantext.Prelude
import
Gargantext.API.Count
(
Query
(
..
))
import
Gargantext.Database.Types.Node
(
CorpusId
)
--import Gargantext.Database.Flow (flowCorpusSearchInDatabase)
type
Api
=
Summary
"New Corpus endpoint"
:>
ReqBody
'[
J
SON
]
Query
:>
Post
'[
J
SON
]
CorpusId
api
::
Monad
m
=>
Query
->
m
CorpusId
api
_
=
pure
1
src/Gargantext/API/Count.hs
View file @
c3fc3946
...
...
@@ -69,6 +69,7 @@ data QueryBool = QueryBool Text
queries
::
[
QueryBool
]
queries
=
[
QueryBool
(
pack
"(X OR X') AND (Y OR Y') NOT (Z OR Z')"
)]
--queries = [QueryBool (pack "(X + X') * (Y + Y') - (Z + Z')")]
instance
Arbitrary
QueryBool
where
arbitrary
=
elements
queries
...
...
src/Gargantext/API/test.txt
0 → 100644
View file @
c3fc3946
mercredi 15 mai 2019, 07:54:33 (UTC+0200)
src/Gargantext/Text/Crawlers.hs
0 → 100644
View file @
c3fc3946
{-|
Module : Gargantext.Text.Crawlers
Description : All crawlers of Gargantext in one file.
Copyright : (c) CNRS, 2017
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module
Gargantext.Text.Crawlers
where
--import Gargantext.Prelude
--import qualified PUBMED as PubMed
src/Gargantext/Text/Parsers/Client.sh
0 → 100644
View file @
c3fc3946
{
-# LANGUAGE DataKinds
#-}
{
-# LANGUAGE DeriveGeneric
#-}
{
-# LANGUAGE TypeOperators
#-}
{
-# LANGUAGE OverloadedStrings
#-}
{
-# LANGUAGE NoImplicitPrelude
#-}
module Gargantext.Text.Parsers.Isidore where
import Data.Text
(
Text
)
import Data.Either
import Gargantext.Prelude
import Data.Aeson
import Data.Proxy
import GHC.Generics
import Network.HTTP.Client
(
newManager
)
import Network.HTTP.Client.TLS
(
tlsManagerSettings
)
import Servant.API
import Servant.Client
type
IsidoreAPI
=
"sparql"
:> Capture
"query"
Text :> Get
'[JSON] [IsidoreDoc]
data IsidoreDoc =
IsidoreDoc {title :: Maybe Text}
deriving (Show, Generic)
instance FromJSON IsidoreDoc
instance ToJSON IsidoreDoc
isidoreDocsApi :: Proxy IsidoreAPI
isidoreDocsApi = Proxy
isidoreDocs :: ClientM [IsidoreDoc]
isidoreDocs = client isidoreDocsApi
getIsidoreDocs :: IO [IsidoreDoc]
getIsidoreDocs = do
manager'
<- newManager tlsManagerSettings
res <- runClientM isidoreDocs
$
mkClientEnv manager
' $ BaseUrl Https "https://www.rechercheisidore.fr" 8080 ""
case res of
Left _ -> panic "err"
Right res'
-> pure res
'
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