Project

General

Profile

« Previous | Next » 

Revision 10935

inputs/VegBank/stemcount_/: translated multi-column filters to postprocessing derived columns, using the steps at http://wiki.vegpath.org/Adding_new-style_import_to_a_datasource#Translating-filters-to-postprocessing-derived-columns

View differences:

inputs/VegBank/stemcount_/postprocess.sql
1
SELECT util.search_path_append('util');
2

  
3

  
4
SELECT mk_derived_col((:table_str, 'aggregateOrganismObservationID'),
5
$$_join("taxonimportance_id"::text, "stemcount_id"::text)$$)
6
; -- runtime: 15 s ("Time: 15805.876 ms") @starscream
inputs/VegBank/stemcount_/map.csv
1 1
VegBank,VegCore,Filter,Comments
2
taxonimportance_id,aggregateOrganismObservationID,/_join/1,
2
taxonimportance_id,aggregateOrganismObservationID__taxon_presence,,
3 3
taxonobservation_id,taxonOccurrenceID,,"Note that taxonimportance is not 1:1 with taxonobservation [1].
4 4

  
5 5
[1] The following query returns rows:
......
18 18
stratumheight,*stratumheight,,
19 19
emb_taxonimportance,*emb_taxonimportance,,
20 20
covercode,*covercode,,
21
stemcount_id,aggregateOrganismObservationID,/_join/2,
21
stemcount_id,aggregateOrganismObservationID__individual_count,,
22 22
stemdiameter,diameterBreastHeight_cm,,"""The diameter of the stem in centimeters"" (stemDiameter definition at <http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&wparam=stemcount&entity=dba_tabledescription&where=where_tablename>)"
23 23
stemdiameteraccuracy,*stemdiameteraccuracy,,
24 24
stemheight,height_m,,"""The measured height of the stem in meters"" (stemHeight definition at <http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&wparam=stemcount&entity=dba_tabledescription&where=where_tablename>)"
......
26 26
stemcount,individualCount,,
27 27
stemtaxonarea,*stemtaxonarea,,
28 28
emb_stemcount,*emb_stemcount,,
29
aggregateOrganismObservationID,aggregateOrganismObservationID,,
inputs/VegBank/stemcount_/VegBIEN.csv
12 12
cover,/location/locationevent/taxonoccurrence/aggregateoccurrence/cover_fraction/_percent_to_fraction/value,
13 13
stemdiameter,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/stemobservation/diameterbreastheight_m/_cm_to_m/value,"""The diameter of the stem in centimeters"" (stemDiameter definition at <http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&wparam=stemcount&entity=dba_tabledescription&where=where_tablename>)"
14 14
stemheight,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/stemobservation/height_m,"""The measured height of the stem in meters"" (stemHeight definition at <http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&wparam=stemcount&entity=dba_tabledescription&where=where_tablename>)"
15
taxonimportance_id,/location/locationevent/taxonoccurrence/aggregateoccurrence/sourceaccessioncode/_join/1,
16
stemcount_id,/location/locationevent/taxonoccurrence/aggregateoccurrence/sourceaccessioncode/_join/2,
15
aggregateOrganismObservationID,/location/locationevent/taxonoccurrence/aggregateoccurrence/sourceaccessioncode,
17 16
taxonobservation_id,"/location/locationevent/taxonoccurrence/iscultivated/_alt/1/_if[@name=""if TaxonOccurrence""]/cond/_exists","Note that taxonimportance is not 1:1 with taxonobservation [1].
18 17

  
19 18
[1] The following query returns rows:
......
32 31
GROUP BY taxonobservation_id
33 32
HAVING count(distinct taxonimportance_id) > 1
34 33
-----"
35
taxonimportance_id,"/location/locationevent/taxonoccurrence/sourceaccessioncode/_first/2/_if[@name=""if organism in AggregateOccurrence""]/cond/_exists/_join/1",
36
stemcount_id,"/location/locationevent/taxonoccurrence/sourceaccessioncode/_first/2/_if[@name=""if organism in AggregateOccurrence""]/cond/_exists/_join/2",
34
aggregateOrganismObservationID,"/location/locationevent/taxonoccurrence/sourceaccessioncode/_first/2/_if[@name=""if organism in AggregateOccurrence""]/cond/_exists",
37 35
taxonobservation_id,"/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/_if[@name=""if has taxondetermination""]/cond/_exists","Note that taxonimportance is not 1:1 with taxonobservation [1].
38 36

  
39 37
[1] The following query returns rows:
......
49 47
emb_stemcount,,** No join mapping for *emb_stemcount ** 
50 48
emb_taxonimportance,,** No join mapping for *emb_taxonimportance ** 
51 49
inferencearea,,** No join mapping for *inferencearea ** 
50
stemcount_id,,** No join mapping for aggregateOrganismObservationID__individual_count ** 
52 51
stemdiameteraccuracy,,** No join mapping for *stemdiameteraccuracy ** 
53 52
stemheightaccuracy,,** No join mapping for *stemheightaccuracy ** 
54 53
stemtaxonarea,,** No join mapping for *stemtaxonarea ** 
55 54
stratum_id,,** No join mapping for *stratum_id ** 
56 55
stratumbase,,** No join mapping for *stratumbase ** 
57 56
stratumheight,,** No join mapping for *stratumheight ** 
57
taxonimportance_id,,** No join mapping for aggregateOrganismObservationID__taxon_presence ** 
inputs/VegBank/stemcount_/test.xml.ref
18 18
                                            <height_m>$stemheight</height_m>
19 19
                                        </stemobservation>
20 20
                                    </plantobservation>
21
                                    <sourceaccessioncode>
22
                                        <_join>
23
                                            <1>$taxonimportance_id</1>
24
                                            <2>$stemcount_id</2>
25
                                        </_join>
26
                                    </sourceaccessioncode>
21
                                    <sourceaccessioncode>$aggregateOrganismObservationID</sourceaccessioncode>
27 22
                                </aggregateoccurrence>
28 23
                                <sourceaccessioncode>$taxonobservation_id</sourceaccessioncode>
29 24
                            </taxonoccurrence>
inputs/VegBank/stemcount_/new_terms.csv
1
taxonimportance_id,aggregateOrganismObservationID,/_join/1,
1
taxonimportance_id,aggregateOrganismObservationID__taxon_presence,,
2 2
cover,coverPercent,,
3
stemcount_id,aggregateOrganismObservationID,/_join/2,
3
stemcount_id,aggregateOrganismObservationID__individual_count,,
4 4
stemdiameter,diameterBreastHeight_cm,,"""The diameter of the stem in centimeters"" (stemDiameter definition at <http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&wparam=stemcount&entity=dba_tabledescription&where=where_tablename>)"
inputs/VegBank/stemcount_/unmapped_terms.csv
1
aggregateOrganismObservationID__taxon_presence
1 2
*stratum_id
2 3
*basalarea
3 4
*biomass
......
6 7
*stratumheight
7 8
*emb_taxonimportance
8 9
*covercode
10
aggregateOrganismObservationID__individual_count
9 11
*stemdiameteraccuracy
10 12
*stemheightaccuracy
11 13
*stemtaxonarea

Also available in: Unified diff