【发布时间】:2017-09-04 10:52:27
【问题描述】:
您好,我正在进行摄取和验证,但我想记录摄取和验证的开始时间和结束时间。以下是我的代码我做错了什么请提出建议。
let $pipelineXml :=
<pipeline id='a111' name='ACH-export' xmlns='http://cms.bloomsbury.com/pipeline'>
<transform href='/transforms/docbook2xml.xsl'/>
<validate href='/validation/taxonomy.sch' failOnError='true'/>
</pipeline>
let $reportChunk := <report>
<info>
<id>{$pipelineXml//@id}</id>
<name>{$pipelineXml//@name}</name>
<submitted-on>{fn:current-dateTime()}</submitted-on>
<user>{user:current()}</user>
</info>
<ingestion-report>
<steps/>
</ingestion-report>
</report>
let $startTime := fn:current-dateTime()
let $validate := validate:rng-report($pipelineXml, bin:decode-string(db:retrieve($config:Database, fn:concat($config:ValidationDir,$config:PipelineRelaxNG)),'UTF-8'), fn:true())
return
if($validate/status='valid')
then
(
admin:write-log("[" || "][Pipeline is valid as per Relax NG : " || $pipelineXml//@id || "]")
,
let $appendReport := let $updateReport := <step>
<type>RELAX NG Validation</type>
<started-on>{$startTime,prof:sleep(20000)}</started-on>
<completed-on>{fn:current-dateTime()}</completed-on>
<status>Pass</status>
<error></error>
</step>
return
copy $target := $reportChunk
modify insert node $updateReport as last into $target/ingestion-report/steps
return $target
return $appendReport
)
else "error"
【问题讨论】: