Skip to content

silky/graql-haskell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple library for building and executing Graql queries.

Import the modules:

module Example where

import Graql
import Graql.Shell

import Data.Function ((&))

Define the type names:

person = name "person"
husband = name "husband"
wife = name "wife"
marriage = name "marriage"

Define the variables:

x = var "x"
y = var "y"

We can translate the following query into Haskell:

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

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

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

To execute and print the results of our query:

main = do
    result <- runMatch query
    print result

About

A library for building and executing Graql queries on a Grakn knowledge graph using Haskell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published