Portability | H98 |
---|---|
Stability | experimental |
Maintainer | Douglas Burke |
Safe Haskell | None |
Composed state and IO monad for Swish
- type SwishStateIO a = StateT SwishState IO a
- data SwishState = SwishState {
- format :: SwishFormat
- base :: Maybe QName
- graph :: RDFGraph
- graphs :: NamedGraphMap
- rules :: RDFRuleMap
- rulesets :: RDFRulesetMap
- infomsg :: Maybe String
- errormsg :: Maybe String
- exitcode :: SwishStatus
- data SwishStatus
- data SwishFormat
- type NamedGraphMap = Map ScopedName [RDFGraph]
- emptyState :: SwishState
- setFormat :: SwishFormat -> SwishState -> SwishState
- setBase :: Maybe QName -> SwishState -> SwishState
- setGraph :: RDFGraph -> SwishState -> SwishState
- modGraphs :: (NamedGraphMap -> NamedGraphMap) -> SwishState -> SwishState
- findGraph :: ScopedName -> SwishState -> Maybe [RDFGraph]
- findFormula :: ScopedName -> SwishState -> Maybe RDFFormula
- modRules :: (RDFRuleMap -> RDFRuleMap) -> SwishState -> SwishState
- findRule :: ScopedName -> SwishState -> Maybe RDFRule
- modRulesets :: (RDFRulesetMap -> RDFRulesetMap) -> SwishState -> SwishState
- findRuleset :: ScopedName -> SwishState -> Maybe RDFRuleset
- findOpenVarModify :: ScopedName -> SwishState -> Maybe RDFOpenVarBindingModify
- findDatatype :: ScopedName -> SwishState -> Maybe RDFDatatype
- setInfo :: String -> SwishState -> SwishState
- resetInfo :: SwishState -> SwishState
- setError :: String -> SwishState -> SwishState
- resetError :: SwishState -> SwishState
- setStatus :: SwishStatus -> SwishState -> SwishState
- swishError :: String -> SwishStatus -> SwishStateIO ()
- reportLine :: String -> SwishStateIO ()
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".
SwishState | |
|
data SwishStatus Source
Status of the processor
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.
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.
modRulesets :: (RDFRulesetMap -> RDFRulesetMap) -> SwishState -> SwishStateSource
Modify the rule sets.
findRuleset :: ScopedName -> SwishState -> Maybe RDFRulesetSource
Find a rule set.
findOpenVarModify :: ScopedName -> SwishState -> Maybe RDFOpenVarBindingModifySource
Find a modify 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.
setStatus :: SwishStatus -> SwishState -> SwishStateSource
Set the status.
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).