1 {-# LANGUAGE NoImplicitPrelude #-}
2 {-# LANGUAGE ScopedTypeVariables #-}
3 {-# LANGUAGE OverloadedStrings #-}
5 module Gargantext.Text.Parsers.Isidore where
7 import Gargantext.Prelude
8 import Database.HSparql.Connection
9 import Database.HSparql.QueryGenerator
11 -- import Data.RDF hiding (triple)
12 import Data.Text hiding (groupBy)
14 route = "http://isidore.science/sparql/"
17 --selectExample :: IO (Maybe [Text])
19 res <- selectQuery route $ simpleSelect q
22 simpleSelect :: Text -> Query SelectQuery
24 isidore <- prefix "isidore" (iriRef "http://www.rechercheisidore.fr/class")
25 rdf <- prefix "rdf" (iriRef "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
26 dcterms <- prefix "dcterms" (iriRef "http://purl.org/dc/terms")
27 dc <- prefix "dc" (iriRef "http://purl.org/dc")
35 triple doc (rdf .:. "type") (isidore .:. "BibliographicalResource")
36 triple doc (dcterms .:. "title") title
37 triple doc (dcterms .:. "date") date
38 triple doc (dcterms .:. "source") source
39 triple doc (dc .:. "description") abstract
41 filterExpr $ (.||.) (contains title q) (contains abstract q)
45 selectVars [title, date, source, abstract]