Skip to content
Snippets Groups Projects
Commit 40cc2068 authored by MRodz's avatar MRodz
Browse files

Add logging for debugging

parent d7d575db
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ module namespace ifweb="http://bdn-edition.de/intermediate_format/ifweb"; ...@@ -12,6 +12,7 @@ module namespace ifweb="http://bdn-edition.de/intermediate_format/ifweb";
declare namespace tei = "http://www.tei-c.org/ns/1.0"; declare namespace tei = "http://www.tei-c.org/ns/1.0";
import module namespace console="http://exist-db.org/xquery/console";
import module namespace pre="http://bdn-edition.de/intermediate_format/preprocessing" at "xmldb:exist:///db/apps/interformat/modules/intermediate_format/preprocessing.xqm"; import module namespace pre="http://bdn-edition.de/intermediate_format/preprocessing" at "xmldb:exist:///db/apps/interformat/modules/intermediate_format/preprocessing.xqm";
import module namespace ident = "http://bdn-edition.de/intermediate_format/identification" at "xmldb:exist:///db/apps/interformat/modules/intermediate_format/identification.xqm"; import module namespace ident = "http://bdn-edition.de/intermediate_format/identification" at "xmldb:exist:///db/apps/interformat/modules/intermediate_format/identification.xqm";
import module namespace config = "http://bdn-edition.de/intermediate_format/config" at "xmldb:exist:///db/apps/interformat/modules/config.xqm"; import module namespace config = "http://bdn-edition.de/intermediate_format/config" at "xmldb:exist:///db/apps/interformat/modules/config.xqm";
...@@ -30,7 +31,9 @@ declare function ifweb:main($resource as xs:string) as xs:string? { ...@@ -30,7 +31,9 @@ declare function ifweb:main($resource as xs:string) as xs:string? {
declare function ifweb:transform($doc as node()*, $filename as xs:string) declare function ifweb:transform($doc as node()*, $filename as xs:string)
as node()* { as node()* {
let $replace-whitespace := true() let $replace-whitespace := true()
let $log := console:log("Start preprocessing.")
let $preprocessed-data := pre:preprocessing($doc/tei:TEI, $replace-whitespace) let $preprocessed-data := pre:preprocessing($doc/tei:TEI, $replace-whitespace)
let $log := console:log("Start main processing.")
let $intermediate-format := ident:walk($preprocessed-data, ()) let $intermediate-format := ident:walk($preprocessed-data, ())
let $store := xmldb:store($config:sade-data, $filename, $intermediate-format) let $store := xmldb:store($config:sade-data, $filename, $intermediate-format)
...@@ -39,6 +42,14 @@ as node()* { ...@@ -39,6 +42,14 @@ as node()* {
declare function ifweb:complete-xml($author as xs:string, $xml as node()*) declare function ifweb:complete-xml($author as xs:string, $xml as node()*)
as node()* { as node()* {
let $log-dir :=
if(xmldb:collection-available($config:app-root || "/logs")) then
$config:app-root || "/logs"
else
xmldb:create-collection($config:app-root, "logs")
let $log-name := "log.xml"
let $create := xmldb:store($log-dir, $log-name, <root/>)
let $filename := $author || "-full-if.xml" let $filename := $author || "-full-if.xml"
return ifweb:transform($xml, $filename) return ifweb:transform($xml, $filename)
}; };
......
...@@ -12,6 +12,7 @@ xquery version "3.0"; ...@@ -12,6 +12,7 @@ xquery version "3.0";
:) :)
module namespace pre="http://bdn-edition.de/intermediate_format/preprocessing"; module namespace pre="http://bdn-edition.de/intermediate_format/preprocessing";
import module namespace whitespace = "http://bdn-edition.de/intermediate_format/whitespace_handling" at "whitespace-handling.xqm"; import module namespace whitespace = "http://bdn-edition.de/intermediate_format/whitespace_handling" at "whitespace-handling.xqm";
import module namespace console="http://exist-db.org/xquery/console";
declare default element namespace "http://www.tei-c.org/ns/1.0"; declare default element namespace "http://www.tei-c.org/ns/1.0";
...@@ -109,7 +110,7 @@ declare function pre:default-element ...@@ -109,7 +110,7 @@ declare function pre:default-element
let $following-node := $node/following-sibling::node()[1] let $following-node := $node/following-sibling::node()[1]
let $following-sibling := $node/following-sibling::*[1] let $following-sibling := $node/following-sibling::*[1]
return return
element{$node/name()}{ (element{$node/name()}{
$node/@*, $node/@*,
(if($following-node[matches(., "[\s\n\r\t]") and normalize-space(.) = ""] (if($following-node[matches(., "[\s\n\r\t]") and normalize-space(.) = ""]
and $following-sibling[self::ref or self::app or self::hi or self::bibl and $following-sibling[self::ref or self::app or self::hi or self::bibl
...@@ -121,7 +122,9 @@ declare function pre:default-element ...@@ -121,7 +122,9 @@ declare function pre:default-element
attribute {"break-after"}{"yes"} attribute {"break-after"}{"yes"}
else ()), else ()),
$recursive-function $recursive-function
} },
update insert $node into doc("/db/apps/interformat/logs/log.xml")/*
)
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment