hsparql alternatives and similar packages
Based on the "Database" category.
Alternatively, view hsparql alternatives based on common mentions on social networks and blogs.
-
erd
Translates a plain text description of a relational database schema to a graphical entity-relationship diagram. -
HDBC-session
This repository includes a joined query generator based on typefull relational algebra, and mapping tools between SQL values list and Haskell record type. -
groundhog
This library maps datatypes to a relational model, in a way similar to what ORM libraries do in OOP. See the tutorial https://www.schoolofhaskell.com/user/lykahb/groundhog for introduction -
mysql-simple
A mid-level client library for the MySQL database, intended to be fast and easy to use. -
dbmigrations
DISCONTINUED. A library for the creation, management, and installation of schema updates for relational databases. -
ampersand
This repository contains the source code of the Ampersand compiler. For developing in VS-code, it contains a devcontainer. It contains a Dockerfile for generating a docker image. A commit on the main branch sets of the build street, which creates a new image in the ampersand repository in docker hub.
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of hsparql or a related project?
Popular Comparisons
README
Introduction
hsparql
includes a DSL to easily create queries, as well as methods to
submit those queries to a SPARQL server, returning the results as
simple Haskell data structures.
Select Queries
Take the following SPARQL query:
PREFIX dbpedia: <http://dbpedia.org/resource/>
PREFIX dbprop: <http://dbpedia.org/property/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?page
WHERE {
?x dbprop:genre dbpedia:Web_browser
?x foaf:name ?name
?x foaf:page ?page
}
Can be generated using the following Haskell code:
simpleSelect :: Query SelectQuery
simpleSelect = do
resource <- prefix "dbpedia" (iriRef "http://dbpedia.org/resource/")
dbpprop <- prefix "dbprop" (iriRef "http://dbpedia.org/property/")
foaf <- prefix "foaf" (iriRef "http://xmlns.com/foaf/0.1/")
x <- var
name <- var
page <- var
triple_ x (dbpprop .:. "genre") (resource .:. "Web_browser")
triple_ x (foaf .:. "name") name
triple_ x (foaf .:. "page") page
selectVars [name, page]
Construct Queries
Take the following SPARQL query:
PREFIX dbpedia: <http://dbpedia.org/resource/>
PREFIX dbprop: <http://dbpedia.org/property/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX example: <http://www.example.com/>
CONSTRUCT {
?x example:hasName ?name
}
WHERE {
?x dbprop:genre dbpedia:Web_browser
?x foaf:name ?name
?x foaf:page ?page
}
Can be generated using the following Haskell code:
simpleConstruct :: Query ConstructQuery
simpleConstruct = do
resource <- prefix "dbpedia" (iriRef "http://dbpedia.org/resource/")
dbpprop <- prefix "dbprop" (iriRef "http://dbpedia.org/property/")
foaf <- prefix "foaf" (iriRef "http://xmlns.com/foaf/0.1/")
example <- prefix "example" (iriRef "http://www.example.com/")
x <- var
name <- var
page <- var
construct <- constructTriple x (example .:. "hasName") name
triple_ x (dbpprop .:. "genre") (resource .:. "Web_browser")
triple_ x (foaf .:. "name") name
triple_ x (foaf .:. "page") page
return ConstructQuery { queryConstructs = [construct] }
Describe Queries
Take the following SPARQL query:
DESCRIBE <http://dbpedia.org/resource/Edinburgh>
Can be generated using the following Haskell code:
simpleDescribe :: Query DescribeQuery
simpleDescribe = do
resource <- prefix "dbpedia" (iriRef "http://dbpedia.org/resource/")
uri <- describeIRI (resource .:. "Edinburgh")
return DescribeQuery { queryDescribe = uri }
Ask Queries
Take the following SPARQL query:
PREFIX dbprop: <http://dbpedia.org/property/>
ASK { ?x dbprop:genre <http://dbpedia.org/resource/Web_browser> }
Can be generated using the following Haskell code:
simpleAsk :: Query AskQuery
simpleAsk = do
resource <- prefix "dbpedia" (iriRef "http://dbpedia.org/resource/")
dbprop <- prefix "dbprop" (iriRef "http://dbpedia.org/property/")
x <- var
ask <- askTriple x (dbprop .:. "genre") (resource .:. "Web_browser")
return AskQuery { queryAsk = [ask] }
Output Types
Select Queries
SELECT
queries generate a set of sparql query solutions. See:
http://www.w3.org/TR/rdf-sparql-XMLres/
selectExample :: IO ()
selectExample = do
(Just s) <- selectQuery "http://dbpedia.org/sparql" simpleSelect
putStrLn . take 500 . show $ s
Here's the respective type:
selectQuery :: EndPoint -> Query SelectQuery -> IO (Maybe [[BindingValue]])
Construct Queries
CONSTRUCT
queries generate RDF, which is serialized in N3 in this
package. See: http://www.w3.org/TR/rdf-primer/#rdfxml
constructExample :: IO ()
constructExample = do
rdfGraph <- constructQuery "http://dbpedia.org/sparql" simpleConstruct
mapM_ print (triplesOf rdfGraph)
Here's the respective type:
constructQuery :: EndPoint -> Query ConstructQuery -> IO MGraph
Describe Queries
DESCRIBE
queries generate RDF, which is serialized in N3 in this
package. See: http://www.w3.org/TR/rdf-sparql-query/#describe
describeExample :: IO ()
describeExample = do
rdfGraph <- describeQuery "http://dbpedia.org/sparql" simpleDescribe
mapM_ print (triplesOf rdfGraph
Here's the respective type:
describeQuery :: EndPoint -> Query DescribeQuery -> IO MGraph
Ask Queries
ASK
queries inspects whether or not a triple exists. RDF is an
open-world assumption. See: http://www.w3.org/TR/rdf-sparql-query/#ask
askExample :: IO ()
askExample = do
res <- askQuery "http://dbpedia.org/sparql" simpleAsk
putStrLn $ "result: " ++ (show (res::Bool))
Here's the respective type:
askQuery :: EndPoint -> Query AskQuery -> IO Bool
More examples
Some extra examples can be found in [tests](tests/Database/HSparql/QueryGeneratorTest.hs).
TODOs
Opt for a unified Type representation This hsparql package and the RDF4H package use similar, but not identical, types for triples, namespaces, prefixes and so on. Ideally, one type representation for such concepts should be adopted for both packages.
Develop a unified semantic web toolkit for Haskell Combining the RDF4H and hsparql packages seems like a sensible goal to achieve, to provide a semantic web toolkit similar to Jena for Java.
*Note that all licence references and agreements mentioned in the hsparql README section above
are relevant to that project's source code only.