Project

General

Profile

« Previous | Next » 

Revision 13800

schemas/public_.sql, inputs/.TNRS/schema.sql: upgraded to Postgres 9.3.4 format, which removes trailing " "

View differences:

schema.sql
363 363
--
364 364

  
365 365
CREATE VIEW "MatchedTaxon" AS
366
 SELECT s."*Name_matched.batch", 
367
    s."concatenatedScientificName", 
368
    s."matchedTaxonName", 
369
    s."matchedTaxonRank", 
370
    s."*Name_matched.Name_score", 
371
    s."matchedScientificNameAuthorship", 
372
    s."matchedScientificNameID", 
373
    s."*Name_matched.Author_score", 
374
    s."matchedFamilyConfidence_fraction", 
375
    s."matchedFamily", 
376
    s."matchedGenus", 
377
    s."matchedGenusConfidence_fraction", 
378
    s."matchedSpecificEpithet", 
379
    s."matchedSpeciesConfidence_fraction", 
380
    s."matchedInfraspecificEpithet", 
381
    s."*Name_matched.Infraspecific_epithet_score", 
382
    s."identificationQualifier", 
383
    s."morphospeciesSuffix", 
384
    s."taxonomicStatus", 
385
    s.accepted_taxon_name_no_author, 
386
    s.accepted_author, 
387
    s.accepted_taxon_rank, 
388
    s."acceptedScientificNameID", 
389
    s.accepted_species_binomial, 
390
    s.accepted_family, 
391
    s."*Name_matched.Selected", 
392
    s."*Name_matched.Source", 
393
    s."*Name_matched.Warnings", 
394
    s."*Name_matched.Accepted_name_lsid", 
395
    s.taxon_scrub__is_valid_match, 
396
    s.scrubbed_unique_taxon_name, 
366
 SELECT s."*Name_matched.batch",
367
    s."concatenatedScientificName",
368
    s."matchedTaxonName",
369
    s."matchedTaxonRank",
370
    s."*Name_matched.Name_score",
371
    s."matchedScientificNameAuthorship",
372
    s."matchedScientificNameID",
373
    s."*Name_matched.Author_score",
374
    s."matchedFamilyConfidence_fraction",
375
    s."matchedFamily",
376
    s."matchedGenus",
377
    s."matchedGenusConfidence_fraction",
378
    s."matchedSpecificEpithet",
379
    s."matchedSpeciesConfidence_fraction",
380
    s."matchedInfraspecificEpithet",
381
    s."*Name_matched.Infraspecific_epithet_score",
382
    s."identificationQualifier",
383
    s."morphospeciesSuffix",
384
    s."taxonomicStatus",
385
    s.accepted_taxon_name_no_author,
386
    s.accepted_author,
387
    s.accepted_taxon_rank,
388
    s."acceptedScientificNameID",
389
    s.accepted_species_binomial,
390
    s.accepted_family,
391
    s."*Name_matched.Selected",
392
    s."*Name_matched.Source",
393
    s."*Name_matched.Warnings",
394
    s."*Name_matched.Accepted_name_lsid",
395
    s.taxon_scrub__is_valid_match,
396
    s.scrubbed_unique_taxon_name,
397 397
        CASE
398 398
            WHEN (s.accepted_taxon_rank = 'family'::text) THEN concat_ws(' '::text, s.accepted_family, s."morphospeciesSuffix")
399 399
            WHEN (s.accepted_taxon_rank = 'genus'::text) THEN concat_ws(' '::text, s.accepted_taxon_name_no_author, s."morphospeciesSuffix")
400 400
            ELSE s.accepted_species_binomial
401 401
        END AS accepted_morphospecies_binomial
