/**
  * 
  */
 public static function exportAsCSV($dataHash, $model, $titleHelperLimit, $dimensionElementLimit)
 {
     $attributeSet = false;
     $c = new CubeViz_ConfigurationLink($model, $titleHelperLimit, $dimensionElementLimit);
     $data = $result = array(array());
     // get all information to export
     list($data, $dh) = $c->read($dataHash, 'data');
     /**
      * set the header of the CSV file
      */
     foreach ($data['selectedComponents']['dimensions'] as $element) {
         $result[0][] = $element['__cv_niceLabel'];
     }
     // measure
     $result[0][] = $data['selectedComponents']['measure']['__cv_niceLabel'];
     // use attribute, if available
     if (true === isset($data['selectedComponents']['attribute'])) {
         $result[0][] = $data['selectedComponents']['attribute']['__cv_niceLabel'];
         $attributeSet = true;
     }
     /**
      * set the content of the CSV file
      */
     $query = new DataCube_Query($model, $titleHelperLimit, $dimensionElementLimit);
     $selectedDimensions = $data['selectedComponents']['dimensions'];
     $i = 1;
     $retrievedObservations = $query->getObservations($data['selectedDS']['__cv_uri'], $data['selectedComponents']['dimensions']);
     // each line in the CSV file represents one observation
     foreach ($retrievedObservations as $observation) {
         // go through all dimensions
         foreach ($selectedDimensions as $d) {
             // e.g. http://data.lod2.eu/scoreboard/properties/country
             $dimensionUrl = $d['http://purl.org/linked-data/cube#dimension'];
             // save dimension element url
             $dimensionElementUrl = $observation[$dimensionUrl];
             // use dimension element url to get his label
             foreach ($d['__cv_elements'] as $dimensionElement) {
                 if ($dimensionElement['__cv_uri'] == $dimensionElementUrl) {
                     $result[$i][] = $dimensionElement['__cv_niceLabel'];
                 }
             }
         }
         // get measure
         $measureUri = $data['selectedComponents']['measure']['http://purl.org/linked-data/cube#measure'];
         $result[$i][] = $observation[$measureUri];
         // get attribute, if available
         if (true === $attributeSet) {
             $result[$i][] = $data['selectedComponents']['attribute']['__cv_niceLabel'];
         }
         ++$i;
     }
     return CubeViz_Exporter::arrayToCsv($result, ';', '"');
 }