Quantcast

Has anyone used Graql in Haskell?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Has anyone used Graql in Haskell?

Jeffrey Brown
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?




--
Jeff Brown | Jeffrey Benjamin Brown
Website   |   Facebook   |   LinkedIn(spammy, so I often miss messages here)   |   Github

_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Has anyone used Graql in Haskell?

MarLinn

Hi Jeffrey,

at least two of the pages you link to reference the github of the package, which has a very short example. That alone is not very useful, but the magic seems to happen in the runMatch function. That function obviously comes from is the package you linked to, so we know where to find the source code. There you can see that runMatch basically just calls runGraql. (And it also presents the results in a somewhat nicer form than pure json, but that's not relevant.) The runGraql function in turn is just a few lines below in the source code and exposes that it does nothing more than call the graql.sh shell script. So all the library does is to add a bit of Haskell type checking on top of the Java+JavaScript+Bash proprietary behemoth. That means even if someone has a Haskell program, the core question is how to use the graql.sh script – which is outside the scope of a Haskell mailing list I suppose, but I hope the Grakn project has some documentation about that.

The Grakn approach to modeling a knowledge graph looks good, but I'm not even sure if we have something equivalent Haskell-side. We do have the necessary hypergraph libraries and all, and it's a fun area, so we probably do. But I highly doubt whatever we do have supports Graql. After all, why use an extra language if you can use functions directly? Sorry I have to disappoint you there.

Cheers,
MarLinn

On 2017-03-14 04:53, 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?




--
Jeff Brown | Jeffrey Benjamin Brown
Website   |   Facebook   |   LinkedIn(spammy, so I often miss messages here)   |   Github


_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Has anyone used Graql in Haskell?

Vasiliy
In reply to this post by Jeffrey Brown
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Has anyone used Graql in Haskell?

Jeffrey Brown
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.


-- 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 <[hidden email]> 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   |   Facebook   |   LinkedIn(spammy, so I often miss messages here)   |   Github   

_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Has anyone used Graql in Haskell?

MarLinn

Thanks, Vasiliy and MarLinn! I didn't realize the underlying behemoth was proprietary. That's a deal-killer for me.

Don't just take my word for it. I didn't look at licensing terms or anything. The thing is, it seems to be a startup company, but nowhere did I find what they actually sell. No company can survive without income and there's no mention of support contracts, so I just assumed it must be the software itself, somehow. I just called it "proprietary" because for me there would be no difference: a company that doesn't tell me where the catch is is trying to catch me off guard, so they're working on the level of thugs. Ergo, without me, no matter how interesting the product looks. But I'm a harsh customer and it might be an unintentional blunder seeing how they're a startup, so YMMV.

That being said, I don't see a problem representing nested relationships in RDF. And with how simple Graql is, even if Sparql shouldn't fit your needs you might be able to adapt something Graql-like? Sounds like an interesting project in any case!

Cheers,
MarLinn

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.


-- 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 <[hidden email]> 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   |   Facebook   |   LinkedIn(spammy, so I often miss messages here)   |   Github   


_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Has anyone used Graql in Haskell?

Richard A. O'Keefe
In reply to this post by Jeffrey Brown
> Thanks, Vasiliy and MarLinn! I didn't realize the underlying behemoth was
> proprietary. That's a deal-killer for me.

Colour me surprised.
https://github.com/graknlabs/grakn
says that the source code is under GPL-3.0.

Any RDF kit, like ClioPatria, should be able to do the kind
of thing you want.  Scaling and reliability will vary.


_______________________________________________
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.
Loading...