Copyright | (c) Simon Ulbricht DFKI GmbH 2011 |
---|---|
License | GPLv2 or higher, see LICENSE.txt |
Maintainer | tekknix@informatik.uni-bremen.de |
Stability | provisional |
Portability | non-portable (DevGraph) |
Safe Haskell | None |
break down Common.XPath.Expr into a simpler path description and transfer into cursor movement.
Synopsis
- data SimplePath = SimplePath {
- steps :: [Finder]
- changeData :: ChangeData
- data Finder = FindBy QName [Attr] Int
- data ChangeData = ChangeData ChangeSel (Maybe String)
- exprToSimplePath :: MonadFail m => Change -> m SimplePath
- mkFinder :: MonadFail m => Finder -> [Expr] -> m Finder
- mkFinderAux :: MonadFail m => Finder -> Expr -> m Finder
- mkAttr :: MonadFail m => [Expr] -> m Attr
- data ChangeList = ChangeList {
- deleteNodes :: Set NodeName
- deleteLinks :: Set XLink
- changeNodes :: Map NodeName ChangeAction
- changeLinks :: Map EdgeId ChangeAction
- data ChangeAction
- updateNodeChange :: ChangeAction -> NodeName -> ChangeList -> ChangeList
- retrieveNodeChange :: NodeName -> ChangeList -> Maybe (ChangeAction, ChangeList)
- updateLinkChange :: ChangeAction -> EdgeId -> ChangeList -> ChangeList
- retrieveLinkChange :: EdgeId -> ChangeList -> Maybe (ChangeAction, ChangeList)
- mergeChA :: ChangeAction -> ChangeAction -> ChangeAction
- emptyChangeList :: ChangeList
- data Direction
- changeXml :: MonadFail m => Element -> String -> m (Element, ChangeList)
- changeXmlMod :: MonadFail m => Element -> Element -> m (Element, ChangeList)
- iterateXml :: MonadFail m => Direction -> [SimplePath] -> Cursor -> ChangeList -> m (Cursor, ChangeList)
- data ChangeRes
- applyChanges :: MonadFail m => [ChangeData] -> Cursor -> Direction -> ChangeList -> m (Cursor, ChangeList)
- removeFindLeft :: (Cursor -> Bool) -> Cursor -> Maybe Cursor
- moveDown :: MonadFail m => Direction -> Cursor -> m Cursor
- moveUp :: MonadFail m => Direction -> Cursor -> m Cursor
- isElem :: Cursor -> Bool
- applyChange :: MonadFail m => ChangeRes -> ChangeData -> m ChangeRes
- changeText :: MonadFail m => String -> Cursor -> m ChangeRes
- removeOrChangeAttr :: MonadFail m => Maybe String -> Cursor -> String -> m ChangeRes
- applyAddOp :: MonadFail m => Insert -> Cursor -> AddChange -> m Cursor
- propagatePaths :: MonadFail m => Cursor -> [SimplePath] -> m ([ChangeData], [SimplePath], [SimplePath])
- updateChangeList :: MonadFail m => Cursor -> ChangeList -> ChangeData -> m ChangeList
- mkAddChange :: MonadFail m => Cursor -> ChangeList -> AddChange -> m ChangeList
- mkUpdateChange :: MonadFail m => NodeMod -> ChangeList -> Cursor -> m ChangeList
- mkRemoveChange :: MonadFail m => ChangeList -> Cursor -> m ChangeList
- nameStringIs :: String -> Element -> Bool
- isSymbolType :: Element -> Bool
- isSentenceType :: Element -> Bool
- isAxiomType :: Element -> Bool
- isTheoremType :: Element -> Bool
- isDgNodeElem :: Element -> Bool
- isDgLinkElem :: Element -> Bool
Documentation
data SimplePath Source #
SimplePath | |
|
Finder stores predicate list to locate the element and an index, in case multiple elements comply with the predicate
FindBy QName [Attr] Int |
data ChangeData Source #
ChangeData ChangeSel (Maybe String) |
exprToSimplePath :: MonadFail m => Change -> m SimplePath Source #
convert PathExpr into more simple Finder stucture
mkFinder :: MonadFail m => Finder -> [Expr] -> m Finder Source #
built Finder by recursively following Expr-structure and adding data to an initially empty Finder along the way
mkAttr :: MonadFail m => [Expr] -> m Attr Source #
create attribute to locate the element with from expr-data. Note: this method will fail for many illegal expr-types!
data ChangeList Source #
Describes the minimal change-effect of a .diff upon a DGraph.
ChangeList | |
|
Instances
Eq ChangeList Source # | |
Defined in Static.XSimplePath (==) :: ChangeList -> ChangeList -> Bool (/=) :: ChangeList -> ChangeList -> Bool | |
Show ChangeList Source # | |
Defined in Static.XSimplePath showsPrec :: Int -> ChangeList -> ShowS show :: ChangeList -> String showList :: [ChangeList] -> ShowS |
data ChangeAction Source #
Instances
Eq ChangeAction Source # | |
Defined in Static.XSimplePath (==) :: ChangeAction -> ChangeAction -> Bool (/=) :: ChangeAction -> ChangeAction -> Bool | |
Show ChangeAction Source # | |
Defined in Static.XSimplePath showsPrec :: Int -> ChangeAction -> ShowS show :: ChangeAction -> String showList :: [ChangeAction] -> ShowS |
updateNodeChange :: ChangeAction -> NodeName -> ChangeList -> ChangeList Source #
retrieveNodeChange :: NodeName -> ChangeList -> Maybe (ChangeAction, ChangeList) Source #
updateLinkChange :: ChangeAction -> EdgeId -> ChangeList -> ChangeList Source #
retrieveLinkChange :: EdgeId -> ChangeList -> Maybe (ChangeAction, ChangeList) Source #
mergeChA :: ChangeAction -> ChangeAction -> ChangeAction Source #
changeXml :: MonadFail m => Element -> String -> m (Element, ChangeList) Source #
changeXmlMod :: MonadFail m => Element -> Element -> m (Element, ChangeList) Source #
apply a diff to an xml-document. returns the result xml and a list of changes that affect the original DGraph
iterateXml :: MonadFail m => Direction -> [SimplePath] -> Cursor -> ChangeList -> m (Cursor, ChangeList) Source #
follow the Xml-structure and apply Changes. The Change is only applied after the recursive call to simulate parallel application. Resulting DgChanges are collected along the way.
applyChanges :: MonadFail m => [ChangeData] -> Cursor -> Direction -> ChangeList -> m (Cursor, ChangeList) Source #
a list of Changes is applied to a current Cursor. The resulting DgUpdates are added to the ChangeList.
removeFindLeft :: (Cursor -> Bool) -> Cursor -> Maybe Cursor Source #
applyChange :: MonadFail m => ChangeRes -> ChangeData -> m ChangeRes Source #
sequentially built up resulting Cursor one Change at a time
changeText :: MonadFail m => String -> Cursor -> m ChangeRes Source #
change the text-content of an element
:: MonadFail m | |
=> Maybe String | optional update value |
-> Cursor | |
-> String | attribute key |
-> m ChangeRes |
change or remove one of the elements attributes
applyAddOp :: MonadFail m => Insert -> Cursor -> AddChange -> m Cursor Source #
add new elements or attributes
propagatePaths :: MonadFail m => Cursor -> [SimplePath] -> m ([ChangeData], [SimplePath], [SimplePath]) Source #
given the remaining PathElements, determine for which Paths the current Cursor is relevant (else -> toRight) and then gather from those the changes regarding the current object (PathEnds; else -> toChildren).
updateChangeList :: MonadFail m => Cursor -> ChangeList -> ChangeData -> m ChangeList Source #
determine the required DgUpdates from a Change operation. NOTE: some changes (like most attribute changes) will be ignored!
mkAddChange :: MonadFail m => Cursor -> ChangeList -> AddChange -> m ChangeList Source #
split a list of AddChanges and write all Node and Link insertions into the ChangeList.
mkUpdateChange :: MonadFail m => NodeMod -> ChangeList -> Cursor -> m ChangeList Source #
go upwards until an updatable element is found
mkRemoveChange :: MonadFail m => ChangeList -> Cursor -> m ChangeList Source #
if node or link is removed, add this to ChangeList. otherwise create update-change
nameStringIs :: String -> Element -> Bool Source #
isSymbolType :: Element -> Bool Source #
isSentenceType :: Element -> Bool Source #
isAxiomType :: Element -> Bool Source #
isTheoremType :: Element -> Bool Source #
isDgNodeElem :: Element -> Bool Source #
isDgLinkElem :: Element -> Bool Source #