Import

Import

The import class helps import csv, xml and raw text data into a corpus, or create a new corpus.

Constructor

new Import()

Source:
Tutorials:
  • Tutorial: tests/CorpusTest.js
Properties:
Name Type Description
files FileList These are the file(s) that were dragged in.
dbname String This is the corpusid wherej the data should be imported
fields DatumFields The fields array contains titles of the data columns.
datalist DataList The datalist imported, to hold the data before it is saved.
event Event The drag/drop event.
The initialize serves to bind import to all drag and drop events.

Extends

Members

datalist :Object

Source:
Holds meta data about the imported data list and references to the datum ids
Type:
  • Object

files :Object

Source:
Holds the files themselves while the import is in process
Type:
  • Object

guessFormatAndPreviewImport

Source:
This function attempts to guess the format of the file/textarea, and calls the appropriate import handler.

import :Object

Source:
Executes the final import if the options indicate that it should be executed, by default it only produces a dry run.
Type:
  • Object

importCSV

Source:
This function tries to guess if you have \n or \r as line endings and then tries to determine if you have "surounding your text". CSV is a common export format for Filemaker, Microsoft Excel and OpenOffice Spreadsheets, and could be a good format to export from these sources and import into FieldDB.

importRawText

Source:
This function accepts text using double (or triple etc) spaces to indicate separate datum. Each line in the block is treated as a column in the table. If you have your data in Microsoft word or OpenOffice or plain text, then this will be the easiest format for you to import your data in.

importTabbed

Source:
This function accepts text which uses \t tabs between columns. If you have your data in ELAN or in Microsoft Excel or OpenOffice spreadsheets, this will most likely be a good format to export your data, and import into FieldDB. This function is triggered if your file has more than 100 tabs in it, FieldDB guesses that it should try this function.

importTextIGT

Source:
This function accepts text using double (or triple etc) spaces to indicate separate datum. Each line in the block is treated as a column in the table. If you have your data in Microsoft word or OpenOffice or plain text, then this will be the easiest format for you to import your data in.

importToolbox

Source:
This function takes in a text block, splits it on lines and then takes the first word with a \firstword as the data type/column heading and then walks through the file looking for lines that start with \ge and creates a new datum each time it finds \ge This works for verb lexicons but would be \ref if an interlinear gloss. TODO figure out how Toolbox knows when one data entry stops and another starts. It doesn't appear to be double spaces...

normalizeImportFieldWithExistingCorpusFields

Source:
This function looks for the field's details from the import fields, if they exist it returns those values. If the field isnt in the importFields, it looks for fields which this field should map to (eg, if the field is codepermanent it can be mapped to anonymouscode)

parseLineCSV

Source:
http://purbayubudi.wordpress.com/2008/11/09/csv-parser-using-javascript/ -- CSV PARSER -- author : Purbayu, 30Sep2008 email : purbayubudi@gmail.com description : This jscript code describes how to load csv file and parse it into fields. Additionally, a function to display html table as result is added. disclamer: To use this code freely, you must put author's name in it.

pause :Object

Source:
Saves the import's state to file to be resumed or reviewed later
Type:
  • Object

readFileIntoRawText

Source:
Reads a file using the FileReader API, can read only part of a file if start and stop are passed in the options.

readFiles

Source:
Reads the import's array of files using a supplied readOptions or using the readFileIntoRawText function which uses the browsers FileReader API. It can read only part of a file if start and stop are passed in the options.

resume :Object

Source:
Resumes a previous import from a json object, or a uri containing json
Type:
  • Object