diff --git a/alasql-utility/alasql-utility.js b/alasql-utility/alasql-utility.js index 5fcab1c..a2e6e00 100644 --- a/alasql-utility/alasql-utility.js +++ b/alasql-utility/alasql-utility.js @@ -125,7 +125,8 @@ function _addParenthesis (fields) { } function _normalizeField (field) { - return "[" + field + "]"; + return "`" + field + "`"; + //return "[" + field + "]"; } function alasql_transformData (data, fields, round) { diff --git a/bower_components/jsdatachecker/.bower.json b/bower_components/jsdatachecker/.bower.json index 67979f6..abe77fb 100644 --- a/bower_components/jsdatachecker/.bower.json +++ b/bower_components/jsdatachecker/.bower.json @@ -1,7 +1,7 @@ { - "name": "JSDataChecker", - "version": "0.0.9", - "homepage": "https://github.com/donpir/JSDataChecker", + "name": "jsdatachecker", + "version": "0.1.2", + "homepage": "https://github.com/donpir/jsdatachecker", "authors": [ "'Donato Pirozzi <'donatopirozzi@gmail.com'>" ], @@ -19,17 +19,17 @@ "polymer": "Polymer/polymer#1.2.0", "qunit": "~1.22.0", "csvjson": "0.1.1", - "polywc": "https://github.com/donpir/polywc.git#master" + "polywc-data-table": "https://github.com/donpir/polywc-data-table.git#master" }, "private": false, - "_release": "0.0.9", + "_release": "0.1.2", "_resolution": { "type": "version", - "tag": "v0.0.9", - "commit": "277c51efeee4daa0bd11051de022975ba86f47fa" + "tag": "v0.1.2", + "commit": "1cd37fc00315232a97de7978e5423784899eca29" }, "_source": "https://github.com/donpir/JSDataChecker.git", - "_target": "~0.0.9", + "_target": "~0.1.2", "_originalSource": "jsdatachecker", "_direct": true } \ No newline at end of file diff --git a/bower_components/jsdatachecker/README.md b/bower_components/jsdatachecker/README.md index d906822..b01f539 100644 --- a/bower_components/jsdatachecker/README.md +++ b/bower_components/jsdatachecker/README.md @@ -3,6 +3,18 @@ JavaScript Library to read dataset content (e.g., Open Data), infer data types, In details, it analysis the json (specified paths) to infer the data type. In addition, when request (via code) the library converts the json data based on the inferred type. +Recognised basic types: + - Text; + - Number; + - Date; + - Object; + - Null. + +Recognised types: + - Geographic coordinates; + - JSON; + - GEOJSON. + ## Documentation See wiki pages [here](https://github.com/donpir/JSDataChecker/wiki). diff --git a/bower_components/jsdatachecker/bower.json b/bower_components/jsdatachecker/bower.json index 677d18a..946b310 100644 --- a/bower_components/jsdatachecker/bower.json +++ b/bower_components/jsdatachecker/bower.json @@ -1,7 +1,7 @@ { - "name": "JSDataChecker", - "version": "v0.0.9", - "homepage": "https://github.com/donpir/JSDataChecker", + "name": "jsdatachecker", + "version": "v0.1.2", + "homepage": "https://github.com/donpir/jsdatachecker", "authors": [ "'Donato Pirozzi <'donatopirozzi@gmail.com'>" ], @@ -19,7 +19,7 @@ "polymer": "Polymer/polymer#1.2.0", "qunit": "~1.22.0", "csvjson": "0.1.1", - "polywc": "https://github.com/donpir/polywc.git#master" + "polywc-data-table": "https://github.com/donpir/polywc-data-table.git#master" }, "private": false } diff --git a/bower_components/jsdatachecker/build.cmd b/bower_components/jsdatachecker/build.cmd index 96692db..71a4b0f 100644 --- a/bower_components/jsdatachecker/build.cmd +++ b/bower_components/jsdatachecker/build.cmd @@ -1,2 +1,2 @@ del jsdatachecker.min.js -uglifyjs src\ArrayUtils.js src\DataTypeConverter.js src\DataTypesUtils.js src\DataTypeHierarchy.js --compress -o jsdatachecker.min.js \ No newline at end of file +uglifyjs src\ArrayUtils.js src\DataTypeConverter.js src\DataTypesUtils.js src\DataTypeHierarchy.js src\langs.js --compress -o jsdatachecker.min.js \ No newline at end of file diff --git a/bower_components/jsdatachecker/jsdatachecker.min.js b/bower_components/jsdatachecker/jsdatachecker.min.js index e4285ad..51ee58c 100644 --- a/bower_components/jsdatachecker/jsdatachecker.min.js +++ b/bower_components/jsdatachecker/jsdatachecker.min.js @@ -1 +1 @@ -function ArrayUtils(){}function DataTypeConverter(){this._fields=[],this._numOfRows=0}function DataTypesUtils(){}function DataTypeHierarchy(){}ArrayUtils.TestAndSet=function(arr,key,object){return"undefined"==typeof arr?null:0==Array.isArray(arr)?null:("undefined"==typeof arr[key]&&(arr[key]=object),arr[key])},ArrayUtils.TestAndInitializeKey=function(obj,key,value){return"undefined"==typeof obj?null:("undefined"==typeof obj[key]&&(obj[key]=value),obj[key])},ArrayUtils.TestAndIncrement=function(arr,key){var exists=arr[key];return"undefined"==typeof exists&&(arr[key]=0),arr[key]++,arr},ArrayUtils.toFieldsArray=function(obj){var fields=[];return ArrayUtils.IteratorOverKeys(obj,function(field,key){field.key=key,fields.push(field)}),fields},ArrayUtils.IteratorOverKeys=function(arr,callback){for(var property in arr)if(arr.hasOwnProperty(property)){var item=arr[property];callback(item,property)}},ArrayUtils.FindMinMax=function(arr,fncompare){var max1=null,max2=null;for(var key in arr)null==max1||fncompare(arr[key],max1.value)?(max2=max1,max1={index:-1,key:key,value:arr[key]}):(null==max2||fncompare(arr[key],max2.value))&&(max2={index:-1,key:key,value:arr[key]});return{first:max1,second:max2}},ArrayUtils.isArray=function(arr){return Array.isArray(arr)?arr.length>0:!1},DataTypeConverter.TYPES={TEXT:{value:0,name:"TEXT"},CODE:{value:1,name:"CODE"},NUMBER:{value:2,name:"NUMBER"},OBJECT:{value:3,name:"OBJECT"},BOOL:{value:5,name:"BOOL"},CONST:{value:6,name:"CONST"},CATEGORY:{value:7,name:"CATEGORY"},DATETIME:{value:8,name:"DATETIME"},EMPTY:{value:101,name:"NULL"}},DataTypeConverter.SUBTYPES={GEOCOORDINATE:{value:1e3,name:"GEOCOORDINATE"},PERCENTAGE:{value:1e3,name:"PERCENTAGE"},LATITUDE:{value:1001,name:"LATITUDE"},LONGITUDE:{value:1002,name:"LONGITUDE"}},DataTypeConverter.prototype=function(){var _analyseDataTypes=function(fields){ArrayUtils.IteratorOverKeys(fields,function(field){if(field._inferredTypes[DataTypeConverter.TYPES.CODE.name]){var confidence=field._inferredTypes[DataTypeConverter.TYPES.CODE.name]/field.numOfItems,_numericalInferredType=field._inferredTypes[DataTypeConverter.TYPES.NUMBER.name];return"undefined"!=typeof _numericalInferredType&&(confidence+=_numericalInferredType/field.numOfItems),field.type=DataTypeConverter.TYPES.CODE.name,void(field.typeConfidence=confidence)}var max=ArrayUtils.FindMinMax(field._inferredTypes,function(curval,lastval){return curval>lastval}),tkey=max.first.key;tkey===DataTypeConverter.TYPES.EMPTY.name&&null!=max.second&&"undefined"!=typeof max.second&&(tkey=max.second.key),field.type=tkey,field.typeConfidence=field._inferredTypes[max.first.key]/field.numOfItems;var max=ArrayUtils.FindMinMax(field._inferredSubTypes,function(curval,lastval){return curval>lastval});if(field.subtype=null,null!=max&&null!=max.first){field.subtype=max.first.key,field.subtypeConfidence=field._inferredSubTypes[field.subtype]/field.numOfItems;var fieldName=field.name.toLowerCase(),isLatType=field.subtype===DataTypeConverter.SUBTYPES.LATITUDE.name,fieldNameContainsLat=fieldName.indexOf("lat")>=0,fieldNameContainsLon=fieldName.indexOf("ng")>=0;1==isLatType&&0==fieldNameContainsLat&&1==fieldNameContainsLon&&(field.subtype=DataTypeConverter.SUBTYPES.LONGITUDE.name)}})},_processInferType=function(value){if(null===value||"undefined"==typeof value)return DataTypeConverter.TYPES.EMPTY;if("object"==typeof value)return DataTypeConverter.TYPES.OBJECT;if(/^0[0-9]+$/.test(value))return DataTypeConverter.TYPES.CODE;var isnumber=DataTypesUtils.FilterFloat(value);if(isNaN(isnumber)!==!0)return DataTypeConverter.TYPES.NUMBER;var _date=DataTypesUtils.FilterDateTime(value);return 0==isNaN(_date)&&null!=_date?DataTypeConverter.TYPES.DATETIME:DataTypeConverter.TYPES.TEXT},_processInferSubType=function(value){if(null===value||"undefined"==typeof value)return null;var isnumber=DataTypesUtils.FilterFloat(value);return isNaN(isnumber)!==!0?isnumber>=-90&&90>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:isnumber>=-180&&180>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:null:null},_filterBasedOnThreshold=function(metadata,threshold){return ArrayUtils.IteratorOverKeys(metadata.types,function(fieldType,key){if(!(fieldType.typeConfidence>=threshold)){var arrHierarchyTypes=DataTypeHierarchy.HIERARCHY[fieldType.type],lastFieldType={lastType:arrHierarchyTypes[0],lastTypeCounter:fieldType._inferredTypes[arrHierarchyTypes[0]],typeConfidence:0};lastFieldType.typeConfidence=lastFieldType.lastTypeCounter/fieldType.numOfItems;for(var curType,i=1;i=threshold){fieldType.type=lastFieldType.lastType,fieldType.typeConfidence=lastFieldType.typeConfidence;break}}}}),metadata},jsonTraverse=function(json,fieldKeys,callback){var stack=[],numOfRows=0;for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"!=fieldKey||1!=ArrayUtils.isArray(item)){var jsonSubtree=item[fieldKey];if(Array.isArray(jsonSubtree))for(var j=0;j0?",":"")+key,_value=callback(value,key,curKey,numOfRows);item[key]=_value}),numOfRows++}}};return{constructor:DataTypeConverter,cast:function(metadata,options){return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),this.convert(metadata,options)},convert:function(metadata,options){var lastRowIndex=0,numOfRows=0,numOfValues=0,datasetErrors=0,datasetMissingValues=0;return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),jsonTraverse(metadata.dataset,metadata.fieldKeys,function(value,key,traversedKeys,rowIndex){var inferredType=metadata.types[traversedKeys];numOfValues++,lastRowIndex!=rowIndex&&(lastRowIndex=rowIndex,numOfRows++),null==value||"undefined"==typeof value||0==(value+"").length;var isCast=inferredType.typeConfidence>=options.castThresholdConfidence;if(inferredType.type==DataTypeConverter.TYPES.NUMBER.name&&isCast){var number=parseFloat(value);return isNaN(number)?(datasetErrors++,value):number}return value}),metadata.qualityIndex.notNullValues=(numOfValues-datasetMissingValues)/numOfValues,metadata.qualityIndex.errors=(numOfValues-datasetErrors)/numOfValues,metadata},inferJsonDataType:function(json,fieldKeys,options){"undefined"!=typeof options&&null!=options||(options={thresholdConfidence:1});var stack=[],fieldsType={},numOfRows=0;if("undefined"==typeof fieldKeys)throw"IllegalArgumentException: undefined json path to analyse.";for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"==fieldKey&&ArrayUtils.isArray(item))for(var cell,j=0;j0){description+="The column <"+fieldType.name+"> has the type <"+fieldType.type+">";var verb=1==incorrect?" value is":" values are";description+=", but "+incorrect+verb+" not a "+fieldType.type}}fieldType.totalNullValues>0&&(description+="The column <"+fieldType.name+"> has "+fieldType.totalNullValues+" EMPTY value",fieldType.totalNullValues>1&&(description+="s")),description.length>0&&(description+="."),fieldType.errorsDescription=description,warningsTextual+=description});var metadata={dataset:json,fieldKeys:fieldKeys,types:fieldsType,qualityIndex:quality,warningsTextual:warningsTextual};return _filterBasedOnThreshold(metadata,options.thresholdConfidence),metadata},inferDataTypeOfValue:function(value){return _processInferType(value)}}}(),DataTypesUtils.FilterTime=function(value){var expTime=/^[0-9]{2}:[0-9]{2}(:[0-9]{2})?(\+[0-9]{2}:[0-9]{2})?$/;if(0==expTime.test(value))return null;var splitted=value.split(/[:|\+]/),expNumber=/^[0-9]{2}$/,HH=expNumber.test(splitted[0])?parseInt(splitted[0]):0,MM=expNumber.test(splitted[1])?parseInt(splitted[1]):0,SS=splitted.length>=3&&expNumber.test(splitted[2])?parseInt(splitted[2]):0,dt=new Date;return dt.setHours(HH),dt.setMinutes(MM),dt.setSeconds(SS),dt},DataTypesUtils.FilterDateTime=function(value){var _dtSplitted=value.split(/[T|\s]/);if(2==_dtSplitted.length){var dtTime=DataTypesUtils.FilterTime(_dtSplitted[1]);if(null==dtTime)return null;var dtDateTime=DataTypesUtils.FilterDate(_dtSplitted[0],dtTime);return dtDateTime}var dtDate=DataTypesUtils.FilterDate(value);if(null!=dtDate)return dtDate;var dtTime=DataTypesUtils.FilterTime(value);return dtTime},DataTypesUtils.FilterDate=function(value,dtDate){if(null==dtDate&&(dtDate=new Date),/^[0-9][0-9][0-9][0-9]\-[0-9][0-9]$/.test(value)){var year=parseInt(value.substring(0,4)),month=parseInt(value.substring(5));return dtDate.setYear(year),dtDate.setMonth(month),dtDate}var expDate=/^[0-9]{4}(\-|\/)[0-9]{2}((\-|\/)[0-9]{2})?$/;if(expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[0]),month=parseInt(splitted[1]),day=3==splitted.length?parseInt(splitted[2]):0;return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}if(expDate=/^[0-9]{2}(\-|\/)[0-9]{2}(\-|\/)[0-9]{4}$/,expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[2]),month=parseInt(splitted[1]),day=parseInt(splitted[0]);return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}return null},DataTypesUtils.FilterFloat=function(value){return/^(\-|\+)?((0|([1-9][0-9]*))(\.[0-9]+)?|Infinity)$/.test(value)?Number(value):NaN},DataTypesUtils.DecimalPlaces=function(num){var match=(""+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return match?Math.max(0,(match[1]?match[1].length:0)-(match[2]?+match[2]:0)):0},DataTypeHierarchy.HIERARCHY=[],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.TEXT.name]=[DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.NUMBER.name]=[DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.DATETIME.name]=[DataTypeConverter.TYPES.DATETIME.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.SUBTYPES.GEOCOORDINATE.name]=[DataTypeConverter.SUBTYPES.GEOCOORDINATE.name,DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.canConvert=function(fromType,toType){var arrConvertableTypes=DataTypeHierarchy.HIERARCHY[fromType],idx=arrConvertableTypes.indexOf(toType);return idx>=0}; \ No newline at end of file +function ArrayUtils(){}function DataTypeConverter(){this._fields=[],this._numOfRows=0}function DataTypesUtils(){}function DataTypeHierarchy(){}ArrayUtils.TestAndSet=function(arr,key,object){return"undefined"==typeof arr?null:0==Array.isArray(arr)?null:("undefined"==typeof arr[key]&&(arr[key]=object),arr[key])},ArrayUtils.TestAndInitializeKey=function(obj,key,value){return"undefined"==typeof obj?null:("undefined"==typeof obj[key]&&(obj[key]=value),obj[key])},ArrayUtils.TestAndIncrement=function(arr,key){var exists=arr[key];return"undefined"==typeof exists&&(arr[key]=0),arr[key]++,arr},ArrayUtils.toFieldsArray=function(obj){var fields=[];return ArrayUtils.IteratorOverKeys(obj,function(field,key){field.key=key,fields.push(field)}),fields},ArrayUtils.IteratorOverKeys=function(arr,callback){for(var property in arr)if(arr.hasOwnProperty(property)){var item=arr[property];callback(item,property)}},ArrayUtils.FindMinMax=function(arr,fncompare){var max1=null,max2=null;for(var key in arr)null==max1||fncompare(arr[key],max1.value)?(max2=max1,max1={index:-1,key:key,value:arr[key]}):(null==max2||fncompare(arr[key],max2.value))&&(max2={index:-1,key:key,value:arr[key]});return{first:max1,second:max2}},ArrayUtils.isArray=function(arr){return Array.isArray(arr)?arr.length>0:!1},DataTypeConverter.TYPES={EMPTY:{value:0,name:"NULL"},TEXT:{value:1,name:"TEXT"},NUMBER:{value:2,name:"NUMBER"},OBJECT:{value:3,name:"OBJECT"},DATETIME:{value:4,name:"DATETIME"}},DataTypeConverter.SUBTYPES={GEOCOORDINATE:{value:1e3,name:"GEOCOORDINATE"},GEOJSON:{value:1001,name:"GEOJSON"},BOOL:{value:1002,name:"BOOL"},CONST:{value:1003,name:"CONST"},CATEGORY:{value:1004,name:"CATEGORY"},PERCENTAGE:{value:1100,name:"PERCENTAGE"},LATITUDE:{value:1101,name:"LATITUDE"},LONGITUDE:{value:1102,name:"LONGITUDE"}},DataTypeConverter.LANGS={EN:{value:1e3,name:"EN"},IT:{value:1001,name:"IT"},FR:{value:1100,name:"FR"},NL:{value:1101,name:"NL"}},DataTypeConverter.GEOJSONTYPES=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeometryCollection","Feature","FeatureCollection"],DataTypeConverter.prototype=function(){var _analyseDataTypes=function(fields){ArrayUtils.IteratorOverKeys(fields,function(field){var max=ArrayUtils.FindMinMax(field._inferredTypes,function(curval,lastval){return curval>lastval}),tkey=max.first.key;tkey===DataTypeConverter.TYPES.EMPTY.name&&null!=max.second&&"undefined"!=typeof max.second&&(tkey=max.second.key),field.type=tkey,field.typeConfidence=field._inferredTypes[max.first.key]/field.numOfItems;var max=ArrayUtils.FindMinMax(field._inferredSubTypes,function(curval,lastval){return curval>lastval});if(field.subtype=null,null!=max&&null!=max.first){field.subtype=max.first.key,field.subtypeConfidence=field._inferredSubTypes[field.subtype]/field.numOfItems;var fieldName=field.name.toLowerCase(),isLatType=field.subtype===DataTypeConverter.SUBTYPES.LATITUDE.name,fieldNameContainsLat=fieldName.indexOf("lat")>=0,fieldNameContainsLon=fieldName.indexOf("ng")>=0;1==isLatType&&0==fieldNameContainsLat&&1==fieldNameContainsLon&&(field.subtype=DataTypeConverter.SUBTYPES.LONGITUDE.name)}})},_processInferType=function(value){if(null===value||"undefined"==typeof value)return DataTypeConverter.TYPES.EMPTY;if("object"==typeof value)return DataTypeConverter.TYPES.OBJECT;var isnumber=DataTypesUtils.FilterFloat(value);if(isNaN(isnumber)!==!0)return DataTypeConverter.TYPES.NUMBER;var _date=DataTypesUtils.FilterDateTime(value);return 0==isNaN(_date)&&null!=_date?DataTypeConverter.TYPES.DATETIME:DataTypeConverter.TYPES.TEXT},_processInferSubType=function(value){if(null===value||"undefined"==typeof value)return null;if(Array.isArray(value)&&2==value.length&&NaN!=DataTypesUtils.FilterFloat(value[0])&&NaN!=DataTypesUtils.FilterFloat(value[1])&&DataTypesUtils.DecimalPlaces(value[0])>4&&DataTypesUtils.DecimalPlaces(value[1])>4)return DataTypeConverter.SUBTYPES.GEOCOORDINATE;if("string"==typeof value){var split=value.split(",");if(DataTypesUtils.IsLatLng(split[0])&&DataTypesUtils.IsLatLng(split[1]))return DataTypeConverter.SUBTYPES.GEOCOORDINATE}var isnumber=DataTypesUtils.FilterFloat(value);if(isNaN(isnumber)!==!0)return isnumber>=-90&&90>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:isnumber>=-180&&180>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:null;if("object"==typeof value&&value.hasOwnProperty("type")){var geotype=value.type,isincluded=DataTypeConverter.GEOJSONTYPES.includes(geotype);if(isincluded)return DataTypeConverter.SUBTYPES.GEOJSON}return null},_filterBasedOnThreshold=function(metadata,threshold){return ArrayUtils.IteratorOverKeys(metadata.types,function(fieldType,key){if(!(fieldType.typeConfidence>=threshold)){var arrHierarchyTypes=DataTypeHierarchy.HIERARCHY[fieldType.type];if(null==arrHierarchyTypes)return metadata;var lastFieldType={lastType:arrHierarchyTypes[0],lastTypeCounter:fieldType._inferredTypes[arrHierarchyTypes[0]],typeConfidence:0};lastFieldType.typeConfidence=lastFieldType.lastTypeCounter/fieldType.numOfItems;for(var curType,i=1;i=threshold){fieldType.type=lastFieldType.lastType,fieldType.typeConfidence=lastFieldType.typeConfidence;break}}}}),metadata},_capitalizeFirstLetter=function(string){return string.charAt(0).toUpperCase()+string.slice(1)},jsonTraverse=function(json,fieldKeys,callback){var stack=[],numOfRows=0;for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"!=fieldKey||1!=ArrayUtils.isArray(item)){var jsonSubtree=item[fieldKey];if(Array.isArray(jsonSubtree))for(var j=0;j0?",":"")+key,_value=callback(value,key,curKey,numOfRows);item[key]=_value}),numOfRows++}}};return{constructor:DataTypeConverter,cast:function(metadata,options){return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),this.convert(metadata,options)},convert:function(metadata,options){var lastRowIndex=0,numOfRows=0,numOfValues=0,datasetErrors=0,datasetMissingValues=0;return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),jsonTraverse(metadata.dataset,metadata.fieldKeys,function(value,key,traversedKeys,rowIndex){var inferredType=metadata.types[traversedKeys];numOfValues++,lastRowIndex!=rowIndex&&(lastRowIndex=rowIndex,numOfRows++),null==value||"undefined"==typeof value||0==(value+"").length;var isCast=inferredType.typeConfidence>=options.castThresholdConfidence;if(inferredType.type==DataTypeConverter.TYPES.NUMBER.name&&isCast){var number=parseFloat(value);return isNaN(number)?(datasetErrors++,value):number}return value}),metadata.qualityIndex.notNullValues=(numOfValues-datasetMissingValues)/numOfValues,metadata.qualityIndex.errors=(numOfValues-datasetErrors)/numOfValues,metadata},inferJsonDataType:function(json,fieldKeys,options){"undefined"!=typeof options&&null!=options||(options={}),0==options.hasOwnProperty("thresholdConfidence")&&(options.thresholdConfidence=1),0==options.hasOwnProperty("language")?options.language=DataTypeConverter.LANGS.EN.name:options.language=options.language.toUpperCase();var stack=[],fieldsType={},numOfRows=0;if("undefined"==typeof fieldKeys)throw"IllegalArgumentException: undefined json path to analyse.";for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"==fieldKey&&ArrayUtils.isArray(item))for(var cell,j=0;j0){var _descr1=_capitalizeFirstLetter(JDC_LNG.key_declaretype[options.language])+".",_descr2=_capitalizeFirstLetter(JDC_LNG.key_notoftype_singular[options.language])+".";incorrect>1&&(_descr2=_capitalizeFirstLetter(JDC_LNG.key_notoftype_plural[options.language])+".");var descr=_descr1+" "+_descr2;descr=descr.replace(/%COL_NAME/g,fieldType.name),descr=descr.replace(/%COL_TYPE/g,fieldType.type),descr=descr.replace(/%COL_ERRORS/g,incorrect),description+=descr}}var descr="";1==fieldType.totalNullValues?descr=_capitalizeFirstLetter(JDC_LNG.key_emptyvalue_singolar[options.language])+".":fieldType.totalNullValues>1&&(descr=_capitalizeFirstLetter(JDC_LNG.key_emptyvalue_plural[options.language])+"."),descr=descr.replace(/%COL_NAME/g,fieldType.name),descr=descr.replace(/%COL_TYPE/g,fieldType.type),descr=descr.replace(/%COL_NULLVALUES/g,fieldType.totalNullValues),fieldType.errorsDescription=description,warningsTextual+=description});var metadata={dataset:json,fieldKeys:fieldKeys,types:fieldsType,qualityIndex:quality,warningsTextual:warningsTextual};return _filterBasedOnThreshold(metadata,options.thresholdConfidence),metadata},inferDataTypeOfValue:function(value){return _processInferType(value)},inferDataSubTypeOfValue:function(value){return _processInferSubType(value)}}}(),DataTypesUtils.FilterTime=function(value){var expTime=/^[0-9]{2}:[0-9]{2}(:[0-9]{2})?(\+[0-9]{2}:[0-9]{2})?$/;if(0==expTime.test(value))return null;var splitted=value.split(/[:|\+]/),expNumber=/^[0-9]{2}$/,HH=expNumber.test(splitted[0])?parseInt(splitted[0]):0,MM=expNumber.test(splitted[1])?parseInt(splitted[1]):0,SS=splitted.length>=3&&expNumber.test(splitted[2])?parseInt(splitted[2]):0,dt=new Date;return dt.setHours(HH),dt.setMinutes(MM),dt.setSeconds(SS),dt},DataTypesUtils.FilterDateTime=function(value){var _dtSplitted=value.split(/[T|\s]/);if(2==_dtSplitted.length){var dtTime=DataTypesUtils.FilterTime(_dtSplitted[1]);if(null==dtTime)return null;var dtDateTime=DataTypesUtils.FilterDate(_dtSplitted[0],dtTime);return dtDateTime}var dtDate=DataTypesUtils.FilterDate(value);if(null!=dtDate)return dtDate;var dtTime=DataTypesUtils.FilterTime(value);return dtTime},DataTypesUtils.FilterDate=function(value,dtDate){if(null==dtDate&&(dtDate=new Date),/^[0-9][0-9][0-9][0-9]\-[0-9][0-9]$/.test(value)){var year=parseInt(value.substring(0,4)),month=parseInt(value.substring(5));return dtDate.setYear(year),dtDate.setMonth(month),dtDate}var expDate=/^[0-9]{4}(\-|\/)[0-9]{2}((\-|\/)[0-9]{2})?$/;if(expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[0]),month=parseInt(splitted[1]),day=3==splitted.length?parseInt(splitted[2]):0;return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}if(expDate=/^[0-9]{2}(\-|\/)[0-9]{2}(\-|\/)[0-9]{4}$/,expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[2]),month=parseInt(splitted[1]),day=parseInt(splitted[0]);return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}return null},DataTypesUtils.FilterFloat=function(value){return/^(\-|\+)?((0|([1-9][0-9]*))(\.[0-9]+)?|Infinity)$/.test(value)?Number(value):NaN},DataTypesUtils.DecimalPlaces=function(num){var match=(""+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return match?Math.max(0,(match[1]?match[1].length:0)-(match[2]?+match[2]:0)):0},DataTypesUtils.IsLatLng=function(num){return NaN==DataTypesUtils.FilterFloat(num)?!1:DataTypesUtils.DecimalPlaces(num)>4},DataTypeHierarchy.HIERARCHY=[],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.TEXT.name]=[DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.NUMBER.name]=[DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.DATETIME.name]=[DataTypeConverter.TYPES.DATETIME.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.SUBTYPES.GEOCOORDINATE.name]=[DataTypeConverter.SUBTYPES.GEOCOORDINATE.name,DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.canConvert=function(fromType,toType){var arrConvertableTypes=DataTypeHierarchy.HIERARCHY[fromType],idx=arrConvertableTypes.indexOf(toType);return idx>=0};var JDC_LNG={key_declaretype:{EN:"the column <%COL_NAME> is of type <%COL_TYPE>",IT:"la colonna <%COL_NAME> è di tipo <%COL_TYPE>",FR:"le colum <%COL_NAME> est de type <%COL_TYPE>",NL:"de kolom <%COL_NAME> is van het type <%COL_TYPE>"},key_notoftype_singular:{EN:"a value is not <%COL_TYPE>",IT:"un valore non è un <%COL_TYPE>",FR:"une valeur est pas <%COL_TYPE> se trouvant",NL:"een waarde is niet <%COL_TYPE>"},key_notoftype_plural:{EN:"%COL_ERRORS values are not <%COL_TYPE>",IT:"%COL_ERRORS valori non sono di tipo <%COL_TYPE>",FR:"les valeurs %COL_ERRORS sont du type <%COL_TYPE>",NL:"%COL_ERRORS waarden niet <%COL_TYPE>"},key_emptyvalue_singolar:{EN:"the column <%COL_NAME> has an empty value",IT:"la colonna <%COL_NAME> ha un valore vuoto",FR:"la colonne <%COL_NAME> a une valeur vide",NL:"de kolom <%COL_NAME> heeft een lege waarde"},key_emptyvalue_plural:{EN:"the column <%COL_NAME> has <%COL_NULLVALUES> empty values",IT:"la colonna <%COL_NAME> ha <%COL_NULLVALUES> valori vuoti",FR:"la colonne <%COL_NAME> a <%COL_NULLVALUES> valeurs vide",NL:"de kolom <%COL_NAME> heeft <%COL_NULLVALUES> lege waarde"},key_type:{EN:"type",IT:"tipo",FR:"type",NL:"type"},key_subtype:{EN:"subtype",IT:"sottotipo",FR:"sous-type",NL:"subtype"},key_typetext:{EN:"text",IT:"testo",FR:"texte",NL:"tekst"},key_typenumber:{EN:"number",IT:"numero",FR:"nombre",NL:"aantal"},key_typeobject:{EN:"object",IT:"oggetto",FR:"objet",NL:"voorwerp"},key_typedatetime:{EN:"date or time",IT:"data o orario",FR:"date ou l'heure",NL:"datum of tijd"},key_typeempty:{EN:"empty",IT:"vuoto",FR:"vide",NL:"leeg"},key_typelatitude:{EN:"latitude",IT:"latitudine",FR:"latitude",NL:"breedtegraad"},key_typelongitude:{EN:"longitude",IT:"longitudine",FR:"longitude",NL:"lengtegraad"}}; \ No newline at end of file diff --git a/bower_components/jsdatachecker/src/DataTypeConverter.js b/bower_components/jsdatachecker/src/DataTypeConverter.js index 7f27704..dfeac7d 100644 --- a/bower_components/jsdatachecker/src/DataTypeConverter.js +++ b/bower_components/jsdatachecker/src/DataTypeConverter.js @@ -25,29 +25,40 @@ function DataTypeConverter() { };//EndConstructor. DataTypeConverter.TYPES = { - TEXT : { value: 0, name: "TEXT" }, - CODE : { value: 1, name: "CODE"}, + EMPTY : { value: 0, name: "NULL"}, + TEXT : { value: 1, name: "TEXT" }, NUMBER : { value: 2, name: "NUMBER" }, OBJECT : { value: 3, name: "OBJECT" }, + DATETIME : { value: 4, name: "DATETIME" } +}; +DataTypeConverter.SUBTYPES = { + GEOCOORDINATE : { value: 1000, name: "GEOCOORDINATE" }, + GEOJSON : { value: 1001, name: "GEOJSON" }, + BOOL : { value: 1002, name: "BOOL"}, + CONST : { value: 1003, name: "CONST" }, + CATEGORY : { value: 1004, name: "CATEGORY" }, - BOOL : { value: 5, name: "BOOL"}, - CONST : { value: 6, name: "CONST" }, - CATEGORY : { value: 7, name: "CATEGORY" }, - - DATETIME : { value: 8, name: "DATETIME" }, + PERCENTAGE : { value: 1100, name: "PERCENTAGE" }, + LATITUDE : { value: 1101, name: "LATITUDE" }, + LONGITUDE : { value: 1102, name: "LONGITUDE" } - EMPTY : { value: 101, name: "NULL" } + /*CODE : { value: 2000, name: "CODE"},*/ }; -DataTypeConverter.SUBTYPES = { - GEOCOORDINATE : { value: 1000, name: "GEOCOORDINATE" }, - PERCENTAGE : { value: 1000, name: "PERCENTAGE" }, - LATITUDE : { value: 1001, name: "LATITUDE" }, - LONGITUDE : { value: 1002, name: "LONGITUDE" } +DataTypeConverter.LANGS = { + EN : { value: 1000, name: "EN" }, + IT : { value: 1001, name: "IT" }, + FR : { value: 1100, name: "FR" }, + NL : { value: 1101, name: "NL" } }; + +DataTypeConverter.GEOJSONTYPES = [ "Point", "MultiPoint", "LineString", + "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection", "Feature", + "FeatureCollection" ]; + DataTypeConverter.prototype = (function () { /*** @@ -111,6 +122,10 @@ DataTypeConverter.prototype = (function () { var _analyseDataTypes = function(fields) { ArrayUtils.IteratorOverKeys(fields, function(field) { + + + /* + //TODO: removed CODE, I don't know whether it must be inserted if (field._inferredTypes[DataTypeConverter.TYPES.CODE.name]) { var confidence = field._inferredTypes[DataTypeConverter.TYPES.CODE.name] / field.numOfItems; var _numericalInferredType = field._inferredTypes[DataTypeConverter.TYPES.NUMBER.name]; @@ -119,7 +134,7 @@ DataTypeConverter.prototype = (function () { field.type = DataTypeConverter.TYPES.CODE.name; field.typeConfidence = confidence; return; - } + }*/ //Infers the field TYPE. var max = ArrayUtils.FindMinMax(field._inferredTypes, function (curval, lastval) { @@ -189,11 +204,6 @@ DataTypeConverter.prototype = (function () { if (typeof value === 'object') return DataTypeConverter.TYPES.OBJECT; - //If the value starts with a zero and contains all numbers, it is - //inferred as textual content. - if (/^0[0-9]+$/.test(value)) - return DataTypeConverter.TYPES.CODE; - //Try to parse the float. var isnumber = DataTypesUtils.FilterFloat(value); if (isNaN(isnumber) !== true) {//It is a number. @@ -222,6 +232,21 @@ DataTypeConverter.prototype = (function () { var _processInferSubType = function (value) { if (value === null || typeof value === 'undefined') return null; + //GEOCOORDINATE + if (Array.isArray(value) && value.length == 2) {//It recognises the LAT LNG as array of two values. + //Checks if the two array's values are numbers. + if ( DataTypesUtils.FilterFloat(value[0]) != NaN && DataTypesUtils.FilterFloat(value[1]) != NaN ) + if (DataTypesUtils.DecimalPlaces(value[0]) > 4 && DataTypesUtils.DecimalPlaces(value[1]) > 4 ) + return DataTypeConverter.SUBTYPES.GEOCOORDINATE; + }//EndIf. + + if (typeof value === 'string') { + var split = value.split(","); + //if (split.length == 2) + if (DataTypesUtils.IsLatLng(split[0]) && DataTypesUtils.IsLatLng(split[1])) + return DataTypeConverter.SUBTYPES.GEOCOORDINATE; + } + //Try to parse the float. var isnumber = DataTypesUtils.FilterFloat(value); if (isNaN(isnumber) !== true) {//It is a number. @@ -240,6 +265,19 @@ DataTypeConverter.prototype = (function () { return null; } + //Try to parse GEOJSON. + if (typeof value === 'object' && value.hasOwnProperty('type')) { + //Check the type variable. + var geotype = value.type; + var isincluded = DataTypeConverter.GEOJSONTYPES.includes(geotype); + if (isincluded) return DataTypeConverter.SUBTYPES.GEOJSON; + } + + //If the value starts with a zero and contains all numbers, it is + //inferred as textual content. + /*if (/^0[0-9]+$/.test(value)) + return DataTypeConverter.TYPES.CODE;*/ + return null; };//EndFunction. @@ -248,6 +286,9 @@ DataTypeConverter.prototype = (function () { if (fieldType.typeConfidence >= threshold) return; var arrHierarchyTypes = DataTypeHierarchy.HIERARCHY[fieldType.type]; + if (arrHierarchyTypes == null) + return metadata; + var lastFieldType = { lastType: arrHierarchyTypes[0], lastTypeCounter: fieldType._inferredTypes[arrHierarchyTypes[0]], typeConfidence: 0 }; @@ -270,6 +311,15 @@ DataTypeConverter.prototype = (function () { return metadata; };//EndFunction. + var _capitalizeFirstLetter = function(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + };//EndFunction. + + var _replaceAll = function(search, replacement) { + var target = this; + return target.split(search).join(replacement); + }; + var jsonTraverse = function(json, fieldKeys, callback) { var stack = []; var numOfRows = 0; @@ -396,8 +446,17 @@ DataTypeConverter.prototype = (function () { * @param options Infer Data Type options, in particular the threshold value for the confidence. */ inferJsonDataType: function (json, fieldKeys, options) { - if (typeof options === 'undefined' || options == null) - options = { thresholdConfidence: 1 }; + + //Default options initialisation. + if (typeof options === 'undefined' || options == null) options = { }; + + if (options.hasOwnProperty("thresholdConfidence") == false) + options.thresholdConfidence = 1; + + if (options.hasOwnProperty("language") == false) + options.language = DataTypeConverter.LANGS.EN.name; + else + options.language = options.language.toUpperCase(); var stack = []; var fieldsType = {}; @@ -508,19 +567,43 @@ DataTypeConverter.prototype = (function () { var incorrect = fieldType.numOfItems - fieldType.totalNullValues - fieldType._inferredTypes[fieldType.type]; if (incorrect > 0) { - description += "The column <" + fieldType.name + "> has the type <" + fieldType.type + ">"; + var _descr1 = _capitalizeFirstLetter(JDC_LNG['key_declaretype'][options.language]) + "."; + var _descr2 = _capitalizeFirstLetter(JDC_LNG['key_notoftype_singular'][options.language]) + "."; + if (incorrect > 1) + _descr2 = _capitalizeFirstLetter(JDC_LNG['key_notoftype_plural'][options.language]) + "."; + + var descr = _descr1 + " " + _descr2; + descr = descr.replace(/%COL_NAME/g, fieldType.name); + descr = descr.replace(/%COL_TYPE/g, fieldType.type); + descr = descr.replace(/%COL_ERRORS/g, incorrect); + + description += descr; + + /*description += "The column <" + fieldType.name + "> has the type <" + fieldType.type + ">"; var verb = (incorrect == 1) ? " value is" : " values are"; - description += ", but " + incorrect + verb + " not a " + fieldType.type; + description += ", but " + incorrect + verb + " not a " + fieldType.type;*/ } } - if (fieldType.totalNullValues > 0) { + var descr = ""; + if (fieldType.totalNullValues == 1) + descr = _capitalizeFirstLetter(JDC_LNG['key_emptyvalue_singolar'][options.language]) + "."; + else if (fieldType.totalNullValues > 1 ) + descr = _capitalizeFirstLetter(JDC_LNG['key_emptyvalue_plural'][options.language]) + "."; + + descr = descr.replace(/%COL_NAME/g, fieldType.name); + descr = descr.replace(/%COL_TYPE/g, fieldType.type); + descr = descr.replace(/%COL_NULLVALUES/g, fieldType.totalNullValues); + + /*if (fieldType.totalNullValues > 0) { + var descr = _capitalizeFirstLetter(JDC_LNG['key_declaretype'][options.language]) + "."; + description += "The column <" + fieldType.name + "> has " + fieldType.totalNullValues + " EMPTY value"; if (fieldType.totalNullValues > 1) description += "s"; } if (description.length > 0) - description += "."; + description += ".";*/ fieldType.errorsDescription = description; warningsTextual += description; @@ -547,6 +630,15 @@ DataTypeConverter.prototype = (function () { */ inferDataTypeOfValue: function (value) { return _processInferType(value); + },//EndFunction. + + /** + * Given in input a value, the function infers the data type. + * @param value + * @returns {*} + */ + inferDataSubTypeOfValue: function (value) { + return _processInferSubType(value); }//EndFunction. }; diff --git a/bower_components/jsdatachecker/src/DataTypesUtils.js b/bower_components/jsdatachecker/src/DataTypesUtils.js index 3d8d7c4..45f8b5c 100644 --- a/bower_components/jsdatachecker/src/DataTypesUtils.js +++ b/bower_components/jsdatachecker/src/DataTypesUtils.js @@ -122,4 +122,10 @@ DataTypesUtils.DecimalPlaces = function (num) { (match[1] ? match[1].length : 0) // Adjust for scientific notation. - (match[2] ? +match[2] : 0)); +}//EndFunction. + +DataTypesUtils.IsLatLng = function (num) { + if (DataTypesUtils.FilterFloat(num) == NaN) return false; + if (DataTypesUtils.DecimalPlaces(num) > 4) return true; + return false; }//EndFunction. \ No newline at end of file diff --git a/bower_components/jsdatachecker/src/ODPlatforms/CKAN.js b/bower_components/jsdatachecker/src/ODPlatforms/CKAN.js index 9558ca4..375ca23 100644 --- a/bower_components/jsdatachecker/src/ODPlatforms/CKAN.js +++ b/bower_components/jsdatachecker/src/ODPlatforms/CKAN.js @@ -39,6 +39,7 @@ CKANApi.prototype = (function() { errorCallback("Check DataStoreAPI."); }; xhttp.open("GET", theUrl, true);//true for asynchronous. + //xhttp.setRequestHeader('Content-yype') xhttp.send(null); };//EndFunction. diff --git a/bower_components/jsdatachecker/src/ODPlatforms/ODStatistics.js b/bower_components/jsdatachecker/src/ODPlatforms/ODStatistics.js index daf1630..6aaeb45 100644 --- a/bower_components/jsdatachecker/src/ODPlatforms/ODStatistics.js +++ b/bower_components/jsdatachecker/src/ODPlatforms/ODStatistics.js @@ -53,18 +53,44 @@ ODStatistics.prototype = (function() { stats.numOfDatasets = datasets.length; stats.formats = []; + stats.formatsAggregated = []; for (var i=0; i is of type <%COL_TYPE>", + "IT": "la colonna <%COL_NAME> è di tipo <%COL_TYPE>", + "FR": "le colum <%COL_NAME> est de type <%COL_TYPE>", + "NL": "de kolom <%COL_NAME> is van het type <%COL_TYPE>" + }, + + "key_notoftype_singular": { + "EN": "a value is not <%COL_TYPE>", + "IT": "un valore non è un <%COL_TYPE>", + "FR": "une valeur est pas <%COL_TYPE> se trouvant", + "NL": "een waarde is niet <%COL_TYPE>" + }, + + "key_notoftype_plural": { + "EN": "%COL_ERRORS values are not <%COL_TYPE>", + "IT": "%COL_ERRORS valori non sono di tipo <%COL_TYPE>", + "FR": "les valeurs %COL_ERRORS sont du type <%COL_TYPE>", + "NL": "%COL_ERRORS waarden niet <%COL_TYPE>" + }, + + "key_emptyvalue_singolar": { + "EN": "the column <%COL_NAME> has an empty value", + "IT": "la colonna <%COL_NAME> ha un valore vuoto", + "FR": "la colonne <%COL_NAME> a une valeur vide", + "NL": "de kolom <%COL_NAME> heeft een lege waarde" + }, + + "key_emptyvalue_plural": { + "EN": "the column <%COL_NAME> has <%COL_NULLVALUES> empty values", + "IT": "la colonna <%COL_NAME> ha <%COL_NULLVALUES> valori vuoti", + "FR": "la colonne <%COL_NAME> a <%COL_NULLVALUES> valeurs vide", + "NL": "de kolom <%COL_NAME> heeft <%COL_NULLVALUES> lege waarde" + }, + + "key_type": { + "EN": "type", + "IT": "tipo", + "FR": "type", + "NL": "type" + }, + + "key_subtype": { + "EN": "subtype", + "IT": "sottotipo", + "FR": "sous-type", + "NL": "subtype" + }, + + "key_typetext": { + "EN": "text", + "IT": "testo", + "FR": "texte", + "NL": "tekst" + }, + + "key_typenumber": { + "EN": "number", + "IT": "numero", + "FR": "nombre", + "NL": "aantal" + }, + + "key_typeobject": { + "EN": "object", + "IT": "oggetto", + "FR": "objet", + "NL": "voorwerp" + }, + + "key_typedatetime": { + "EN": "date or time", + "IT": "data o orario", + "FR": "date ou l'heure", + "NL": "datum of tijd" + }, + + "key_typeempty": { + "EN": "empty", + "IT": "vuoto", + "FR": "vide", + "NL": "leeg" + }, + + "key_typelatitude": { + "EN": "latitude", + "IT": "latitudine", + "FR": "latitude", + "NL": "breedtegraad" + }, + + "key_typelongitude": { + "EN": "longitude", + "IT": "longitudine", + "FR": "longitude", + "NL": "lengtegraad" + } + +}; \ No newline at end of file diff --git a/controllets/data-sevc-controllet/data-sevc-controllet.html b/controllets/data-sevc-controllet/data-sevc-controllet.html index 8c340e9..067fd17 100755 --- a/controllets/data-sevc-controllet/data-sevc-controllet.html +++ b/controllets/data-sevc-controllet/data-sevc-controllet.html @@ -47,7 +47,7 @@ listeners : { 'page-slider-controllet_selected' : '_updateSlider', - 'dataset-selection-controllet_data-url' : '_allowSecondStep', + 'select-dataset-controllet_data-url' : '_allowSecondStep', 'select-fields-controllet_selected-fields' : '_allowThirdStep', 'filters-controllet_filters': '_allowThirdStep', 'aggregators-controllet_aggregators': '_allowThirdStep', @@ -117,7 +117,7 @@ _allowSecondStep : function(e){ this.$.slider.chevronRight(false); -// + var f = Object.create(providerFactory); var provider = f.getProvider(e.detail.url); var dataUrl = provider.addLimit(e.detail.url); @@ -135,6 +135,8 @@ } else this.$.select_dataset.$.selected_url.invalid = true; + + this.$.select_dataset.showDatasetInfo(); }, _allowThirdStep : function(){ diff --git a/controllets/data-sevc-controllet/demo/index.html b/controllets/data-sevc-controllet/demo/index.html index ac38ffb..7731b2c 100755 --- a/controllets/data-sevc-controllet/demo/index.html +++ b/controllets/data-sevc-controllet/demo/index.html @@ -18,8 +18,10 @@ - + diff --git a/controllets/data-table-controllet/data-table-controllet.html b/controllets/data-table-controllet/data-table-controllet.html index 9729380..21dd851 100644 --- a/controllets/data-table-controllet/data-table-controllet.html +++ b/controllets/data-table-controllet/data-table-controllet.html @@ -40,15 +40,20 @@ } paper-icon-button.order { - height: 24px; - width: 24px; + height: 40px; + width: 40px; + padding: 4px; + cursor: pointer; } paper-icon-button.warning { - height: 24px; - width: 24px; + height: 40px; + width: 40px; + padding: 4px; color: #FFEB3B; + --paper-icon-button-ink-color: #FFEB3B; + cursor: help; } @@ -77,18 +82,22 @@ #data_table_container #header { background: #B6B6B6; - height: 24px; - padding: 12px; + height: 40px; + padding: 4px; text-align: center; font-weight: 700; cursor: help; } + #data_table_container #header * { + line-height: 40px !important; + } + #data_table_container table { height: calc(100% - 96px); width: 100%; - border-spacing: 0px; + border-spacing: 0; } #data_table_container tbody { @@ -103,22 +112,35 @@ #data_table_container th, #data_table_container td{ - height: 24px; - padding: 12px; + height: 32px; + /*padding: 12px;*/ text-align: center; - max-width: 256px; - min-width: 156px; + /*max-width: 256px;*/ + /*min-width: 156px;*/ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 1%; } + #data_table_container td { + font-size: 14px; + padding: 4px 12px; + max-width: calc(360px - 24px); + } + #data_table_container th { background: #2196F3; color: #FFFFFF; font-weight: 700; cursor: help; + border-right: 2px solid #FFFFFF; + height: 40px; + padding: 4px 12px; + } + + #data_table_container tr :nth-last-child(2) { + border-right: 0; } #data_table_container th, @@ -128,17 +150,13 @@ #data_table_container th .th_label { display: inline-block; - max-width: calc(100% - 48px - 8px); + /*max-width: calc(100% - 48px - 8px);*/ vertical-align: middle; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 24px;/**/ - } - - #data_table_container td { - font-size: 14px; - padding: 4px; + max-width: calc(360px - 114px); } #data_table_container #footer { @@ -202,10 +220,10 @@ @@ -223,10 +241,11 @@ @@ -340,7 +359,7 @@ setData : function(data) { var converter = new DataTypeConverter(); - var result = converter.inferJsonDataType(data, ["*"]); + var result = converter.inferJsonDataType(data, ["*"], { language: ln["localization"] } ); result = converter.cast(result); this.fields = ArrayUtils.toFieldsArray(result.types); this.data = result.dataset; diff --git a/controllets/datasets-list-controllet/datasets-list-controllet.html b/controllets/datasets-list-controllet/datasets-list-controllet.html new file mode 100644 index 0000000..17e14b7 --- /dev/null +++ b/controllets/datasets-list-controllet/datasets-list-controllet.html @@ -0,0 +1,465 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/controllets/datasets-list-controllet/demo/index.html b/controllets/datasets-list-controllet/demo/index.html new file mode 100644 index 0000000..59bcd50 --- /dev/null +++ b/controllets/datasets-list-controllet/demo/index.html @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + diff --git a/controllets/select-dataset-controllet/select-dataset-controllet.html b/controllets/select-dataset-controllet/select-dataset-controllet.html index 3dcc522..b149a32 100755 --- a/controllets/select-dataset-controllet/select-dataset-controllet.html +++ b/controllets/select-dataset-controllet/select-dataset-controllet.html @@ -1,413 +1,267 @@ + - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - +