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 :: 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

mkFinderAux :: MonadFail m => Finder -> Expr -> m Finder Source #

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.

Constructors

ChangeList 

Fields

Instances

Instances details
Eq ChangeList Source # 
Instance details

Defined in Static.XSimplePath

Methods

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

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

Show ChangeList Source # 
Instance details

Defined in Static.XSimplePath

Methods

showsPrec :: Int -> ChangeList -> ShowS

show :: ChangeList -> String

showList :: [ChangeList] -> ShowS

data ChangeAction Source #

Constructors

MkUpdate NodeMod 
MkInsert 

Instances

Instances details
Eq ChangeAction Source # 
Instance details

Defined in Static.XSimplePath

Methods

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

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

Show ChangeAction Source # 
Instance details

Defined in Static.XSimplePath

Methods

showsPrec :: Int -> ChangeAction -> ShowS

show :: ChangeAction -> String

showList :: [ChangeAction] -> ShowS

data Direction Source #

iterate Xml in multiple directions

Constructors

Vertical 
Horizontal 
TopElem 

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.

data ChangeRes Source #

Constructors

ChangeCr Cursor 
RemoveCr 

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 #

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

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

isElem :: Cursor -> Bool 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

removeOrChangeAttr Source #

Arguments

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