SlideShare a Scribd company logo
DAX: Where Flowscript
     meets XSLT
     Lars Trieloff, Mindquarry
Lars Trieloff

•   Entrepreneur, Blogger,
    Open Source Coder

•   OSS Projects

    •   Apache Cocoon

    •   Mindquarry

    •   Goshaky

    •   DAX
What is DAX

• DAX means Declarative API for XML
• A way to process XML
• By expressing what parts of a document
  you want to process
• Based on Java, Javascript and Cocoon
DAX History
• Feb 2005: Kim Wolk writes XMLTO, a .NET
  library that transforms XML into objects
• March 2005: Ryan Cox ports it to Java 5,
  using Annotations and dom4j‘s Transformer
  API
• 2006 to 2007: DAX is used in production at
  Mindquarry, adopted to Cocoon
DAX Modules and
 Dependencies
      DAX
DAX Modules and
  Dependencies
           DAX




DAX-Java
DAX Modules and
  Dependencies
           DAX




DAX-Java




 dom4j
DAX Modules and
  Dependencies
             DAX



             DAX-
DAX-Java
           Javascript



 dom4j
DAX Modules and
  Dependencies
             DAX



             DAX-
DAX-Java
           Javascript



 dom4j       Rhino
DAX Modules and
  Dependencies
             DAX



             DAX-        DAX-
DAX-Java
           Javascript   Cocoon



 dom4j       Rhino
DAX Modules and
  Dependencies
             DAX



             DAX-        DAX-
DAX-Java
           Javascript   Cocoon



 dom4j       Rhino      Cocoon
DAX-Java
DAX-Java         How to use it
public class ElementCounter extends Transformer {
  Map elements = new Hashmap<String, Integer>();
  public void processElement(Node context) {
    String name = context.getName();
    if (elements.hasKey(name)) {
      elements.put(name, elements.get(name) + 1);
    } else {
      elements.put(name, 1);
    }
  }
}
DAX-Java         How to use it
public class ElementCounter extends Transformer {
  Map elements = new Hashmap<String, Integer>();
  @Path(quot;*quot;) //select all elements
  public void processElement(Node context) {
    String name = context.getName();
    if (elements.hasKey(name)) {
      elements.put(name, elements.get(name) + 1);
    } else {
      elements.put(name, 1);
    }
  }
}
DAX-Java         How to use it
public class SourceCounter extends Transformer {
  Map sources = new Hashmap<String, Integer>();
  @Path(quot;img[@src]quot;) //select all elements
  public void processElement(Node context) {
    String name = this.valueOf(quot;@srcquot;);
    if (elements.hasKey(name)) {
      elements.put(name, elements.get(name) + 1);
    } else {
      elements.put(name, 1);
    }
  }
}
DAX-Java      How it works
 • Simple parsing algorithm:
  • traverse the DOM of the XML document
  • for each node, find an annotated method
     • with matching XPath
  • execute this method
 • Just like XSLT's templates
DAX-Java                   vs XSLT
                     DAX-Java                             XSLT

            @Path(quot;/foo/barquot;)
Templates   public void bar(Node context)
                                            <xsl:template match=quot;/foo/barquot;>




Value-Of    valueOf(quot;@barquot;)                 <xsl:value-of select=quot;@barquot; />



  Apply-    applyTemplates()                <xsl:apply-templates />
Templates
DAX-Javascript
DAX-Javascript    Why?
• XSLT is fine for transforming XML
• but no side-effects possible
• no access to external data model
    Input         XSLT          Output


                   ?
                  Model
DAX-Javascript       Background
   • Map most important XSLT concepts to
      Javascript concepts
          XSLT                          Javascript

   <xsl:stylesheet>                  Stylesheet object
                        template function of the Stylesheet
    <xsl:template>
                                        object
                          applyTemplate function of the
<xsl:apply-templates/>
                                 Stylesheet object
                       copy function of the Stylesheet object
      <xsl:copy/>
                            (with inlined body function)
DAX-Javascript    How to use it
<xsl:template match=quot;fooquot;>
  <bar>
    <xsl:comment>example code uses foo</xsl:comment>
    <xsl:apply-templates />
  </bar>
