1 / 68

Why a new language?

Why a new language?. Why not using existing languages like... JAVA, C#, C++ or Cobol XML based languages like XSLT, XQuery or Schematron Key requirements Easy and intuitive Maintainable Extensible. Why a new language?. Niklaus Wirth

armine
Download Presentation

Why a new language?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Why a new language? • Why not using existing languages like... • JAVA, C#, C++ or Cobol • XML based languages like XSLT, XQuery or Schematron • Key requirements • Easy and intuitive • Maintainable • Extensible

  2. Why a new language? • Niklaus Wirth • Designer of programming languages like Pascal, Euler or Modula • Author of the book • “Algorithms + Data Structures = Programs”

  3. DATA structures

  4. DATA structures ... 1 2 3 4 78 79 80 5 6 7 8 9 10 11 12 81 evn : checks that a list of numbers has at least one 1, 2, ..., 9 evn(1,2,...,9) and evn(10,11,...,18) and evn(19,20,...,27) and ... evn(73,74,...,81) and evn(1,10,...,73) and evn(2,11,...,74) and ... evn(9,27,...,81) and evn(1,2,3,10,11,12,19,20,21) and ... for i in (0...8) evn(1 + i*9, 2 + i*9, ..., 9 + i*9) for i in (0..8) evn(1 + i, 10 + i, ..., 73 + i) for i in (0..2) for j in (0..2) evn(1 + i + j*9, 2 + i + j*9, ...)

  5. DATA structures Column group 1 Column group 2 Column group 3 2 1 9 8 3 6 5 4 7 Row 1 Row group 1 Row group 2 Row 4 Row 9 Row 6 Row 7 Row 5 Row 3 Row 2 Row 8 Row group 3

  6. Data structures • For each row r: evn(r) • For each c: evn(c) • For each column group cg • and for each row group rg: evn(every cell in cg and rg)

  7. Data structure of XSLT, Xquery or schematron

  8. Data structure of XBRL Formulae

  9. Concept Incomes 100 € (prec 3) t Dec 2007 Dexia Credit institution Multidimensional view of XBRL facts: the aspect model • A value • A concept: Incomes • A set of dimensions • Standard • Entity • Time • User defined • Titulizations • Market • Additional properties: unit and precision

  10. INPUT: VARIABLES aND FILTERS • To identify input data in a formula we use variables and filters: • Filters select slices and regions of our model: • Concepts: Incomes, ... • Periods: 2008, 2007, ... • User dimensions: Country, ... • Filters can be combined to select more specific data A * B + C

  11. OUTPUT: XPAth expressions • ($a + $b) * 2.5 • abs($x + $y) = $z • XPath 2.0: W3C Recommendation (since January 2007)‏ • Expression language used by XSLT, XQuery and Schematron • We can combine: • Arithmetic expressions • Logical expressions • Conditional expressions • … • Defines a set of standard operators and functions: • +, -, *, div, mod, =, !=, <, >, and, or, … • abs, ceiling, floor, concat, upper-case, …

  12. Types of FormulaE • Formulae to produce new facts from existing ones • Assertions to verify a condition: true or false • Value assertions • Existence assertions • Consistency assertions

  13. EXAMPLES

  14. EXAMPLE 1 “All Positions Short“ greater or equal than “Net Positions Short” • Two input variables: • $allPosShort: • Concept name: p-cm-mr:AllPositionsShort • $netPosShort: • Concept name: p-cm-mr:NetPositionsShort • Test = “$allPosShort ge $netPosShort”

  15. Example 1: technical representation ValueAssertion @test = ““$allPosShortge $netPosShort” @name=“netPosShort” @name=“allPosShort” FactVariable FactVariable Concept Name: p-cm-mr:AllPositionsShort Concept Name: p-cm-mr:NetPositionsShort

  16. EXAMPLE 2 “All Positions Short“ greater or equal than “Net Positions Short” Assume zero for “All Positions” if not reported • Two input variables: • $allPosShort (fallbackValue = 0): • Concept name: p-cm-mr:AllPositionsShort • $netPosShort: • Concept name: p-cm-mr:NetPositionsShort • Test = “$allPosShort ge $netPosShort”

  17. Example 2: technical representation ValueAssertion @test = ““$allPosShortge $netPosShort” @name=“netPosShort” @name=“allPosShort” FactVariable @fallbackValue=“0” FactVariable Concept Name: p-cm-mr:AllPositionsShort Concept Name: p-cm-mr:NetPositionsShort

  18. EXAMPLE 3 “All Positions Short“ greater or equal than “Net Positions Short” Assume zero for “All and Net Positions” if not reported • Two input variables: • $allPosShort (fallbackValue = 0): • Concept name: p-cm-mr:AllPositionsShort • $netPosShort (fallbackValue = 0): • Concept name: p-cm-mr:NetPositionsShort • Test = “$allPosShort ge $netPosShort”

  19. EXAMPLE 4A “All Positions Short“ greater or equal than “Net Positions Short” For Total Equities in Trading Book • Two input variables: • $allPosShort : • Concept name: p-cm-mr:AllPositionsShort • Explicit dimension: d-mr:MarketRiskDimension = d-mr:MRiskSAEQUTotal • $netPosShort : • Concept name: p-cm-mr:NetPositionsShort • Explicit dimension: d-mr:MarketRiskDimension = d-mr:MRiskSAEQUTotal • Test = “$allPosShort ge $netPosShort”

  20. Combining filters • Two or more filters produce the “intersection” of desired values • (they are combined using an logical “AND”) • Boolean filters can be used for more complex combinations: • - OR filter • - AND filter • The attribute “complement” in arcs to filters can be used to obtain the negation of the filter linked (this attribute has been assumed to be “false” in examples).

  21. EXAMPLE 4B “All Positions Short“ greater or equal than “Net Positions Short” For Total Equities in Trading Book • A group filter: • Explicit dimension: d-mr:MarketRiskDimension = d-mr:MRiskSAEQUTotal • Two input variables: • $allPosShort : • Concept name: p-cm-mr:AllPositionsShort • $netPosShort : • Concept name: p-cm-mr:NetPositionsShort • Test = “$allPosShort ge $netPosShort”

  22. EXAMPLE 5A “All Positions Short“ greater or equal than “Net Positions Short” For General risk and for Specific risk • A group filter: • Explicit dimension: d-mr:MarketRiskDimension • d-mr:MRiskSAEQUGeneralRisk • d-mr:MRiskSAEQUSpecificRisk • Two input variables: • $allPosShort : • Concept name: p-cm-mr:AllPositionsShort • $netPosShort : • Concept name: p-cm-mr:NetPositionsShort • Test = “$allPosShort ge $netPosShort”

  23. EXAMPLE 5B “All Positions Short“ greater or equal than “Net Positions Short” For General risk and for Specific risk • Two input variables: • $allPosShort : • Concept name: p-cm-mr:AllPositionsShort • Explicit dimension: d-mr:MarketRiskDimension • d-mr:MRiskSAEQUGeneralRisk • d-mr:MRiskSAEQUSpecificRisk • $netPosShort : • Concept name: p-cm-mr:NetPositionsShort • Explicit dimension: d-mr:MarketRiskDimension • d-mr:MRiskSAEQUGeneralRisk • d-mr:MRiskSAEQUSpecificRisk • Test = “$allPosShort ge $netPosShort”

  24. EXAMPLE 6 Any “Net Positions Short“ less than “Cap Requirements for equities in trading books” • Two input variables: • $capReq : • Concept name: p-cm-mr:MarketRiskCapitalRequirements • Explicit dimension: d-mr:MarketRiskDimension = d-mr:MRiskSAEQUTotal • $netPosShort : • Concept name: p-cm-mr:NetPositionsShort • Test = “$netPosShort lt $capReq ”

  25. The implicit filter • Three steps in the evaluation of a set of variables: • Each variable is evaluated individually to obtain the list of all candidate values • $a = (a1, a2, a3) • $b = (b1, b2) • $c = (c1, c2) • The Cartesian product is obtained: • The implicit filter discards every combination that doesn’t verifies the following condition:

  26. The implicit filter • For every pair of variables of a formula / assertion, the value of each aspect that is not explicitly filtered* by a variable filter must be the same • So, combinations that mix different values for aspects not explicitly filtered are not allowed More precisely: aspects not covered. An aspect is covered for a variable if that variables has a variable filter for that aspect with the attribute @cover with a value of true. In this tutorial, it is assumed that every variable filter has this attribute set to true. Group filters don’t cover aspects. So, group filters are ignored by this rule

  27. EXAMPLE 7 “General risk” (1) must be equal to the addition of 1.1 and 1.2 For every concept (zero assumed if missing) • $genRisk : • Exp dimension: MarketRiskDimension = d-mr:MRiskSAEQUGeneralRisk • $exc (fallbackValue = 0) : • Exp dimension: MarketRiskDimension = d-mr:MRiskSAEQUExchangeTradedStockIndexFuturesBroadlyDiversifiedSubjectParticularApproach • $other (fallbackValue = 0): • Exp dimension: MarketRiskDimension = d-mr:MRiskSAEQUOtherEquitiesThanExchangeTradedStockIndexFuturesBroadlyDiversified • Test = “$genRisk = $exc + $other”

  28. EXAMPLE 8 Total “Equities in trading book” equal to the sum of its breakdown For every concept (zero assumed if missing) • $total : • Exp dimension: MarketRiskDimension = MRiskSAEQUTotal • $breakdown* (fallbackValue = 0): • Exp dimension: MarketRiskDimension = • d-mr:MRiskSAEQUGeneralRisk • … • d-mr:MRiskSAEQUOtherNonDeltaRisksOptions • Test = “$total = sum($breakdown)”

  29. XPaTH data model • Atomic values: a number, a string, ... • 1 • “Hello!” • Sequences • (1, 5, 10) • (“Foo”, “bar”) • Nodes • Some operators and functions apply to atomic values: • 2 + 5 • abs(-2) • Some operators / functions apply to sequences: • sum((2, 3, 5)) • max((10, 20, 30))

  30. Bind as sequence attribute • The attribute “bindAsSequence” in a variable is used to make the difference between: • Variables to be bound to single values on each evaluation • Variables to be bound to sequences of values Use sequence functions/operators with sequence variables Use atomic/node functions/ operators with simple variables Sequence variables are to be used with filters that select more than one value. Only aspects explicitly filtered* for these variables are mixed in one evaluation *More precisely: only aspects covered

  31. EXAMPLE 8b Total “Equities in trading book” equal to the sum of its breakdown For every concept (zero assumed if missing) • $total : • Exp dimension: MarketRiskDimension = MRiskSAEQUTotal • $breakdown* (fallbackValue = 0): • Exp dimension: MarketRiskDimension = • child ofMRiskSAEQUTotal • Test = “$total = sum($breakdown)”

  32. AXIS IN EXPLICIT Dimension filters World • AXIS POSSIBLE VALUES: • child: • France, Spain, Belgium • descentant: • France, Paris, Marseille, Lyon • Spain, ... • Belgium, ... • child-or-self: • Europe, France, Spain, Belgium • descendant-or-self: • Europe • France, Paris, Marseille, Lyon • Spain, ... • Belgium, ... Asia ... Europe Spain France Belgium Marseille Lyon Paris The tree is selected choosing one extended link role and one arc role COREP and FINREP have hierarchies for every dimension in the default extended link role and domain-member arc role

  33. EXAMPLE 9 Total “Equities in trading book” equal to the sum of its breakdown, and “General Risk” equal to the sum of its breakdown, and ... For “All Positions Long” • test = “$total = sum($breakdown)” • Group filter: • Concept name: p-cm-mr:AllPositionsLong • $total : • Exp dimension: MarketRiskDimension = • MRiskSAEQUTotal (axis=“child-or-self”) • $breakdown* (fallbackValue = 0): • Exp dimension: MarketRiskDimension = child of$total

  34. Dimension filters • Dimension: • Using its name (@qname) • Using an XPath expression that returns a name (@qnameExpression) • A list of members: • Using its name (@qname) • Using an XPath expression that returns a name (@qnameExpression) • Using a reference to another variable (@variable) • + (optional) an axis: • Axis value • Extended link role • Arc role

  35. EXAMPLE 10a “Capital requirements” equal to “Net positions subject to capital charge” multiplied by a factor only if “All positions long” + “All positions short” is greater than a certain threshold • $capReq : Concept name: p-cm-ca:MarketRiskCapitalRequirements • $netPosSub: Concept name: p-cm-mr:NetPositionsSubjectToCapitalCharge • $allPositions*: • Concept name: • p-cm-mr:AllPositionsLong • p-cm-mr:AllPositionsShor t • test = “if (sum($allPositions) gt 100000) • then $capReq = $netPosSub * 0.8 • else true()”

  36. EXAMPLE 10B “Capital requirements” equal to “Net positions subject to capital charge” multiplied by a factor only if “All positions long” + “All positions short” is greater than a certain threshold • test = “$capReq = $netPosSub * 0.8” • $capReq : Concept name: p-cm-ca:MarketRiskCapitalRequirements • $netPosSub: Concept name: p-cm-mr:NetPositionsSubjectToCapitalCharge • $allPositions*: • Concept name: • p-cm-mr:AllPositionsLong • p-cm-mr:AllPositionsShor t • PRECONDITION: test = “sum($allPositions) gt 1000000”

  37. Preconditions • Four steps in the evaluation of a set of variables: • Each variable is evaluated individually to obtain the list of all candidate values • The Cartesian product is obtained • The implicit filter discards combinations • Only combinations that verifies every precondition are considered A potential evaluation of an assertion that doesn’t verify a precondition is neither satisfied nor not satisfied: it is not evaluated

  38. EXAMPLE 10C “Capital requirements” equal to “Net positions subject to capital charge” multiplied by a factor only if “All positions long” + “All positions short” is greater than a certain threshold • test = “$capReq = $netPosSub * $factor” • $capReq : Concept name: p-cm-ca:MarketRiskCapitalRequirements • $netPosSub: Concept name: p-cm-mr:NetPositionsSubjectToCapitalCharge • $allPositions*: • Concept name: • p-cm-mr:AllPositionsLong • p-cm-mr:AllPositionsShor t • PRECONDITION: test = “sum($allPositions) gt $threshold” • Parameters: • $threshold = “1000000” • $factor = “0.8”

  39. parameters • Parameters variables that can be used inside XPath expressions • Parameters can be given a default value • Parameters can be given a value “from the outside”: • Using a graphical tool • Using an API • ... • They have a name so that they can be referred “from the outside”

  40. EXAMPLE 11a: Belgium rounding approach Total “Equities in trading book” equal to the sum of its breakdown, and “General Risk” equal to the sum of its breakdown, and ... For “All Positions Long” considering rounding error • test = “abs($total - sum($breakdown) ) le $threshold” • Group filter: • Concept name: p-cm-mr:AllPositionsLong • $total : • Exp dimension: MarketRiskDimension = • MRiskSAEQUTotal (axis=“child-or-self”) • $breakdown* (fallbackValue = 0): • Exp dimension: MarketRiskDimension = child of$total • Parameter $threshold = 1

  41. EXAMPLE 11B: Spanish rounding approach Total “Equities in trading book” equal to the sum of its breakdown, and “General Risk” equal to the sum of its breakdown, and ... For “All Positions Long” considering rounding error • test = “abs($total - sum($breakdown) ) le $threshold” • Group filter: • Concept name: p-cm-mr:AllPositionsLong • $total : • Exp dimension: MarketRiskDimension = • MRiskSAEQUTotal (axis=“child-or-self”) • $breakdown* (fallbackValue = 0): • Exp dimension: MarketRiskDimension = child of$total • General variable: $threshold = “1000 * (count($breakdown) + 1) div 2”

  42. General variables • Its value is the result of evaluating an XPath expression • They can make reference to other variables/parameters in the assertion / formula • Can be used for intermediate values that are used repeatedly in the assertion / formla

  43. Variables/parameters comparison table

  44. technical representation ValueAssertion @test = ““$a ge $b * $c” @aspectModel = “dimensional” @implicitFiltering = “true” @complement = “false” 0..n Group filter @name=“a” 0..n @name=“c” Parameter @bindAsSequence=“false” @name = “MyThreshold” @name=“b” 0..n 0..n Fact Variable @fallbackValue=“0” @bindAsSequence=“false” General Variable @select=“$a * $b” @bindAsSequence=“false” 0..n Precondition @test=“...” @complement = “false” @cover = “true” 0..n Variable filter

  45. Attributes Guidance • Always use (no exceptions): • @implicitFiltering = “true” • @aspectModel = “dimensional” • Always use (except for very advanced formulae): • @cover = “true” • Most of the times: • @complement = “false” • That leaves: • @name for variables and parameters arcs • @bindAsSequence for fact variables and parameters • @fallbackValue for fact variables • Specific attributes of other objects: • @test in preconditions • @name and select in parameters • @select in general variables • ...

  46. EXAMPLE 12 Check that “Capital Requirements” for “Other non-delta risks for options” is not reported • test = “false()” • $capReq : • Concept name: p-cm-ca:MarketRiskCapitalRequirements • Exp dimension: MarketRiskDimension = MRiskSAEQUOtherNonDeltaRisksOptions

  47. EXAMPLE 13 Check that “Capital Requirements” for “Other non-delta risks for options” must be reported • test = “true()” • $capReq : • Concept name: p-cm-ca:MarketRiskCapitalRequirements • Exp dimension: MarketRiskDimension = MRiskSAEQUOtherNonDeltaRisksOptions

  48. EXAMPLE 14 Check that “Capital Requirements” for “Other non-delta risks for options” must be reported • Existence Assertion • $capReq : • Concept name: p-cm-ca:MarketRiskCapitalRequirements • Exp dimension: MarketRiskDimension = MRiskSAEQUOtherNonDeltaRisksOptions

  49. Existence assertions • Value assertions are evaluated 0, 1 or n times, depending on the number of valid combinations for its variables given an input instance document • Existence assertions are always evaluated once. • An existence assertion is a test on the number of valid evaluations of its variable set • If the test attribute is not provided, it is tested that at least there is one valid evaluation of its variable set • The number of evaluations is referenced in the test expression by a dot

More Related