Project

Profile

Help

XPDY0002: Finding root of tree: the context item is undef... » ACORD--ZAG.xq

Rob Oaks, 2013-01-21 17:01

 
xquery version "1.0";
(:
: Module Name: ACORD for ZAG Function Library
:
: Module Version: 1.0
:
: Date: 01/15/2013
:
: XQuery
: Specification January 2007 (1.0)
:)

(:~
: In order to create Talend flows from the ZAG ACORD data, the ACORD data must be flattened and converted to a delimited form.
: Each function in this module performs this operation for a specific portion of the Talend job (basic policy, drivers, vehicles, etc.)
:
: @author Rob Oaks
: @version 1.0
:)
module namespace acord-zag = "http://www.itsdataservices.com/idcp/xq/acord/zag";

(:
: Note that the ACORD schema we're importing has been sliced using the ACORD schema slicer, which uses the Saxon
: processor. This allows us to reduce the size of the enormous ACORD schema to a manageable and performant size.
:)
import schema namespace acord="http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/" at "ACORD--Slice.xsd";
declare default element namespace "http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/";
declare namespace saxon="http://saxon.sf.net/";

(: This module uses functions from another, general purpose module to do the actual work. :)
import module namespace idcp-func = "http://www.itsdataservices.com/idcp/xq/func" at "IDCP--Function.xq";

(:~
: Get the flattened/delimited data for all of the vehicles (CommlVehicle) in the ACORD source data.
:
: @return the flattened/delimited data for all of the vehicles (CommlVehicle) in the ACORD source data
:)
declare function acord-zag:getDelimitedCommlVeh() as xs:string*
{
let $rootXPath as xs:string := "/ACORD/InsuranceSvcRq/CommlAutoPolicyQuoteInqRq/CommlAutoLineBusiness/CommlRateState/CommlVeh"
return idcp-func:nodesToDelimited(saxon:evaluate($rootXPath), ("CommlCoverage"))
};

(:~
: Get the flattened/delimited data for all of the drivers (CommlDriver) in the ACORD source data.
:
: @return the flattened/delimited data for all of the drivers (CommlDriver) in the ACORD source data
:)
declare function acord-zag:getDelimitedCommlDriver() as xs:string*
{
let $rootXPath as xs:string := "/ACORD/InsuranceSvcRq/CommlAutoPolicyQuoteInqRq/CommlAutoLineBusiness/CommlDriver"
return idcp-func:nodesToDelimited(saxon:evaluate($rootXPath), ())
};

declare function acord-zag:tester() as element()
{
let $rootXPath as xs:string := "/ACORD/InsuranceSvcRq/CommlAutoPolicyQuoteInqRq/CommlAutoLineBusiness/CommlDriver[1]"
return saxon:evaluate($rootXPath)
(:return idcp-func:nodesToDelimited(saxon:evaluate($rootXPath), ()):)
};
(2-2/5)