</xsl:template/>

Stylesheet.template({match:quot;fooquot;}, function(node) {
  this.element(quot;barquot;, function(node) {
    this.comment(quot;example code uses fooquot;);
    this.applyTemplates();
  });
});
DAX-Javascript     How to use it
<xsl:template match=quot;node()|@*quot;>
  <xsl:copy>
    <xsl:apply-templates select=quot;node()|@*quot; />
  </xsl:copy>
</xsl:template/>


Stylesheet.template({match:quot;node()|@*quot;}, function
(node) {
    this.copy(function(node) {
         this.applyTemplates({select:quot;node()|@*quot;})
    });
});
DAX-Javascript   How it works
  • Uses Rhino Javascript Engine
   • full access to Java object model
   • allows side-effects when transforming
      XML
  • Parses the incoming XML stream
  • Finds and fires matching functions
DAX-Cocoon
DAX-Cocoon        How to use it

<map:components>
  <map:transformers>
    <map:transformer name=quot;daxquot;
      src=quot;dax.cocoon.DAXTransformerquot; />
  </map:transformers>
</map:components>
DAX-Cocoon        How to use it
<map:match pattern=quot;/resource/*quot;>
  <map:select type=quot;request-methodquot;>
    <map:generate type=quot;streamquot; />
    <map:when test=quot;PUTquot;>
      <map:transform type=quot;daxquot; src=quot;dax/res.jsquot;>
        <map:parameter name=quot;resquot; value=quot;{1}quot; />
      </map:transform>
    </map:when>
  </map:select>
</map:match>
DAX-Cocoon        How to use it
var resourcemanager =
  cocoon.getComponent(quot;resourcemanagerquot;);

Stylesheet.template({match:quot;delquot;}, function(node) {
  var that = this;
  this.copy(function(node) {
    if (that.valueOf(quot;.quot;)==cocoon.parameters.res) {
      resourcemanager.delete(that.valueOf(quot;@nodequot;))
    }
    this.applyTemplates({select:quot;node()|@*quot;})
  });
});
DAX-Cocoon          How it works
 •   Implemented as a Cocoon Transformer
 •   Pull in quot;cocoonquot; object as Flowscript does
 •   Usage Scenario: REST Application
     •   validate using DAX (e.g. by checking
         database)
     •   transform using DAX (e.g by triggering
         actions)
     •   save using DAX (e.g. by changing model)
DAX-Cocoon           Open Questions

 •   Caching
     •   We do not know if a transformation has
         non-cacheable side-effects
 •   Mixing DAX and XSLT
     •   perhaps E4X is a way to conveniently
         embed XSLT
 •   Not all XSLT concepts implemented (sorting)
How to go on?
•   Read more

    •   http://www.asciiarmor.com/2005/03/03/introducing-
        dax-declarative-api-for-xml/

    •   https://www.mindquarry.org/wiki/dax/

    •   http://www.codeconsult.ch/bertrand/archives/
        000802.html

•   Download

    •   http://releases.mindquarry.org/dax/

    •   (Maven artifacts available)
Thank you very much
              lars@trieloff.net




 For more information, see my weblog at
 http://weblogs.goshaky.com/weblog/lars

More Related Content

What's hot

Spark Schema For Free with David Szakallas
 Spark Schema For Free with David Szakallas Spark Schema For Free with David Szakallas
Spark Schema For Free with David Szakallas
Databricks
 
Stratosphere System Overview Big Data Beers Berlin. 20.11.2013
Stratosphere System Overview Big Data Beers Berlin. 20.11.2013Stratosphere System Overview Big Data Beers Berlin. 20.11.2013
Stratosphere System Overview Big Data Beers Berlin. 20.11.2013
Robert Metzger
 
Distributed computing with spark
Distributed computing with sparkDistributed computing with spark
Distributed computing with spark
Javier Santos Paniego
 
AI&BigData Lab.Руденко Петр. Automation and optimisation of machine learning ...
AI&BigData Lab.Руденко Петр. Automation and optimisation of machine learning ...AI&BigData Lab.Руденко Петр. Automation and optimisation of machine learning ...
AI&BigData Lab.Руденко Петр. Automation and optimisation of machine learning ...
GeeksLab Odessa
 
Deep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Deep Dive : Spark Data Frames, SQL and Catalyst OptimizerDeep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Deep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Sachin Aggarwal
 
Spark Dataframe - Mr. Jyotiska
Spark Dataframe - Mr. JyotiskaSpark Dataframe - Mr. Jyotiska
Spark Dataframe - Mr. Jyotiska
Sigmoid
 
Hadoop MapReduce framework - Module 3
Hadoop MapReduce framework - Module 3Hadoop MapReduce framework - Module 3
Hadoop MapReduce framework - Module 3
Rohit Agrawal
 
Stratosphere Intro (Java and Scala Interface)
Stratosphere Intro (Java and Scala Interface)Stratosphere Intro (Java and Scala Interface)
Stratosphere Intro (Java and Scala Interface)
Robert Metzger
 
cb streams - gavin pickin
cb streams - gavin pickincb streams - gavin pickin
cb streams - gavin pickin
Ortus Solutions, Corp
 
Practical Machine Learning Pipelines with MLlib
Practical Machine Learning Pipelines with MLlibPractical Machine Learning Pipelines with MLlib
Practical Machine Learning Pipelines with MLlib
Databricks
 
9781305078444 ppt ch07
9781305078444 ppt ch079781305078444 ppt ch07
9781305078444 ppt ch07
Terry Yoast
 
Understanding C# in .NET
Understanding C# in .NETUnderstanding C# in .NET
Understanding C# in .NET
mentorrbuddy
 
Collections Java e Google Collections
Collections Java e Google CollectionsCollections Java e Google Collections
Collections Java e Google Collections
André Faria Gomes
 
Java8 training - class 3
Java8 training - class 3Java8 training - class 3
Java8 training - class 3
Marut Singh
 
Introduction To R Language
Introduction To R LanguageIntroduction To R Language
Introduction To R Language
Gaurang Dobariya
 
Intro to Spark and Spark SQL
Intro to Spark and Spark SQLIntro to Spark and Spark SQL
Intro to Spark and Spark SQL
jeykottalam
 
Photon Technical Deep Dive: How to Think Vectorized
Photon Technical Deep Dive: How to Think VectorizedPhoton Technical Deep Dive: How to Think Vectorized
Photon Technical Deep Dive: How to Think Vectorized
Databricks
 
Clojure - LISP on the JVM
Clojure - LISP on the JVM Clojure - LISP on the JVM
Clojure - LISP on the JVM
Tikal Knowledge
 
Streaming SQL
Streaming SQLStreaming SQL
Streaming SQL
Julian Hyde
 
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Taiwan User Group
 

What's hot (20)

Spark Schema For Free with David Szakallas
 Spark Schema For Free with David Szakallas Spark Schema For Free with David Szakallas
Spark Schema For Free with David Szakallas
 
Stratosphere System Overview Big Data Beers Berlin. 20.11.2013
Stratosphere System Overview Big Data Beers Berlin. 20.11.2013Stratosphere System Overview Big Data Beers Berlin. 20.11.2013
Stratosphere System Overview Big Data Beers Berlin. 20.11.2013
 
Distributed computing with spark
Distributed computing with sparkDistributed computing with spark
Distributed computing with spark
 
AI&BigData Lab.Руденко Петр. Automation and optimisation of machine learning ...
AI&BigData Lab.Руденко Петр. Automation and optimisation of machine learning ...AI&BigData Lab.Руденко Петр. Automation and optimisation of machine learning ...
AI&BigData Lab.Руденко Петр. Automation and optimisation of machine learning ...
 
Deep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Deep Dive : Spark Data Frames, SQL and Catalyst OptimizerDeep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Deep Dive : Spark Data Frames, SQL and Catalyst Optimizer
 
Spark Dataframe - Mr. Jyotiska
Spark Dataframe - Mr. JyotiskaSpark Dataframe - Mr. Jyotiska
Spark Dataframe - Mr. Jyotiska
 
Hadoop MapReduce framework - Module 3
Hadoop MapReduce framework - Module 3Hadoop MapReduce framework - Module 3
Hadoop MapReduce framework - Module 3
 
Stratosphere Intro (Java and Scala Interface)
Stratosphere Intro (Java and Scala Interface)Stratosphere Intro (Java and Scala Interface)
Stratosphere Intro (Java and Scala Interface)
 
cb streams - gavin pickin
cb streams - gavin pickincb streams - gavin pickin
cb streams - gavin pickin
 
Practical Machine Learning Pipelines with MLlib
Practical Machine Learning Pipelines with MLlibPractical Machine Learning Pipelines with MLlib
Practical Machine Learning Pipelines with MLlib
 
9781305078444 ppt ch07
9781305078444 ppt ch079781305078444 ppt ch07
9781305078444 ppt ch07
 
Understanding C# in .NET
Understanding C# in .NETUnderstanding C# in .NET
Understanding C# in .NET
 
Collections Java e Google Collections
Collections Java e Google CollectionsCollections Java e Google Collections
Collections Java e Google Collections
 
Java8 training - class 3
Java8 training - class 3Java8 training - class 3
Java8 training - class 3
 
Introduction To R Language
Introduction To R LanguageIntroduction To R Language
Introduction To R Language
 
Intro to Spark and Spark SQL
Intro to Spark and Spark SQLIntro to Spark and Spark SQL
Intro to Spark and Spark SQL
 
Photon Technical Deep Dive: How to Think Vectorized
Photon Technical Deep Dive: How to Think VectorizedPhoton Technical Deep Dive: How to Think Vectorized
Photon Technical Deep Dive: How to Think Vectorized
 
Clojure - LISP on the JVM
Clojure - LISP on the JVM Clojure - LISP on the JVM
Clojure - LISP on the JVM
 
Streaming SQL
Streaming SQLStreaming SQL
Streaming SQL
 
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
 

Similar to Dax Declarative Api For Xml

Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of TonguesChoose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
CHOOSE
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To Scala
Peter Maas
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
Martin Odersky
 
Mazda Use of Third Generation Xml Tools
Mazda Use of Third Generation Xml ToolsMazda Use of Third Generation Xml Tools
Mazda Use of Third Generation Xml Tools
CardinaleWay Mazda
 
Red Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop LabsRed Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop Labs
Judy Breedlove
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
Serhii Kartashov
 
No SQL, No problem - using MongoDB in Ruby
No SQL, No problem - using MongoDB in RubyNo SQL, No problem - using MongoDB in Ruby
No SQL, No problem - using MongoDB in Rubysbeam
 
MLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reducedMLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reducedChao Chen
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to Scala
Derek Chen-Becker
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017
Ayush Sharma
 
Reversing JavaScript
Reversing JavaScriptReversing JavaScript
Reversing JavaScript
Roberto Suggi Liverani
 
Scala4sling
Scala4slingScala4sling
Scala4slingday
 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play framework
Felipe
 
Ajax Introduction
Ajax IntroductionAjax Introduction
Ajax Introduction
Oliver Cai
 
ApacheCon 2000 Everything you ever wanted to know about XML Parsing
ApacheCon 2000 Everything you ever wanted to know about XML ParsingApacheCon 2000 Everything you ever wanted to know about XML Parsing
ApacheCon 2000 Everything you ever wanted to know about XML ParsingTed Leung
 

Similar to Dax Declarative Api For Xml (20)

Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of TonguesChoose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To Scala
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
 
treeview
treeviewtreeview
treeview
 
treeview
treeviewtreeview
treeview
 
Mazda Use of Third Generation Xml Tools
Mazda Use of Third Generation Xml ToolsMazda Use of Third Generation Xml Tools
Mazda Use of Third Generation Xml Tools
 
Red Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop LabsRed Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop Labs
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
No SQL, No problem - using MongoDB in Ruby
No SQL, No problem - using MongoDB in RubyNo SQL, No problem - using MongoDB in Ruby
No SQL, No problem - using MongoDB in Ruby
 
MLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reducedMLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reduced
 
Sax Dom Tutorial
Sax Dom TutorialSax Dom Tutorial
Sax Dom Tutorial
 
Java XML Parsing
Java XML ParsingJava XML Parsing
Java XML Parsing
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to Scala
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017
 
XML
XMLXML
XML
 
Reversing JavaScript
Reversing JavaScriptReversing JavaScript
Reversing JavaScript
 
Scala4sling
Scala4slingScala4sling
Scala4sling
 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play framework
 
Ajax Introduction
Ajax IntroductionAjax Introduction
Ajax Introduction
 
ApacheCon 2000 Everything you ever wanted to know about XML Parsing
ApacheCon 2000 Everything you ever wanted to know about XML ParsingApacheCon 2000 Everything you ever wanted to know about XML Parsing
ApacheCon 2000 Everything you ever wanted to know about XML Parsing
 

More from Lars Trieloff

Putting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless WorldPutting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless World
Lars Trieloff
 
Serverless adventures with AWS Lambda and Clojure
Serverless adventures with AWS Lambda and ClojureServerless adventures with AWS Lambda and Clojure
Serverless adventures with AWS Lambda and Clojure
Lars Trieloff
 
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
Lars Trieloff
 
How to get value out of data
How to get value out of dataHow to get value out of data
How to get value out of dataLars Trieloff
 
Smartcon 2015 – Automated Decisions in the Supply Chain
Smartcon 2015 – Automated Decisions in the Supply ChainSmartcon 2015 – Automated Decisions in the Supply Chain
Smartcon 2015 – Automated Decisions in the Supply ChainLars Trieloff
 
Business Reasons for Predictive Applications
Business Reasons for Predictive ApplicationsBusiness Reasons for Predictive Applications
Business Reasons for Predictive Applications
Lars Trieloff
 
ADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it WorkADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it Work
Lars Trieloff
 
Automated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data FrankfurtAutomated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data Frankfurt
Lars Trieloff
 
Automated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data HamburgAutomated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data Hamburg
Lars Trieloff
 
Automated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data DüsseldorfAutomated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data Düsseldorf
Lars Trieloff
 
Automated decision making with predictive applications – Big Data Brussels
Automated decision making with predictive applications – Big Data BrusselsAutomated decision making with predictive applications – Big Data Brussels
Automated decision making with predictive applications – Big Data Brussels
Lars Trieloff
 
Automated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data AmsterdamAutomated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data Amsterdam
Lars Trieloff
 
Automated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data ParisAutomated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data Paris
Lars Trieloff
 
Automated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data ViennaAutomated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data Vienna
Lars Trieloff
 
Big Data Munich – Decision Automation and Big Data
Big Data Munich – Decision Automation and Big DataBig Data Munich – Decision Automation and Big Data
Big Data Munich – Decision Automation and Big Data
Lars Trieloff
 
10 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 201410 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 2014
Lars Trieloff
 
Big Data Berlin – Automating Decisions is the Next Frontier for Big Data
Big Data Berlin – Automating Decisions is the Next Frontier for Big DataBig Data Berlin – Automating Decisions is the Next Frontier for Big Data
Big Data Berlin – Automating Decisions is the Next Frontier for Big Data
Lars Trieloff
 
The DNA of Marketing
The DNA of MarketingThe DNA of Marketing
The DNA of Marketing
Lars Trieloff
 
Cross community campaigns with CQ5
Cross community campaigns with CQ5Cross community campaigns with CQ5
Cross community campaigns with CQ5
Lars Trieloff
 
Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5Lars Trieloff
 

More from Lars Trieloff (20)

Putting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless WorldPutting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless World
 
Serverless adventures with AWS Lambda and Clojure
Serverless adventures with AWS Lambda and ClojureServerless adventures with AWS Lambda and Clojure
Serverless adventures with AWS Lambda and Clojure
 
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
 
How to get value out of data
How to get value out of dataHow to get value out of data
How to get value out of data
 
Smartcon 2015 – Automated Decisions in the Supply Chain
Smartcon 2015 – Automated Decisions in the Supply ChainSmartcon 2015 – Automated Decisions in the Supply Chain
Smartcon 2015 – Automated Decisions in the Supply Chain
 
Business Reasons for Predictive Applications
Business Reasons for Predictive ApplicationsBusiness Reasons for Predictive Applications
Business Reasons for Predictive Applications
 
ADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it WorkADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it Work
 
Automated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data FrankfurtAutomated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data Frankfurt
 
Automated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data HamburgAutomated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data Hamburg
 
Automated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data DüsseldorfAutomated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data Düsseldorf
 
Automated decision making with predictive applications – Big Data Brussels
Automated decision making with predictive applications – Big Data BrusselsAutomated decision making with predictive applications – Big Data Brussels
Automated decision making with predictive applications – Big Data Brussels
 
Automated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data AmsterdamAutomated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data Amsterdam
 
Automated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data ParisAutomated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data Paris
 
Automated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data ViennaAutomated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data Vienna
 
Big Data Munich – Decision Automation and Big Data
Big Data Munich – Decision Automation and Big DataBig Data Munich – Decision Automation and Big Data
Big Data Munich – Decision Automation and Big Data
 
10 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 201410 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 2014
 
Big Data Berlin – Automating Decisions is the Next Frontier for Big Data
Big Data Berlin – Automating Decisions is the Next Frontier for Big DataBig Data Berlin – Automating Decisions is the Next Frontier for Big Data
Big Data Berlin – Automating Decisions is the Next Frontier for Big Data
 
The DNA of Marketing
The DNA of MarketingThe DNA of Marketing
The DNA of Marketing
 
Cross community campaigns with CQ5
Cross community campaigns with CQ5Cross community campaigns with CQ5
Cross community campaigns with CQ5
 
Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5
 

Recently uploaded

A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 

Recently uploaded (20)

A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 

Dax Declarative Api For Xml

  • 1. DAX: Where Flowscript meets XSLT Lars Trieloff, Mindquarry
  • 2. Lars Trieloff • Entrepreneur, Blogger, Open Source Coder • OSS Projects • Apache Cocoon • Mindquarry • Goshaky • DAX
  • 3. What is DAX • DAX means Declarative API for XML • A way to process XML • By expressing what parts of a document you want to process • Based on Java, Javascript and Cocoon
  • 4. DAX History • Feb 2005: Kim Wolk writes XMLTO, a .NET library that transforms XML into objects • March 2005: Ryan Cox ports it to Java 5, using Annotations and dom4j‘s Transformer API • 2006 to 2007: DAX is used in production at Mindquarry, adopted to Cocoon
  • 5. DAX Modules and Dependencies DAX
  • 6. DAX Modules and Dependencies DAX DAX-Java
  • 7. DAX Modules and Dependencies DAX DAX-Java dom4j
  • 8. DAX Modules and Dependencies DAX DAX- DAX-Java Javascript dom4j
  • 9. DAX Modules and Dependencies DAX DAX- DAX-Java Javascript dom4j Rhino
  • 10. DAX Modules and Dependencies DAX DAX- DAX- DAX-Java Javascript Cocoon dom4j Rhino
  • 11. DAX Modules and Dependencies DAX DAX- DAX- DAX-Java Javascript Cocoon dom4j Rhino Cocoon
  • 13. DAX-Java How to use it public class ElementCounter extends Transformer { Map elements = new Hashmap<String, Integer>(); public void processElement(Node context) { String name = context.getName(); if (elements.hasKey(name)) { elements.put(name, elements.get(name) + 1); } else { elements.put(name, 1); } } }
  • 14. DAX-Java How to use it public class ElementCounter extends Transformer { Map elements = new Hashmap<String, Integer>(); @Path(quot;*quot;) //select all elements public void processElement(Node context) { String name = context.getName(); if (elements.hasKey(name)) { elements.put(name, elements.get(name) + 1); } else { elements.put(name, 1); } } }
  • 15. DAX-Java How to use it public class SourceCounter extends Transformer { Map sources = new Hashmap<String, Integer>(); @Path(quot;img[@src]quot;) //select all elements public void processElement(Node context) { String name = this.valueOf(quot;@srcquot;); if (elements.hasKey(name)) { elements.put(name, elements.get(name) + 1); } else { elements.put(name, 1); } } }
  • 16. DAX-Java How it works • Simple parsing algorithm: • traverse the DOM of the XML document • for each node, find an annotated method • with matching XPath • execute this method • Just like XSLT's templates
  • 17. DAX-Java vs XSLT DAX-Java XSLT @Path(quot;/foo/barquot;) Templates public void bar(Node context) <xsl:template match=quot;/foo/barquot;> Value-Of valueOf(quot;@barquot;) <xsl:value-of select=quot;@barquot; /> Apply- applyTemplates() <xsl:apply-templates /> Templates
  • 19. DAX-Javascript Why? • XSLT is fine for transforming XML • but no side-effects possible • no access to external data model Input XSLT Output ? Model
  • 20. DAX-Javascript Background • Map most important XSLT concepts to Javascript concepts XSLT Javascript <xsl:stylesheet> Stylesheet object template function of the Stylesheet <xsl:template> object applyTemplate function of the <xsl:apply-templates/> Stylesheet object copy function of the Stylesheet object <xsl:copy/> (with inlined body function)
  • 21. DAX-Javascript How to use it <xsl:template match=quot;fooquot;> <bar> <xsl:comment>example code uses foo</xsl:comment> <xsl:apply-templates /> </bar> </xsl:template/> Stylesheet.template({match:quot;fooquot;}, function(node) { this.element(quot;barquot;, function(node) { this.comment(quot;example code uses fooquot;); this.applyTemplates(); }); });
  • 22. DAX-Javascript How to use it <xsl:template match=quot;node()|@*quot;> <xsl:copy> <xsl:apply-templates select=quot;node()|@*quot; /> </xsl:copy> </xsl:template/> Stylesheet.template({match:quot;node()|@*quot;}, function (node) { this.copy(function(node) { this.applyTemplates({select:quot;node()|@*quot;}) }); });
  • 23. DAX-Javascript How it works • Uses Rhino Javascript Engine • full access to Java object model • allows side-effects when transforming XML • Parses the incoming XML stream • Finds and fires matching functions
  • 25. DAX-Cocoon How to use it <map:components> <map:transformers> <map:transformer name=quot;daxquot; src=quot;dax.cocoon.DAXTransformerquot; /> </map:transformers> </map:components>
  • 26. DAX-Cocoon How to use it <map:match pattern=quot;/resource/*quot;> <map:select type=quot;request-methodquot;> <map:generate type=quot;streamquot; /> <map:when test=quot;PUTquot;> <map:transform type=quot;daxquot; src=quot;dax/res.jsquot;> <map:parameter name=quot;resquot; value=quot;{1}quot; /> </map:transform> </map:when> </map:select> </map:match>
  • 27. DAX-Cocoon How to use it var resourcemanager = cocoon.getComponent(quot;resourcemanagerquot;); Stylesheet.template({match:quot;delquot;}, function(node) { var that = this; this.copy(function(node) { if (that.valueOf(quot;.quot;)==cocoon.parameters.res) { resourcemanager.delete(that.valueOf(quot;@nodequot;)) } this.applyTemplates({select:quot;node()|@*quot;}) }); });
  • 28. DAX-Cocoon How it works • Implemented as a Cocoon Transformer • Pull in quot;cocoonquot; object as Flowscript does • Usage Scenario: REST Application • validate using DAX (e.g. by checking database) • transform using DAX (e.g by triggering actions) • save using DAX (e.g. by changing model)
  • 29. DAX-Cocoon Open Questions • Caching • We do not know if a transformation has non-cacheable side-effects • Mixing DAX and XSLT • perhaps E4X is a way to conveniently embed XSLT • Not all XSLT concepts implemented (sorting)
  • 30. How to go on? • Read more • http://www.asciiarmor.com/2005/03/03/introducing- dax-declarative-api-for-xml/ • https://www.mindquarry.org/wiki/dax/ • http://www.codeconsult.ch/bertrand/archives/ 000802.html • Download • http://releases.mindquarry.org/dax/ • (Maven artifacts available)
  • 31. Thank you very much lars@trieloff.net For more information, see my weblog at http://weblogs.goshaky.com/weblog/lars