swish-0.9.0.1: A semantic web toolkit.

PortabilityH98
Stabilityexperimental
MaintainerDouglas Burke
Safe HaskellNone

Swish.Monad

Contents

Description

Composed state and IO monad for Swish

Synopsis

Documentation

type SwishStateIO a = StateT SwishState IO aSource

The state monad used in executing Swish programs.

data SwishState Source

The State for a Swish "program".

Constructors

SwishState 

Fields

format :: SwishFormat

format to use for I/O

base :: Maybe QName

base to use rather than file name

graph :: RDFGraph

current graph

graphs :: NamedGraphMap

script processor named graphs

rules :: RDFRuleMap

script processor named rules

rulesets :: RDFRulesetMap

script processor rulesets

infomsg :: Maybe String

information message, or Nothing

errormsg :: Maybe String

error message, or Nothing

exitcode :: SwishStatus

current status

data SwishStatus Source

Status of the processor

Constructors

SwishSuccess

successful run

SwishGraphCompareError

graphs do not compare

SwishDataInputError

input data problem (ie format/syntax)

SwishDataAccessError

data access error

SwishArgumentError

command-line argument error

SwishExecutionError

error executing a Swish script

data SwishFormat Source

The supported input and output formats.

Constructors

Turtle

Turtle format

N3

N3 format

NT

NTriples format

type NamedGraphMap = Map ScopedName [RDFGraph]Source

A LookupMap for the graphs dictionary.

Create and modify the Swish state

emptyState :: SwishStateSource

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

setFormat :: SwishFormat -> SwishState -> SwishStateSource

Change the format.

setBase :: Maybe QName -> SwishState -> SwishStateSource

Change (or remove) the base URI.

setGraph :: RDFGraph -> SwishState -> SwishStateSource

Change the current graph.

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

Modify the named graphs.

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

Find a named graph.

findFormula :: ScopedName -> SwishState -> Maybe RDFFormulaSource

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

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

Modify the named rules.

findRule :: ScopedName -> SwishState -> Maybe RDFRuleSource

Find a named rule.

findDatatype :: ScopedName -> SwishState -> Maybe RDFDatatypeSource

Find a data type declaration.

setInfo :: String -> SwishState -> SwishStateSource

Set the information message.

resetInfo :: SwishState -> SwishStateSource

Clear the information message.

setError :: String -> SwishState -> SwishStateSource

Set the error message.

resetError :: SwishState -> SwishStateSource

Clear the error message.

Error handling

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

Report error and set exit status code

reportLine :: String -> SwishStateIO ()Source

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