Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
88 lines (75 sloc) 2.72 KB

Examples

Creating CLDF StructureDatasets from WALS

Prerequisites:

$ createdb walstutorial
$ gunzip -c wals_sql_dump.gz | psql walstutorial

The schema of this database is the clld core schema, augmented with the models defined for the WALS app.

  • Python 2.7 or 3.4+ with sqlalchemy, psycopg2, pycldf and clldutils installed.

Now we can run the script wals2cldf.py as follows (substitute POSTGRESUSER with a user who has read-access to your local database):

$ python wals2cldf.py "postgresql://POSTGRESUSER@/walstutorial" 1A

This packages the values of feature 1A as CLDF StructureDataset and we can now inspect the directory it created:

$ ls -ks1 wals_1A_cldf/
total 212
 12 StructureDataset-metadata.json
  4 codes.csv
 40 languages.csv
  4 parameters.csv
124 sources.bib
 28 values.csv

For further inspection we can use the cldf command:

$ cldf validate wals_1A_cldf/StructureDataset-metadata.json
$ cldf stats wals_1A_cldf/StructureDataset-metadata.json
<cldf:v1.0:StructureDataset at wals_1A_cldf>
key            value
-------------  ----------------------------------------------------
dc:conformsTo  http://cldf.clld.org/v1.0/terms.rdf#StructureDataset
dc:source      sources.bib

Path            Type              Rows
--------------  --------------  ------
values.csv      ValueTable         563
languages.csv   LanguageTable      563
parameters.csv  ParameterTable       1
codes.csv       CodeTable            5
sources.bib     Sources            947

Creating CLDF Wordlist from WOLD

Prerequisites:

$ createdb woldtutorial
$ gunzip -c wold2_sql_dump.gz | psql woldtutorial

The schema of this database is the clld core schema, augmented with the models defined for the WOLD app.

  • Python 2.7 or 3.4+ with sqlalchemy, psycopg2, pycldf and clldutils installed.

Now we can run the script wold2cldf.py as follows (substitute POSTGRESUSER with a user who has read-access to your local database):

$ python wals2cldf.py "postgresql://POSTGRESUSER@/woldtutorial" 1

to package the Swahili vocabulary as CLDF Wordlist, and inspect the directory it created:

$ ls -ks1 wold_1_cldf/
 12 Wordlist-metadata.json
 32 borrowings.csv
 72 forms.csv
  4 languages.csv
 60 parameters.csv
You can’t perform that action at this time.