Exhibit/Creating, Importing, and Managing Data

Exhibit Reference Home &raquo;

Exhibit's database natively understands data in its own format (a JSON format), but there are a number of ways to use data in other formats. If you have existing data in another format or if you prefer another format, you can
 * use the Babel service to convert your data into Exhibit's JSON format &raquo; Details
 * use an importer to convert your files into Exhibit's JSON format on-the-fly &raquo; Details

Manual Creation and Management
In order to create and manage data in files in Exhibit's JSON format, you just need a decent text editor (see our recommendations).

Start by entering this code into your text editor

{       items: [ ]   }

and save it in the same directory as your web page (.html file) is or will be stored. Give it a .js or .json extension just by convention; it doesn't really matter.

Be careful: note that there are both braces { } and brackets [ ]. Loosely speaking, braces { } are used to wrap many properties of different names, while brackets [ ] are used to wrap several things in a list. We'll tell you more about this later.

In the code above, your data records, or items in Exhibit's terminology, go in between the brackets. Here is the same code with 3 items:

{       items: [ {  label:              "John Doe", type:              "Person", age:               36, likes:             "Mary Smith", "favorite-color":  [ "blue", "yellow" ] },           {   label:              "Mary Smith", type:              "Person", "married-to":      "Joe Anderson", job:               "Doctor", worksAt:           "Boston General Hospital", hobby:             [ "painting", "karate" ] },           {   label:   "Boston General Hospital", type:   "Place", city:   "Boston" }       ]    }

Note:
 * There are 2 different types of items:  and  . You can make up as many as you want, and name them however you want. It's your data--you're the boss. We don't give you a global schema and force you to fit your data into it.
 * Items of the same type,  in this case, don't have to have the same properties all filled in. So, John has   but Mary doesn't. And Mary has   while John doesn't. Etc. etc. Fill in whatever information you have. Hey, life is messy and you never get complete information anyway. Hopefully you'll get some value of out Exhibit even with incomplete, messy data.
 * While the code we show here is neatly formatted and aligned, it doesn't have to be. You just manage your file as neatly as you yourself need so you won't make mistakes. Your data, your mess, your business.

However, there are a few minor things to pay attention to:
 * Watch out for { } vs. [ ]. Each item in the code above is wrapped in { } while a list of things like  is wrapped in [ ].
 * Watch out for commas. They are used to separate properties within { } and elements of a list within [ ]. Use commas only where needed. Particularly, don't put a comma after the last property in a pair of { }. Browsers can get very picky about misplaced commas.
 * Put quotation marks around text, e.g.,, not just  . Property names that don't contain non-alphanumeric characters, e.g.,   and  , don't need to be quoted, but those that contain non-alphanumeric characters, e.g.,  , need to be quoted.

But don't worry too much about these things. You can validate your files by uploading them to this service.

Your exhibit can include one or more data files. Each data file can contain any number of items (or none at all). It can also contain information about types and properties. It's all up to you how to split your data among several files. Your data, your mess, your business.

See Also: Understanding Exhibit Database

Conversion Using Babel
You can use the Babel web service to convert data in various formats into Exhibit's JSON format. Babel gives you the option of entering the URLs to your data files, uploading your data files from your computer, and just simply pasting your data into a text box.

At this time, the two most popular formats we support are Bibtex and Tab-Separated Values (TSV). While Bibtex is a special treat for the academically inclined (more details here), TSV is useful for everyone. Here is a quick tutorial for using Babel to convert TSV data.

Converting TSV Data Using Babel
(1) Carefully select just the text in the following table and copy it to your clipboard:

(2) Then browse to Babel. Hold down the Ctrl key while you click on that link so that you get a new window and don't lose these instructions.

(3) Select
 * "Tab-Separated Values" from the "from format" list, and
 * "Exhibit JSON" from the "to format" list.

(4) Pick "the data is text I can paste into this web page" in the "data to convert" column.

(5) Paste the table you copied into the big text box.

(6) Click on the "Upload and Preview" button.

You should now see an exhibit of 3 items. This "trick" works with data copied straight from Excel spreadsheets or from Google Spreadsheets, too.

Note that the first row must contain the property names, which must include "label" in one of the columns.

You can now click on the Download Raw Data button in that Exhibit to get the Exhibit JSON data. (Note that you could have gotten that data from the Babel page, too, by clicking the "Upload and Convert" button.)

For more information, refer to Babel's documentation.

Conversion at Load Time
Exhibit comes with a few importers that can either parse other formats themselves or bounce the data through Babel on-the-fly.

Babel-based Importers
Each importer is registered to work on some specific type(s) of data. For example, to import BibTex file, specify  in the data link:



To import other formats, specify the following types:


 * Excel files: use any of the following
 * application/msexcel
 * application/x-msexcel
 * application/vnd.ms-excel
 * application/x-excel
 * application/xls
 * application/x-xls
 * RDF/XML files: application/rdf+xml
 * N3 files: application/n3

If you can manually convert your data through Babel, you should be able to import it dynamically into your exhibit using this method. Note that this method slows down your exhibit as your data needs to travel through Babel first. We recommend that you do this only while developing your exhibit. Once your exhibit is finished, convert your data manually through Babel, save the result, and links your exhibit to the converted data instead.

Google Spreadsheet Importer
Refer to How_to_make_an_exhibit_from_data_fed_directly_from_a_Google_Spreadsheet.

Embedded-RDF Importers
Keith Alexander has donated an imported for RDFa. To use it, simply specify  in the data link.

Other Methods
Other methods for the creation of your JSON data.

JSON Maker (Excel Spreadsheet)
Jon Bogacki has written a macro enabled Excel Spreadsheet to convert Excel spreadsheet data into Simile Widgets JSON format: JSON Maker for Simile Widgets. The spreadsheet provides a simple interface to set your data Types and Properties.