This section provides a complete reference regarding the configuration possibilities of modules, components and configurations. How these configuration possibilities are interpreted by Components.js can be found here.
Components.js uses semantic configuration files. This means that these files encode their actual meaning by using standard vocabularies in order to make these files machine-readable.
Configuration files must be defined in an RDF, this has the following advantages:
- Components and instances are uniquely identifiable (via URIs). This makes it possible to for example split up configurations into multiple files, and refer to the same components and instances using their unique URI.
- Configuration files are self-descriptive, and not necessarily tied to Components.js. For example, RDF-consuming applications can be used to discover the structure of your application and possibly even visualize it, just using your config file.
- Alternative implementations of a dependency injection framework for these config files can be created as they are based on external vocabularies, possibly even in other programming languages.
Components.js can understand a certain set of predicates and types in configuration files. These are used to encode the actual meaning of the contents of these files. Predicates define the relationship type between two things, and types define the type of a thing. For example, a certain predicate can be used to say that a given component is part of a given module. These predicates and types are defined in vocabularies.
RDF allows graph-based datasets to be created by linking things with certain relationships. These things and relationships are represented by literals or URIs. (Standard) vocabularies contain reusable concepts and relationships.
RDF is a W3C recommendation for data interchange on the Web.
Because configuration files are defined in RDF, all applications that can handle RDF can work with these files and act on it, such as reasoners, query engines, other dependency injection framework implementations, ...
The following vocabularies are understood by Components.js:
If the JSON-LD serialization is used, shortcuts can be used for most of the URLs using Components.js's context: https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^4.0.0/components/context.jsonld
These vocabularies will be referenced by their prefix and JSON-LD shortcut in the following sections.