Commit c2dbcba7 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TEXT][Parsers][Isidore] working query.

parent c1292008
Pipeline #78 canceled with stage
...@@ -22,9 +22,9 @@ route = "https://isidore.science/sparql/" ...@@ -22,9 +22,9 @@ route = "https://isidore.science/sparql/"
selectQueryRaw' :: String -> String -> IO (Response ByteString) selectQueryRaw' :: String -> String -> IO (Response ByteString)
selectQueryRaw' uri q = getWith opts uri selectQueryRaw' uri q = getWith opts uri
where where
opts = defaults & header "Accept" .~ ["application/sparql-results+xml"] opts = defaults & header "Accept" .~ ["application/sparql-results+xml"]
& header "User-Agent" .~ ["gargantext-hsparql-client"] & header "User-Agent" .~ ["gargantext-hsparql-client"]
& param "query" .~ [Data.Text.pack q] & param "query" .~ [Data.Text.pack q]
isidoreGet :: Text -> IO ByteString isidoreGet :: Text -> IO ByteString
isidoreGet q = do isidoreGet q = do
...@@ -38,25 +38,47 @@ isidoreGet q = do ...@@ -38,25 +38,47 @@ isidoreGet q = do
simpleSelect :: Text -> Query SelectQuery simpleSelect :: Text -> Query SelectQuery
simpleSelect q = do simpleSelect q = do
isidore <- prefix "isidore" (iriRef "http://www.rechercheisidore.fr/class") -- See Predefined Namespace Prefixes:
-- https://isidore.science/sparql?nsdecl
isidore <- prefix "isidore" (iriRef "http://www.rechercheisidore.fr/class/")
rdf <- prefix "rdf" (iriRef "http://www.w3.org/1999/02/22-rdf-syntax-ns#") rdf <- prefix "rdf" (iriRef "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
dcterms <- prefix "dcterms" (iriRef "http://purl.org/dc/terms") dcterms <- prefix "dcterms" (iriRef "http://purl.org/dc/terms/")
dc <- prefix "dc" (iriRef "http://purl.org/dc") dc <- prefix "dc" (iriRef "http://purl.org/dc/elements/1.1/")
ore <- prefix "ore" (iriRef "http://www.openarchives.org/ore/terms/")
bif <- prefix "bif" (iriRef "bif:")
doc <- var link <- var
title <- var title <- var
--date <- var date <- var
abstract <- var abstract <- var
--source <- var authors <- var
source <- var
lang <- var
publisher <- var
agg <- var
triple_ doc (rdf .:. "type") (isidore .:. "BibliographicalResource") indexT <- var
triple_ doc (dcterms .:. "title") title
--triple doc (dcterms .:. "date") date triple_ link (rdf .:. "type") (isidore .:. "BibliographicalResource")
--triple doc (dcterms .:. "source") source triple_ link (dcterms .:. "title") title
triple doc (dc .:. "description") abstract triple_ link (dcterms .:. "date") date
triple_ link (dcterms .:. "creator") authors
triple_ link (dcterms .:. "language") lang
triple_ link (dcterms .:. "source") source
triple_ link (ore .:. "isAggregatedBy") agg
--triple_ agg (dcterms .:. "title") title
optional $ triple_ link (dcterms .:. "publisher") publisher
optional $ triple_ link (dc .:. "description") abstract
--filterExpr $ (.||.) (contains title q) (contains abstract q) --filterExpr $ (.||.) (contains title q) (contains abstract q)
filterExpr_ (contains title q) -- (contains abstract q)
limit_ 3
selectVars [title] --triple_ indexT (bif .:. "contains") title
--filterExpr_ (contains indexT q) -- (contains abstract q)
orderNextDesc date
limit_ 10
distinct_
selectVars [link, date, authors, source, title, lang, publisher, abstract]
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