Popularity
5.6
Stable
Activity
0.0
Stable
4
3
4

Monthly Downloads: 9
Programming language: Haskell
License: Apache License 2.0
Tags: Graphs     Database    

grakn alternatives and similar packages

Based on the "Database" category.
Alternatively, view grakn alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of grakn or a related project?

Add another 'Database' Package

README

Grakn Haskell Client (DEPRECATED)

A Haskell client for Grakn.

Requires Grakn 1.0.0.

Installation

To install the Grakn client, simply add this to your cabal file:

build-depends: grakn

You will also need access to a Grakn database. Head here to get started with Grakn.

Quickstart

Begin by importing the client:

{-# LANGUAGE OverloadedStrings #-}

module Example where

import Grakn

import Data.Function ((&))

Define the type labels:

person :: Label
person = label "person"

husband :: Label
husband = label "husband"

wife :: Label
wife = label "wife"

marriage :: Label
marriage = label "marriage"

Define the variables:

x :: Var
x = var "x"

y :: Var
y = var "y"

We can translate the following query into Haskell:

match $x isa person, (husband: $x, wife: $y) isa marriage; get $y;
query :: GetQuery
query = match
    [ x `isa` person
    , rel [husband .: x, wife .: y] `isa` marriage
    ] & get [y]

We can also use infix functions like (-:) instead of isa:

otherQuery :: GetQuery
otherQuery = match
    [ x -: person
    , rel [husband .: x, wife .: y] -: marriage
    ] & get [y]

To execute and print the results of our query:

client :: Client
client = Client defaultUrl "my-keyspace"

main :: IO ()
main = do
    result <- execute client query
    print result