net-spider-0.1.0.0: A graph database middleware to maintain a time-varying graph.

MaintainerToshio Ito <debug.ito@gmail.com>
Safe HaskellNone
LanguageHaskell2010

NetSpider.Spider

Contents

Description

 
Synopsis

Spider type

data Spider n na fla Source #

An IO agent of the NetSpider database.

  • Type n: node ID. Note that type of node ID has nothing to do with type of vertex ID used by Gremlin implementation. Node ID (in net-spider) is stored as a vertex property. See nodeIdKey config field.
  • Type na: node attributes. It should implement NodeAttributes class. You can set this to () if you don't need node attributes.
  • Type fla: attributes of found links. It should implement LinkAttributes class. You can set this to () if you don't need link attributes.

Make Spider

connectWS :: Eq n => Host -> Port -> IO (Spider n na la) Source #

Connect to the WebSocket endpoint of Tinkerpop Gremlin Server that hosts the NetSpider database.

connectWith :: Config n na fla -> IO (Spider n na fla) Source #

Connect to the server with the given Config.

Close Spider

close :: Spider n na fla -> IO () Source #

Close and release the Spider object.

Graph operations

addFoundNode :: (ToJSON n, LinkAttributes fla, NodeAttributes na) => Spider n na fla -> FoundNode n na fla -> IO () Source #

Add a FoundNode (observation of a node) to the NetSpider database.

getSnapshotSimple Source #

Arguments

:: (FromGraphSON n, ToJSON n, Ord n, Hashable n, LinkAttributes fla, NodeAttributes na) 
=> Spider n na fla 
-> n

ID of the node where it starts traversing.

-> IO ([SnapshotNode n na], [SnapshotLink n fla]) 

Simple version of getSnapshot. It builds the snapshot graph by traversing the history graph from the given starting node.

This function is very simple, and should be used only for small graphs.

getSnapshot :: (FromGraphSON n, ToJSON n, Ord n, Hashable n, LinkAttributes fla, NodeAttributes na) => Spider n na fla -> Query n na fla sla -> IO ([SnapshotNode n na], [SnapshotLink n sla]) Source #

Get the snapshot graph from the history graph as specified by the Query.

clearAll :: Spider n na fla -> IO () Source #

Clear all content in the NetSpider database. This is mainly for testing.