module Graphics.Ubigraph (
module Graphics.Ubigraph.Base,
module Graphics.Ubigraph.Style,
clear,
newVertex, removeVertex,
newEdge, removeEdge,
newVertexWithID, newEdgeWithID,
setVAttr, setEAttr,
) where
import Control.Monad.Reader (ReaderT(..), runReaderT, asks, liftIO, lift)
import Network.XmlRpc.Client (remote)
import Data.Char (toLower)
import Graphics.Ubigraph.Base
import Graphics.Ubigraph.Style
toBool :: IO Int -> IO Bool
toBool x = do
x' <- x
return $ if x' == 0 then True else False
clear :: Hubigraph Bool
clear =
do serv <- asks server
liftIO . toBool $ remote serv "ubigraph.clear"
newVertex :: Hubigraph VertexID
newVertex =
do serv <- asks server
liftIO $ remote serv "ubigraph.new_vertex"
removeVertex :: VertexID -> Hubigraph Bool
removeVertex vid =
do serv <- asks server
liftIO . toBool $ remote serv "ubigraph.remove_vertex" vid
newEdge :: Edge -> Hubigraph EdgeID
newEdge (src,dst) =
do serv <- asks server
liftIO $ remote serv "ubigraph.new_edge" src dst
removeEdge :: EdgeID -> Hubigraph Bool
removeEdge eid =
do serv <- asks server
liftIO . toBool $ remote serv "ubigraph.remove_edge" eid
newVertexWithID :: VertexID -> Hubigraph Bool
newVertexWithID node =
do serv <- asks server
liftIO . toBool $ remote serv "ubigraph.new_vertex_w_id" node
newEdgeWithID :: EdgeID -> Edge -> Hubigraph Bool
newEdgeWithID eid (src,dst) =
do serv <- asks server
liftIO . toBool $ remote serv "ubigraph.new_edge_w_id" eid src dst
setVAttr :: VAttr -> VertexID -> Hubigraph Bool
setVAttr va vid =
do serv <- asks server
liftIO . toBool $ remote serv "ubigraph.set_vertex_attribute" vid k v
where (k, v) = toPair va
setEAttr :: EAttr -> EdgeID -> Hubigraph Bool
setEAttr ea eid =
do serv <- asks server
liftIO . toBool $ remote serv "ubigraph.set_edge_attribute" eid k v
where (k, v) = toPair ea