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.
- data SimplePath = SimplePath {
- steps :: [Finder]
- changeData :: ChangeData
- data Finder = FindBy QName [Attr] Int
- data ChangeData = ChangeData ChangeSel (Maybe String)
- exprToSimplePath :: Monad m => Change -> m SimplePath
- mkFinder :: Monad m => Finder -> [Expr] -> m Finder
- mkFinderAux :: Monad m => Finder -> Expr -> m Finder
- mkAttr :: Monad m => [Expr] -> m Attr
- data ChangeList = ChangeList {}
- 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 :: Monad m => Element -> String -> m (Element, ChangeList)
- changeXmlMod :: Monad m => Element -> Element -> m (Element, ChangeList)
- iterateXml :: Monad m => Direction -> [SimplePath] -> Cursor -> ChangeList -> m (Cursor, ChangeList)
- data ChangeRes
- applyChanges :: Monad m => [ChangeData] -> Cursor -> Direction -> ChangeList -> m (Cursor, ChangeList)
- removeFindLeft :: (Cursor -> Bool) -> Cursor -> Maybe Cursor
- moveDown :: Monad m => Direction -> Cursor -> m Cursor
- moveUp :: Monad m => Direction -> Cursor -> m Cursor
- isElem :: Cursor -> Bool
- applyChange :: Monad m => ChangeRes -> ChangeData -> m ChangeRes
- changeText :: Monad m => String -> Cursor -> m ChangeRes
- removeOrChangeAttr :: Monad m => Maybe String -> Cursor -> String -> m ChangeRes
- applyAddOp :: Monad m => Insert -> Cursor -> AddChange -> m Cursor
- propagatePaths :: Monad m => Cursor -> [SimplePath] -> m ([ChangeData], [SimplePath], [SimplePath])
- updateChangeList :: Monad m => Cursor -> ChangeList -> ChangeData -> m ChangeList
- mkAddChange :: Monad m => Cursor -> ChangeList -> AddChange -> m ChangeList
- mkUpdateChange :: Monad m => NodeMod -> ChangeList -> Cursor -> m ChangeList
- mkRemoveChange :: Monad 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
SimplePath | |
|
data Finder
Finder stores predicate list to locate the element and an index, in case multiple elements comply with the predicate
data ChangeData
exprToSimplePath :: Monad m => Change -> m SimplePath
convert PathExpr into more simple Finder stucture
mkFinder :: Monad m => Finder -> [Expr] -> m Finder
built Finder by recursively following Expr-structure and adding data to an initially empty Finder along the way
mkFinderAux :: Monad m => Finder -> Expr -> m Finder
mkAttr :: Monad m => [Expr] -> m Attr
create attribute to locate the element with from expr-data. Note: this method will fail for many illegal expr-types!
data ChangeList
Describes the minimal change-effect of a .diff upon a DGraph.
ChangeList | |
|
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
changeXmlMod :: Monad m => Element -> Element -> m (Element, ChangeList)
apply a diff to an xml-document. returns the result xml and a list of changes that affect the original DGraph
iterateXml :: Monad m => Direction -> [SimplePath] -> Cursor -> ChangeList -> m (Cursor, ChangeList)
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 :: Monad m => [ChangeData] -> Cursor -> Direction -> ChangeList -> m (Cursor, ChangeList)
a list of Changes is applied to a current Cursor. The resulting DgUpdates are added to the ChangeList.
applyChange :: Monad m => ChangeRes -> ChangeData -> m ChangeRes
sequentially built up resulting Cursor one Change at a time
changeText :: Monad m => String -> Cursor -> m ChangeRes
change the text-content of an element
change or remove one of the elements attributes
propagatePaths :: Monad m => Cursor -> [SimplePath] -> m ([ChangeData], [SimplePath], [SimplePath])
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 :: Monad m => Cursor -> ChangeList -> ChangeData -> m ChangeList
determine the required DgUpdates from a Change operation. NOTE: some changes (like most attribute changes) will be ignored!
mkAddChange :: Monad m => Cursor -> ChangeList -> AddChange -> m ChangeList
split a list of AddChanges and write all Node and Link insertions into the ChangeList.
mkUpdateChange :: Monad m => NodeMod -> ChangeList -> Cursor -> m ChangeList
go upwards until an updatable element is found
mkRemoveChange :: Monad m => ChangeList -> Cursor -> m ChangeList
if node or link is removed, add this to ChangeList. otherwise create update-change
nameStringIs :: String -> Element -> Bool
isSymbolType :: Element -> Bool
isSentenceType :: Element -> Bool
isAxiomType :: Element -> Bool
isTheoremType :: Element -> Bool
isDgNodeElem :: Element -> Bool
isDgLinkElem :: Element -> Bool