RDForms (aka RDF Forms) is a JavaScript library that uses templates to describe how to edit, present and validate RDF. The library is intended to be used in web applications to ease the burden of developers to deal natively with RDF.
Homepage Repository npm JavaScript Download
npm install @entryscape/rdforms@10.11.1
RDForms ("RDF Forms") is a JavaScript library that provides a way to declarative describe how editors and presentation views of RDF should look like. The configuration mechanism eliminates the need for programming once the library has been deployed into an environment.
Before you can use RDForms you need to make sure all the dependencies are loaded:
$ cd path_to_rdforms
$ git submodule init
$ git submodule update
$ npm install
$ grunt build
This requires that you have nodejs and npm.
It is recommended to experiment directly with non-built versions as it gives you very good debugging and inspection tools to understand what is going on (especially firebug in firefox and the built in debugging tools in Chrome). Furthermore, you do not have to deploy the rdforms library on a web server, you can point your browser to the sample directory using file: address, for instance file:///path_to_rdforms/samples/example1.html. But due to the AJAX approach for loading dependencies you first have to allow your browser to do ajax request from a file url, in Firefox this is done by:
In Chrome this is done by starting the browser with the following flag: --allow-file-access-from-files
A good way to start is to take a look at the samples.
Similar to example1.html but loads the RDForms framework in non-built version. This is useful for debugging. Take inspiration from this approach if you need to test new code and want to avoid the delay of the building process.
Different from example1 in the sense that it loads the graph and template from separate files.
Different from example2 in how it loads the template form a separate file and how to depend on files not part of the build. See the next section for a longer explanation about the build.
The build process uses r.js and works like this:
So you should be able to use rdforms by simply including the all.js. (see samples/example1.html).
However, if you need files that are not bundled in all.js there are two alternatives:
To achieve alternative 2 you add the following before you load any rdforms files via require.
require.config({
baseUrl: "../release"
});
The path (baseUrl) need to be relative to your main html file. You can see an example of this in samples/example3.html.
Note: a baseUrl is already given in the config/deps.js which is also included in all.js. However, in most production environments this value is wrong as it points to the libs directory (not transpiled). In many cases it is also the wrong relative path from your html file.)