[Haskell-cafe] Has anyone used Graql in Haskell?
Jeffrey Brown
jeffbrown.the at gmail.com
Fri Mar 17 18:32:45 UTC 2017
Thanks, Vasiliy and MarLinn! I didn't realize the underlying behemoth was
proprietary. That's a deal-killer for me.
I was excited about Graql because they say it makes nested relationships
easy to represent. I once wrote a toolkit in Haskell for that[1], using the
Functional Graph Library. Below I've included a demo of it, in case anyone
is interested. I would like to integrate it with Sparql and other semweb
tools.
[1] https://github.com/JeffreyBenjaminBrown/digraphs-with-text/
-- make an empty graph
> let g = empty :: RSLT
-- add three words to it
> g <- pure $ foldl (flip insWord) g ["the cat","water","living organism"]
-- add three relationship templates.
-- Templates resemble edge labels, but with arbitrary arity and nesting.
> g <- pure $ foldl (flip insTplt) g ["_ needs _", "_ is a _","_ because _"]
-- view the graph so far
> view g $ nodes g
(0,"the cat") -- Expressions 0, 1 and 2 are "Words"
(1,"water")
(2,"living organism")
(3,"_ #needs _") -- Expressions 3, 4 and 5 are "Tplts" (relationship
templates)
(4,"_ #(is a) _")
(5,"_ #because _")
-- use the relationship templates to create two relationships
> g <- pure $ fromRight $ insRel 3 [0,1] g
> g <- pure $ fromRight $ insRel 4 [0,2] g
> view g $ nodes g
(0,"the cat")
(1,"water")
(2,"living organism")
(3,"_ #needs _")
(4,"_ #(is a) _")
(5,"_ #because _")
(6,"the cat ##needs water") -- nodes 6 and 7 are the new relationships
(7,"the cat ##(is a) living organism")
-- nesting! create a "because" relationship between relationships 6 and 7
> g <- pure $ fromRight $ insRel 5 [6,7] g
> view g $ nodes g
(0,"the cat")
(1,"water")
(2,"living organism")
(3,"_ #needs _")
(4,"_ #(is a) _")
(5,"_ #because _")
(6,"the cat ##needs water")
(7,"the cat ##(is a) living organism")
(8,"the cat ##needs water ####because the cat ##(is a) living organism")
>
On Fri, Mar 17, 2017 at 10:14 AM, Vasiliy <vasiliy.l at gmail.com> wrote:
> Hi
>
> Grakn.ai data model looks very much like RDF[1] with SPARQL[2] as a query
> language. There are quite a few data stores, owl reasoners and various
> libraries to work with rdf. There are haskell packages as well: rdf4h[3]
> for
> data representation, hsparql[4] to create and submit queries to sparql
> stores,
> swish[5] is a semantic web toolkit.
>
> Hope that would be helpful for you.
>
>
> [1] https://www.w3.org/TR/rdf11-concepts/
> [2] https://www.w3.org/TR/sparql11-query/
> [3] https://hackage.haskell.org/package/rdf4h
> [4] https://hackage.haskell.org/package/hsparql
> [5] https://hackage.haskell.org/package/swish
>
> --
> Best Regards
> Vasiliy
>
> On 03/14/2017 06:53 AM, Jeffrey Brown wrote:
>
>> Graql[1] is a (and stands for) graph query language. It is unusually
>> expressive, allowing relationships to be members of other relationships[2]
>> -- effectively, allowing one edge to be an endpoint of another edge.
>>
>> Someone named Felix posted a Haskell library for generating Graql
>> queries[3].
>>
>> Does anyone have a Haskell program that not only generates but uses such a
>> query?
>>
>>
>> [1] https://hackage.haskell.org/package/graql
>> [2] https://discuss.grakn.ai/t/nested-relationships/
>> [3] https://discuss.grakn.ai/t/graql-haskell-how-to-run-the-test-program/
>>
>>
>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>>
>> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
--
Jeff Brown | Jeffrey Benjamin Brown
Website <https://msu.edu/~brown202/> | Facebook
<https://www.facebook.com/mejeff.younotjeff> | LinkedIn
<https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often miss
messages here) | Github <https://github.com/jeffreybenjaminbrown>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170317/08097e58/attachment.html>
More information about the Haskell-Cafe
mailing list