swish-0.9.2.1: A semantic web toolkit.

Copyright(c) 2003 Graham Klyne 2009 Vasili I Galchin
2011 2012 Douglas Burke
LicenseGPL V2
MaintainerDouglas Burke
Stabilityexperimental
PortabilityH98
Safe HaskellNone
LanguageHaskell98

Swish.Monad

Contents

Description

Composed state and IO monad for Swish

Synopsis

Documentation

type SwishStateIO a = StateT SwishState IO a #

The state monad used in executing Swish programs.

data SwishState #

The State for a Swish "program".

Constructors

SwishState 

Fields

data SwishFormat #

The supported input and output formats.

Constructors

Turtle

Turtle format

N3

N3 format

NT

NTriples format

type NamedGraphMap = Map ScopedName [RDFGraph] #

A LookupMap for the graphs dictionary.

Create and modify the Swish state

emptyState :: SwishState #

The default state for Swish: no loaded graphs or rules, and format set to N3.

setFormat :: SwishFormat -> SwishState -> SwishState #

Change the format.

setBase :: Maybe QName -> SwishState -> SwishState #

Change (or remove) the base URI.

setGraph :: RDFGraph -> SwishState -> SwishState #

Change the current graph.

modGraphs :: (NamedGraphMap -> NamedGraphMap) -> SwishState -> SwishState #

Modify the named graphs.

findGraph :: ScopedName -> SwishState -> Maybe [RDFGraph] #

Find a named graph.

findFormula :: ScopedName -> SwishState -> Maybe RDFFormula #

Find a formula. The search is first made in the named graphs and then, if not found, the rulesets.

modRules :: (RDFRuleMap -> RDFRuleMap) -> SwishState -> SwishState #

Modify the named rules.

findRule :: ScopedName -> SwishState -> Maybe RDFRule #

Find a named rule.

modRulesets :: (RDFRulesetMap -> RDFRulesetMap) -> SwishState -> SwishState #

Modify the rule sets.

findDatatype :: ScopedName -> SwishState -> Maybe RDFDatatype #

Find a data type declaration.

setInfo :: String -> SwishState -> SwishState #

Set the information message.

resetInfo :: SwishState -> SwishState #

Clear the information message.

setError :: String -> SwishState -> SwishState #

Set the error message.

resetError :: SwishState -> SwishState #

Clear the error message.

setStatus :: SwishStatus -> SwishState -> SwishState #

Set the status.

Error handling

swishError :: String -> SwishStatus -> SwishStateIO () #

Report error and set exit status code

reportLine :: String -> SwishStateIO () #

Output the text to the standard error stream (a new line is added to the output).