The examples in this documentation always use JSON for defining module, component and config files. Components.js internally works with RDF data, which means that any kind of RDF serialization can be used.


Behind the scenes, the JSON files are in fact JSON-LD files containing RDF.

We encourage JSON(-LD) to be used for readability, as the JSON-LD context allows for shortcuts to be defined.

The RDF serializations that are currently supported are all those supported by rdf-parse.

More information on configurations can be found here.


If other serializations are used, the following vocabularies may be required:


Example: Turtle

For example, this is a simple component definition in Turtle:

@prefix oo: <>.
@prefix om: <>.
@prefix doap: <>.

<> a oo:Module;
  doap:name "my-module";
  oo:component <>.

<> a oo:Class;
  oo:componentPath "MyComponent";
  oo:parameter <>;
  oo:constructorArguments ( <> ).

This can be declaratively instantiated as follows:

<> a <>;
  <> "John".

Example Source