Generate HTML forms from RDF/Turtle
tgForms is a JavaScript library to generate HTML forms from RDF/Turtle. It was originally written for the use with TextGrid.
If you have node.js and Bower installed, you can get the latest development version of tgForms with the following command:
$ bower install hriebl/tgForms
If you want to download a specific pre-compiled version of tgForms, just append the version number to the command, e.g.:
$ bower install hriebl/tgForms#0.1
Compiling tgForms is easy if you have CoffeeScript and Cake installed. In the tgForms directory, execute:
$ cake build
You may also minify the compiled JS file by running these commands:
$ wget "http://dl.google.com/closure-compiler/compiler-latest.zip"
$ unzip -nx "compiler-latest.zip"
$ cake minify
tgForms understands some RDF Schema properties, namely rdfs:domain, rdfs:label, and rdfs:range, and interprets their subjects as form fields. Forms can be generated for classes that are used as objects of rdfs:domain. The library also comes with the following specific properties to refine forms:
Sets the input type for a property.
Sets the default value for a property.
Sets a dropdown option for a property.
Sets the priority for a property. Higher priorities appear first.
Makes a property repeatable.
The following input types are available for the use with tgforms:hasInput:
A button. May be manually scripted.
A checkbox. Useful for boolean properties.
A dropbox menu. Useful if there is a limited number of options.
A text field. Useful for short texts.
A text area. Useful to longer texts.
tgForms is compatible with the RDF/Turtle from schema.rdfs.org. If you like, take a look at some CoffeScript code that generates a form for the schema:BarOrPub class.
TODO: Add up-to-date information about public methods, for the moment take a look at the source code.