timrdf / csv2rdf4lod-automation

Shell script automation to support csv2rdf4lod converter
https://github.com/timrdf/csv2rdf4lod-automation/wiki
Apache License 2.0
109 stars 36 forks source link

Interpret on conversion process overrides interpret on enhancement #386

Open ewpatton opened 10 years ago

ewpatton commented 10 years ago

In an enhancement parameters file I have the "" => null interpretation on the conversion process:

      conversion:interpret [
         conversion:symbol        "";
         conversion:interpretation conversion:null;
      ];

and on a specific column I have an interpret statement that maps "" => 0:

      conversion:enhance [
         ov:csvCol          24;
         ov:csvHeader       "m_steps";
         conversion:label   "m_steps";
         conversion:equivalent_property fitness:steps;
         conversion:comment "";
         conversion:range   xsd:integer;
         conversion:interpret [
            conversion:symbol "";
            conversion:interpretation 0;
         ];
      ];

When I query the endpoint, I do not see any 0 values when the global interpretation is enabled. If I comment out the interpretation, then I see 0 values as I expected. This may be user error, but I would expect that something specific to the enhancement should override a default value defined for all enhancements.

This experience is based on commit af7910f.

timrdf commented 10 years ago

The relevant portion of code is:

if( (interpretAsNullStrings.contains((record.getValue(c-1))) || // The original cell value (before conv:delimit_object is applied)
     interpretAsNullStrings.contains(value))                    // The delimited sub-value (because of conv:delimits_object)
    &&             
     valueHandlers.get(c).interpretsAsNull(value) ) {           // Column-specific 
   logger.finest("r " + rowNum + " c "+c+" skipping b/c " + 
                 "(cell value global as-null: " + interpretAsNullStrings.contains((record.getValue(c-1))) + " or "+
                  "sub-value global as-null: "  + interpretAsNullStrings.contains(value) + ") and " +
                  "col-specific as-null: "      + valueHandlers.get(c).interpretsAsNull(value));
   // TODO: column should be the authoritative source of this decision (and should include global in its decision). 
   continue;      
}