Hets - the Heterogeneous Tool Set

Copyright(c) Simon Ulbricht DFKI GmbH 2011
LicenseGPLv2 or higher, see LICENSE.txt
Maintainertekknix@informatik.uni-bremen.de
Stabilityprovisional
Portabilitynon-portable (DevGraph)
Safe HaskellNone

Static.XSimplePath

Description

break down Common.XPath.Expr into a simpler path description and transfer into cursor movement.

Synopsis

Documentation

data SimplePath Source #

Constructors

SimplePath 

data Finder Source #

Finder stores predicate list to locate the element and an index, in case multiple elements comply with the predicate

Constructors

FindBy QName [Attr] Int 

data ChangeData Source #

Constructors

ChangeData ChangeSel (Maybe String) 

exprToSimplePath :: Monad m => Change -> m SimplePath Source #

convert PathExpr into more simple Finder stucture

mkFinder :: Monad m => Finder -> [Expr] -> m Finder Source #

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 Source #

mkAttr :: Monad 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.

Constructors

ChangeList 

Fields

Instances

Eq ChangeList Source # 

Methods

(==) :: ChangeList -> ChangeList -> Bool

(/=) :: ChangeList -> ChangeList -> Bool

Show ChangeList Source # 

Methods

showsPrec :: Int -> ChangeList -> ShowS

show :: ChangeList -> String

showList :: [ChangeList] -> ShowS

data ChangeAction Source #

Constructors

MkUpdate NodeMod 
MkInsert 

Instances

Eq ChangeAction Source # 

Methods

(==) :: ChangeAction -> ChangeAction -> Bool

(/=) :: ChangeAction -> ChangeAction -> Bool

Show ChangeAction Source # 

Methods

showsPrec :: Int -> ChangeAction -> ShowS

show :: ChangeAction -> String

showList :: [ChangeAction] -> ShowS

data Direction Source #

iterate Xml in multiple directions

Constructors

Vertical 
Horizontal 
TopElem 

changeXml :: Monad m => Element -> String -> m (Element, ChangeList) Source #

changeXmlMod :: Monad 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 :: Monad 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.

data ChangeRes Source #

Constructors

ChangeCr Cursor 
RemoveCr 

applyChanges :: Monad 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 #

moveDown :: Monad m => Direction -> Cursor -> m Cursor Source #

moveUp :: Monad m => Direction -> Cursor -> m Cursor Source #

isElem :: Cursor -> Bool Source #

applyChange :: Monad m => ChangeRes -> ChangeData -> m ChangeRes Source #

sequentially built up resulting Cursor one Change at a time

changeText :: Monad m => String -> Cursor -> m ChangeRes Source #

change the text-content of an element

removeOrChangeAttr Source #

Arguments

:: Monad m 
=> Maybe String

optional update value

-> Cursor 
-> String

attribute key

-> m ChangeRes 

change or remove one of the elements attributes

applyAddOp :: Monad m => Insert -> Cursor -> AddChange -> m Cursor Source #

add new elements or attributes

propagatePaths :: Monad 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 :: Monad 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 :: Monad m => Cursor -> ChangeList -> AddChange -> m ChangeList Source #

split a list of AddChanges and write all Node and Link insertions into the ChangeList.

mkUpdateChange :: Monad m => NodeMod -> ChangeList -> Cursor -> m ChangeList Source #

go upwards until an updatable element is found

mkRemoveChange :: Monad 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 #