DSPL Tutorial: First Contact

From dftwiki3
Revision as of 13:15, 3 March 2011 by Thiebaut (talk | contribs) (Step 3: Figuring out the concepts)
Jump to: navigation, search

--D. Thiebaut 10:52, 3 March 2011 (EST)--D. Thiebaut 16:01, 18 April 2010 (UTC)


This is a first attempt at creating a data visualization using Google's DSPL language realeased in Feb. 2011.



References

  • The main reference for this example is Google's own tutorial: DSPL Tutorial

Step 1: Read!

  • Read Google's tutorial.
  • The important elements to understand are that of concept, slice, and table

Step 2: Our Data

  • As an example, let's assume that we want to plot the enrollment in Computer Science across several years, in 100-level classes on one hand, and 200 and 300 level classes on another hand. The data in CSV form looks like this:
department, year, enrollment1, enrollment2
CSC, 1986, 250, 375 
CSC, 1987, 200, 320
CSC, 1988, 150, 260
CSC, 1989, 120, 235
CSC, 1990, 150, 260
CSC, 1991, 155, 250
CSC, 1992, 150, 245
CSC, 1993, 175, 300
CSC, 1994, 210, 350
CSC, 1995, 240, 360
CSC, 1996, 280, 400
CSC, 1997, 255, 395
CSC, 1998, 230, 375
CSC, 1999, 260, 420
CSC, 2000, 255, 405
CSC, 2001, 265, 420
CSC, 2002, 200, 340
CSC, 2003, 190, 290
CSC, 2004, 120, 210
CSC, 2005, 130, 190
CSC, 2006, 125, 160
CSC, 2007, 135, 200
CSC, 2008, 140, 240
CSC, 2009, 135, 245
CSC, 2010, 190, 265
CSC, 2011, 150, 275
  • Enrollment1 is for 100-level classes, Enrollment2 for the 200 and 300 level classes. (Note: These data are not at all accurate or representative and are used solely for the purpose of illustration.)

Step 3: Figuring out the Concepts present in our data

  • We have several concepts in the data, according to Google's definitions:
    • one for the enrollment in 100-level classes. Let's call it Enrollment100
    • one for the enrollment in 200 and 300-level classes. Let's call it Enrollment200-300
    • one for the department. Even though we have only one department so far, we could imagine having a graph showing more departments. Let's call this concept Department.
    • we also have the concept of years, but because this is a concept that appears in many graphs, Google has declared a special predefined concept for it, so we don't need to list it explicitly.

Step 4: Packaging the Concepts in XML

  • We use Google's example and package the concepts in XML as follows:

<concepts>

    <concept id="enrollment100">
      <info>
        <name>
          <value>Enrollment100</value>
        </name>
        <description>
          <value>Enrollment in 100-level classes</value>
        </description>
      </info>
      <type ref="integer"/>
    </concept>

    <concept id="enrollment2300">
      <info>
        <name>
          <value>Enrollment200-300</value>
        </name>
        <description>
          <value>Enrollment in 200 & 300-level classes</value>
        </description>
      </info>
      <type ref="integer"/>
    </concept>

    <concept id="department">
      <info>
        <name>
          <value>Department</value>
        </name>
      </info>
      <type ref="string"/>
      <table ref="department_table" />    
    </concept>

    <concept id="class" extends="entity:entity">
      <info>
        <name>
          <value>Class</value>
        </name>
      </info>
      <type ref="string"/>
    </concept>
  </concepts>