402
   FROM ( SELECT tnrs.batch AS "*Name_matched.batch", 
403
            tnrs."Name_submitted" AS "concatenatedScientificName", 
404
            tnrs."Name_matched" AS "matchedTaxonName", 
405
            tnrs."Name_matched_rank" AS "matchedTaxonRank", 
406
            tnrs."Name_score" AS "*Name_matched.Name_score", 
407
            tnrs."Name_matched_author" AS "matchedScientificNameAuthorship", 
408
            tnrs."Name_matched_url" AS "matchedScientificNameID", 
409
            tnrs."Author_score" AS "*Name_matched.Author_score", 
410
            tnrs."Family_score" AS "matchedFamilyConfidence_fraction", 
411
            COALESCE(tnrs."Name_matched_accepted_family", tnrs."Accepted_name_family") AS "matchedFamily", 
412
            tnrs."Genus_matched" AS "matchedGenus", 
413
            tnrs."Genus_score" AS "matchedGenusConfidence_fraction", 
414
            tnrs."Specific_epithet_matched" AS "matchedSpecificEpithet", 
415
            tnrs."Specific_epithet_score" AS "matchedSpeciesConfidence_fraction", 
416
            tnrs."Infraspecific_epithet_matched" AS "matchedInfraspecificEpithet", 
417
            tnrs."Infraspecific_epithet_score" AS "*Name_matched.Infraspecific_epithet_score", 
418
            tnrs."Annotations" AS "identificationQualifier", 
419
            tnrs."Unmatched_terms" AS "morphospeciesSuffix", 
420
            map_taxonomic_status(tnrs."Taxonomic_status", tnrs."Accepted_name") AS "taxonomicStatus", 
421
            tnrs."Accepted_name" AS accepted_taxon_name_no_author, 
422
            tnrs."Accepted_name_author" AS accepted_author, 
423
            tnrs."Accepted_name_rank" AS accepted_taxon_rank, 
424
            tnrs."Accepted_name_url" AS "acceptedScientificNameID", 
425
            tnrs."Accepted_name_species" AS accepted_species_binomial, 
426
            tnrs."Accepted_name_family" AS accepted_family, 
427
            tnrs."Selected" AS "*Name_matched.Selected", 
428
            tnrs."Source" AS "*Name_matched.Source", 
429
            tnrs."Warnings" AS "*Name_matched.Warnings", 
430
            tnrs."Accepted_name_lsid" AS "*Name_matched.Accepted_name_lsid", 
431
            tnrs.is_valid_match AS taxon_scrub__is_valid_match, 
402
   FROM ( SELECT tnrs.batch AS "*Name_matched.batch",
403
            tnrs."Name_submitted" AS "concatenatedScientificName",
404
            tnrs."Name_matched" AS "matchedTaxonName",
405
            tnrs."Name_matched_rank" AS "matchedTaxonRank",
406
            tnrs."Name_score" AS "*Name_matched.Name_score",
407
            tnrs."Name_matched_author" AS "matchedScientificNameAuthorship",
408
            tnrs."Name_matched_url" AS "matchedScientificNameID",
409
            tnrs."Author_score" AS "*Name_matched.Author_score",
410
            tnrs."Family_score" AS "matchedFamilyConfidence_fraction",
411
            COALESCE(tnrs."Name_matched_accepted_family", tnrs."Accepted_name_family") AS "matchedFamily",
412
            tnrs."Genus_matched" AS "matchedGenus",
413
            tnrs."Genus_score" AS "matchedGenusConfidence_fraction",
414
            tnrs."Specific_epithet_matched" AS "matchedSpecificEpithet",
415
            tnrs."Specific_epithet_score" AS "matchedSpeciesConfidence_fraction",
416
            tnrs."Infraspecific_epithet_matched" AS "matchedInfraspecificEpithet",
417
            tnrs."Infraspecific_epithet_score" AS "*Name_matched.Infraspecific_epithet_score",
418
            tnrs."Annotations" AS "identificationQualifier",
419
            tnrs."Unmatched_terms" AS "morphospeciesSuffix",
420
            map_taxonomic_status(tnrs."Taxonomic_status", tnrs."Accepted_name") AS "taxonomicStatus",
421
            tnrs."Accepted_name" AS accepted_taxon_name_no_author,
422
            tnrs."Accepted_name_author" AS accepted_author,
423
            tnrs."Accepted_name_rank" AS accepted_taxon_rank,
424
            tnrs."Accepted_name_url" AS "acceptedScientificNameID",
425
            tnrs."Accepted_name_species" AS accepted_species_binomial,
426
            tnrs."Accepted_name_family" AS accepted_family,
427
            tnrs."Selected" AS "*Name_matched.Selected",
428
            tnrs."Source" AS "*Name_matched.Source",
429
            tnrs."Warnings" AS "*Name_matched.Warnings",
430
            tnrs."Accepted_name_lsid" AS "*Name_matched.Accepted_name_lsid",
431
            tnrs.is_valid_match AS taxon_scrub__is_valid_match,
432 432
            tnrs.scrubbed_unique_taxon_name
433 433
           FROM tnrs) s;
434 434

  
......
450 450
--
451 451

  
452 452
CREATE VIEW "ValidMatchedTaxon" AS
453
 SELECT "MatchedTaxon"."*Name_matched.batch", 
454
    "MatchedTaxon"."concatenatedScientificName", 
455
    "MatchedTaxon"."matchedTaxonName", 
456
    "MatchedTaxon"."matchedTaxonRank", 
457
    "MatchedTaxon"."*Name_matched.Name_score", 
458
    "MatchedTaxon"."matchedScientificNameAuthorship", 
459
    "MatchedTaxon"."matchedScientificNameID", 
460
    "MatchedTaxon"."*Name_matched.Author_score", 
461
    "MatchedTaxon"."matchedFamilyConfidence_fraction", 
462
    "MatchedTaxon"."matchedFamily", 
463
    "MatchedTaxon"."matchedGenus", 
464
    "MatchedTaxon"."matchedGenusConfidence_fraction", 
465
    "MatchedTaxon"."matchedSpecificEpithet", 
466
    "MatchedTaxon"."matchedSpeciesConfidence_fraction", 
467
    "MatchedTaxon"."matchedInfraspecificEpithet", 
468
    "MatchedTaxon"."*Name_matched.Infraspecific_epithet_score", 
469
    "MatchedTaxon"."identificationQualifier", 
470
    "MatchedTaxon"."morphospeciesSuffix", 
471
    "MatchedTaxon"."taxonomicStatus", 
472
    "MatchedTaxon".accepted_taxon_name_no_author, 
473
    "MatchedTaxon".accepted_author, 
474
    "MatchedTaxon".accepted_taxon_rank, 
475
    "MatchedTaxon"."acceptedScientificNameID", 
476
    "MatchedTaxon".accepted_species_binomial, 
477
    "MatchedTaxon".accepted_family, 
478
    "MatchedTaxon"."*Name_matched.Selected", 
479
    "MatchedTaxon"."*Name_matched.Source", 
480
    "MatchedTaxon"."*Name_matched.Warnings", 
481
    "MatchedTaxon"."*Name_matched.Accepted_name_lsid", 
482
    "MatchedTaxon".taxon_scrub__is_valid_match, 
483
    "MatchedTaxon".scrubbed_unique_taxon_name, 
453
 SELECT "MatchedTaxon"."*Name_matched.batch",
454
    "MatchedTaxon"."concatenatedScientificName",
455
    "MatchedTaxon"."matchedTaxonName",
456
    "MatchedTaxon"."matchedTaxonRank",
457
    "MatchedTaxon"."*Name_matched.Name_score",
458
    "MatchedTaxon"."matchedScientificNameAuthorship",
459
    "MatchedTaxon"."matchedScientificNameID",
460
    "MatchedTaxon"."*Name_matched.Author_score",
461
    "MatchedTaxon"."matchedFamilyConfidence_fraction",
462
    "MatchedTaxon"."matchedFamily",
463
    "MatchedTaxon"."matchedGenus",
464
    "MatchedTaxon"."matchedGenusConfidence_fraction",
465
    "MatchedTaxon"."matchedSpecificEpithet",
466
    "MatchedTaxon"."matchedSpeciesConfidence_fraction",
467
    "MatchedTaxon"."matchedInfraspecificEpithet",
468
    "MatchedTaxon"."*Name_matched.Infraspecific_epithet_score",
469
    "MatchedTaxon"."identificationQualifier",
470
    "MatchedTaxon"."morphospeciesSuffix",
471
    "MatchedTaxon"."taxonomicStatus",
472
    "MatchedTaxon".accepted_taxon_name_no_author,
473
    "MatchedTaxon".accepted_author,
474
    "MatchedTaxon".accepted_taxon_rank,
475
    "MatchedTaxon"."acceptedScientificNameID",
476
    "MatchedTaxon".accepted_species_binomial,
477
    "MatchedTaxon".accepted_family,
478
    "MatchedTaxon"."*Name_matched.Selected",
479
    "MatchedTaxon"."*Name_matched.Source",
480
    "MatchedTaxon"."*Name_matched.Warnings",
481
    "MatchedTaxon"."*Name_matched.Accepted_name_lsid",
482
    "MatchedTaxon".taxon_scrub__is_valid_match,
483
    "MatchedTaxon".scrubbed_unique_taxon_name,
484 484
    "MatchedTaxon".accepted_morphospecies_binomial
485 485
   FROM "MatchedTaxon"
486 486
  WHERE "MatchedTaxon".taxon_scrub__is_valid_match;
......
591 591
--
592 592

  
593 593
CREATE VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" AS
594
 SELECT tnrs."Name_submitted" AS scrubbed_unique_taxon_name, 
595
    tnrs."Name_matched_rank" AS scrubbed_taxon_rank, 
596
    COALESCE(tnrs."Name_matched_accepted_family", tnrs."Family_matched") AS scrubbed_family, 
597
    tnrs."Genus_matched" AS scrubbed_genus, 
598
    tnrs."Specific_epithet_matched" AS scrubbed_specific_epithet, 
599
    tnrs."Infraspecific_rank" AS scrubbed_infraspecific_rank, 
600
    tnrs."Infraspecific_epithet_matched" AS scrubbed_infraspecific_epithet, 
601
    tnrs."Name_matched_author" AS scrubbed_author, 
602
    tnrs."Name_matched" AS scrubbed_taxon_name_no_author, 
594
 SELECT tnrs."Name_submitted" AS scrubbed_unique_taxon_name,
595
    tnrs."Name_matched_rank" AS scrubbed_taxon_rank,
596
    COALESCE(tnrs."Name_matched_accepted_family", tnrs."Family_matched") AS scrubbed_family,
597
    tnrs."Genus_matched" AS scrubbed_genus,
598
    tnrs."Specific_epithet_matched" AS scrubbed_specific_epithet,
599
    tnrs."Infraspecific_rank" AS scrubbed_infraspecific_rank,
600
    tnrs."Infraspecific_epithet_matched" AS scrubbed_infraspecific_epithet,
601
    tnrs."Name_matched_author" AS scrubbed_author,
602
    tnrs."Name_matched" AS scrubbed_taxon_name_no_author,
603 603
    (tnrs."Name_matched" || COALESCE((' '::text || tnrs."Name_matched_author"), ''::text)) AS scrubbed_taxon_name_with_author
604 604
   FROM tnrs;
605 605

  
......
618 618
--
619 619

  
620 620
CREATE VIEW taxon_scrub AS
621
 SELECT "ValidMatchedTaxon".scrubbed_unique_taxon_name, 
622
    "ValidMatchedTaxon"."*Name_matched.batch", 
623
    "ValidMatchedTaxon"."concatenatedScientificName", 
624
    "ValidMatchedTaxon"."matchedTaxonName", 
625
    "ValidMatchedTaxon"."matchedTaxonRank", 
626
    "ValidMatchedTaxon"."*Name_matched.Name_score", 
627
    "ValidMatchedTaxon"."matchedScientificNameAuthorship", 
628
    "ValidMatchedTaxon"."matchedScientificNameID", 
629
    "ValidMatchedTaxon"."*Name_matched.Author_score", 
630
    "ValidMatchedTaxon"."matchedFamilyConfidence_fraction", 
631
    "ValidMatchedTaxon"."matchedFamily", 
632
    "ValidMatchedTaxon"."matchedGenus", 
633
    "ValidMatchedTaxon"."matchedGenusConfidence_fraction", 
634
    "ValidMatchedTaxon"."matchedSpecificEpithet", 
635
    "ValidMatchedTaxon"."matchedSpeciesConfidence_fraction", 
636
    "ValidMatchedTaxon"."matchedInfraspecificEpithet", 
637
    "ValidMatchedTaxon"."*Name_matched.Infraspecific_epithet_score", 
638
    "ValidMatchedTaxon"."identificationQualifier", 
639
    "ValidMatchedTaxon"."morphospeciesSuffix", 
640
    "ValidMatchedTaxon"."taxonomicStatus", 
641
    "ValidMatchedTaxon".accepted_taxon_name_no_author, 
642
    "ValidMatchedTaxon".accepted_author, 
643
    "ValidMatchedTaxon".accepted_taxon_rank, 
644
    "ValidMatchedTaxon"."acceptedScientificNameID", 
645
    "ValidMatchedTaxon".accepted_species_binomial, 
646
    "ValidMatchedTaxon".accepted_family, 
647
    "ValidMatchedTaxon"."*Name_matched.Selected", 
648
    "ValidMatchedTaxon"."*Name_matched.Source", 
649
    "ValidMatchedTaxon"."*Name_matched.Warnings", 
650
    "ValidMatchedTaxon"."*Name_matched.Accepted_name_lsid", 
651
    "ValidMatchedTaxon".taxon_scrub__is_valid_match, 
652
    "ValidMatchedTaxon".accepted_morphospecies_binomial, 
653
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank, 
654
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family, 
655
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus, 
656
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet, 
657
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_rank, 
658
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_epithet, 
659
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_author, 
660
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author, 
661
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_with_author, 
621
 SELECT "ValidMatchedTaxon".scrubbed_unique_taxon_name,
622
    "ValidMatchedTaxon"."*Name_matched.batch",
623
    "ValidMatchedTaxon"."concatenatedScientificName",
624
    "ValidMatchedTaxon"."matchedTaxonName",
625
    "ValidMatchedTaxon"."matchedTaxonRank",
626
    "ValidMatchedTaxon"."*Name_matched.Name_score",
627
    "ValidMatchedTaxon"."matchedScientificNameAuthorship",
628
    "ValidMatchedTaxon"."matchedScientificNameID",
629
    "ValidMatchedTaxon"."*Name_matched.Author_score",
630
    "ValidMatchedTaxon"."matchedFamilyConfidence_fraction",
631
    "ValidMatchedTaxon"."matchedFamily",
632
    "ValidMatchedTaxon"."matchedGenus",
633
    "ValidMatchedTaxon"."matchedGenusConfidence_fraction",
634
    "ValidMatchedTaxon"."matchedSpecificEpithet",
635
    "ValidMatchedTaxon"."matchedSpeciesConfidence_fraction",
636
    "ValidMatchedTaxon"."matchedInfraspecificEpithet",
637
    "ValidMatchedTaxon"."*Name_matched.Infraspecific_epithet_score",
638
    "ValidMatchedTaxon"."identificationQualifier",
639
    "ValidMatchedTaxon"."morphospeciesSuffix",
640
    "ValidMatchedTaxon"."taxonomicStatus",
641
    "ValidMatchedTaxon".accepted_taxon_name_no_author,
642
    "ValidMatchedTaxon".accepted_author,
643
    "ValidMatchedTaxon".accepted_taxon_rank,
644
    "ValidMatchedTaxon"."acceptedScientificNameID",
645
    "ValidMatchedTaxon".accepted_species_binomial,
646
    "ValidMatchedTaxon".accepted_family,
647
    "ValidMatchedTaxon"."*Name_matched.Selected",
648
    "ValidMatchedTaxon"."*Name_matched.Source",
649
    "ValidMatchedTaxon"."*Name_matched.Warnings",
650
    "ValidMatchedTaxon"."*Name_matched.Accepted_name_lsid",
651
    "ValidMatchedTaxon".taxon_scrub__is_valid_match,
652
    "ValidMatchedTaxon".accepted_morphospecies_binomial,
653
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank,
654
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family,
655
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus,
656
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet,
657
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_rank,
658
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_epithet,
659
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_author,
660
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author,
661
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_with_author,
662 662
        CASE
663 663
            WHEN ("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank = 'family'::text) THEN concat_ws(' '::text, "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family, "ValidMatchedTaxon"."morphospeciesSuffix")
664 664
            WHEN ("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank = 'genus'::text) THEN concat_ws(' '::text, "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author, "ValidMatchedTaxon"."morphospeciesSuffix")

Also available in: Unified diff