Safe Haskell | None |
---|---|
Language | Haskell2010 |
- defaultCayleyConfig :: CayleyConfig
- connectCayley :: CayleyConfig -> IO CayleyConnection
- query :: CayleyConnection -> Text -> IO (Either String Value)
- writeQuad :: CayleyConnection -> Text -> Text -> Text -> Maybe Text -> IO (Maybe Value)
- deleteQuad :: CayleyConnection -> Text -> Text -> Text -> Maybe Text -> IO (Maybe Value)
- writeQuads :: CayleyConnection -> [Quad] -> IO (Maybe Value)
- deleteQuads :: CayleyConnection -> [Quad] -> IO (Maybe Value)
- writeNQuadFile :: (MonadIO m, MonadThrow m) => CayleyConnection -> FilePath -> m (Maybe Value)
- successfulResults :: Maybe Value -> IO (Either String Int)
Documentation
defaultCayleyConfig :: CayleyConfig Source
CayleyConfig { serverPort = 64210 , serverName = "localhost" , apiVersion = V1 , queryLang = Gremlin }
connectCayley :: CayleyConfig -> IO CayleyConnection Source
Get a connection to Cayley with the given configuration.
λ> conn <- connectCayley defaultCayleyConfig
query :: CayleyConnection -> Text -> IO (Either String Value) Source
Perform a query in Gremlin graph query language per default (or in MQL).
λ> query conn "graph.Vertex('Humphrey Bogart').In('name').All()" Right (Array (fromList [Object (fromList [("id",String "/en/humphrey_bogart")])]))
:: CayleyConnection | |
-> Text | Subject node |
-> Text | Predicate node |
-> Text | Object node |
-> Maybe Text | Label node |
-> IO (Maybe Value) |
Write a Quad
with the given subject, predicate, object and optional
label. Throw result or extract amount of query successfulResults
from it.
λ> writeQuad conn "Humphrey" "loves" "Lauren" (Just "In love") Just (Object (fromList [("result",String "Successfully wrote 1 triples.")]))
deleteQuad :: CayleyConnection -> Text -> Text -> Text -> Maybe Text -> IO (Maybe Value) Source
Delete the Quad
defined by the given subject, predicate, object
and optional label.
writeQuads :: CayleyConnection -> [Quad] -> IO (Maybe Value) Source
Write the given list of Quad
(s).
deleteQuads :: CayleyConnection -> [Quad] -> IO (Maybe Value) Source
Delete the given list of Quad
(s).
writeNQuadFile :: (MonadIO m, MonadThrow m) => CayleyConnection -> FilePath -> m (Maybe Value) Source
Write a N-Quad file.