swish-0.10.0.2: 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 Source #

The state monad used in executing Swish programs.

data SwishState Source #

The State for a Swish "program".

Constructors

SwishState 

Fields

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

Instances
Eq SwishFormat Source # 
Instance details

Defined in Swish.Monad

Show SwishFormat Source # 
Instance details

Defined in Swish.Monad

type NamedGraphMap = Map ScopedName [RDFGraph] Source #

A LookupMap for the graphs dictionary.

Create and modify the Swish state

emptyState :: SwishState Source #

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

setFormat :: SwishFormat -> SwishState -> SwishState Source #

Change the format.

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

Change (or remove) the base URI.

setGraph :: RDFGraph -> SwishState -> SwishState Source #

Change the current graph.

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

Modify the named graphs.

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

Find a named graph.

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

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

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

Modify the named rules.

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

Find a named rule.

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

Find a data type declaration.

setInfo :: String -> SwishState -> SwishState Source #

Set the information message.

resetInfo :: SwishState -> SwishState Source #

Clear the information message.

setError :: String -> SwishState -> SwishState Source #

Set the error message.

resetError :: SwishState -> SwishState Source #

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).