robstewart57/hsparql

QueryGenerator does not export Prefix

hegel5000 opened this issue · 2 comments

Given that the public interfaces for many functions in QueryGenerator deal with values of type Prefix, I'm assuming that the type Prefix was meant to be exported? Anyways, great library!

Hi Ian,

A value of type Prefix can be constructed in the Query monad with prefix:

prefix :: Text -> IRIRef -> Query Prefix

For example, to form an IRIRef:

dbpprop  <- prefix "dbpedia" (iriRef "http://dbpedia.org/property/")
let genreIRI = (dbpprop .:. "genre")

Does that help?

Hey!

My main problem is that I have a top-level function which has a Prefix
value as input. Obviously, type signatures on top-level values aren't
necessary, but it's considered more proper to have them, and I like
having them. I kinda just assumed that you meant to export the type but
maybe forgot to, so I wanted to be sure.

Thanks!
Ian

p.s. retSelField' is the particular function. It's to deal with the common
case of querying "everything which has fields x y and z".

retSelField' :: [T.Text] -> Prefix -> Query SelectQuery
retSelField' fields prefix = var >>= \ primary
-> retSelField (\ field -> triple primary $ prefix.:.field ) fields

retSelField
:: (T.Text -> Variable -> Query Pattern) -> [T.Text] -> Query SelectQuery
retSelField toQueryP fields = replicateM (length fields) var >>= \ vars
-> mapM (uncurry toQueryP) (zip fields vars)

(return SelectQuery{queryVars = vars})

On Mon, Aug 3, 2015 at 3:24 PM, Rob Stewart notifications@github.com
wrote:

Hi Ian,

A value of type Prefix can be constructed in the Query monad with prefix:

prefix :: Text -> IRIRef -> Query Prefix

For example, to form an IRIRef:

dbpprop <- prefix "dbpedia" (iriRef "http://dbpedia.org/property/")
let genreIRI = (dbpprop .:. "genre")

Does that help?


Reply to this email directly or view it on GitHub
#14 (comment)
.