Isidore: make the sparql request using Wreq because httpS is required

parent a785f474
...@@ -163,6 +163,7 @@ library: ...@@ -163,6 +163,7 @@ library:
- wai-cors - wai-cors
- wai-extra - wai-extra
- warp - warp
- wreq
- xml-conduit - xml-conduit
- xml-types - xml-types
- yaml - yaml
......
...@@ -11,13 +11,29 @@ import Database.HSparql.QueryGenerator ...@@ -11,13 +11,29 @@ import Database.HSparql.QueryGenerator
-- import Data.RDF hiding (triple) -- import Data.RDF hiding (triple)
import Data.Text hiding (groupBy) import Data.Text hiding (groupBy)
route = "http://isidore.science/sparql/" import Control.Lens hiding (contains)
import Data.ByteString.Lazy (ByteString)
import Prelude (String)
import Network.Wreq
route = "https://isidore.science/sparql/"
selectQueryRaw' :: String -> String -> IO (Response ByteString)
selectQueryRaw' uri q = getWith opts uri
where
opts = defaults & header "Accept" .~ ["application/sparql-results+xml"]
& header "User-Agent" .~ ["gargantext-hsparql-client"]
& param "query" .~ [Data.Text.pack q]
--selectExample :: IO (Maybe [Text]) --selectExample :: IO (Maybe [Text])
isidore q = do isidore q = do
res <- selectQuery route $ simpleSelect q let s = createSelectQuery $ simpleSelect q
pure res putStrLn s
r <- selectQueryRaw' route s
putStrLn $ show $ r ^. responseStatus
pure $ r ^. responseBody
-- res <- selectQuery route $ simpleSelect q
-- pure res
simpleSelect :: Text -> Query SelectQuery simpleSelect :: Text -> Query SelectQuery
simpleSelect q = do simpleSelect q = do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment