Inrupt Vocabulary Libraries

Inrupt provides the following vocabulary libraries that provide convenience objects (as JavaScript classes) that contain static constants for common identifiers used across Solid (and RDF in general). Rather than hardcoding the identifiers, developers can use these classes instead.

Library

Description

vocab-common-rdf

Inrupt vocab-common-rdf is a library that provides convenience objects for many RDF-related identifiers, such as the Person and familyName identifiers from the Schema.org vocabulary from Google, Microsoft and Yahoo!

vocab-solid-common

Inrupt vocab-solid-rdf is a library that provides convenience objects for many Solid-related identifiers.

vocab-inrupt-common

Inrupt vocab-inrupt-common is a library that provides convenience objects for Inrupt-related identifiers.

Inrupt vocab-common-rdf is a client library that bundles constants that refer to terms in some pre-existing vocabularies. Applications can use these constants to read and write data instead of specifying the URL. For example:

Full Vocabulary URI

vocab-common-rdf Constant

"http://schema.org/familyName"

SCHEMA_INRUPT.familyName

"http://xmlns.com/foaf/0.1/firstName"

FOAF.firstName

Convenience Object Naming Scheme

The convenience object names, in general, match the term names in the original RDF unless the use of the term name results in an illegal variable name for the programming language. For example:

  • 1:1 Correspondence

    For the VCARD vocabulary term bday (IRI http://www.w3.org/2006/vcard/ns#bday), the corresponding convenience object in the vocab-common-rdf library is VCARD.bday.

  • Transform Illegal Property Name

    In JavaScript, variable names cannot contain hyphens -. As such, the Inrupt vocabulary libraries replaces the hyphens with underscores _. For example, the VCARD vocabulary term given_name (IRI http://www.w3.org/2006/vcard/ns#given-name) corresponds to VCARD.given_name.

If you receive an undefined error when using the convenience object from one of the libraries:

  1. Check the term name.

  2. Inrupt’s vocabularies contains many, but not all, the common identifiers. If your term is not included in the library, Inrupt’s libraries provide a namespace helper function NS() to help with the IRIs.

    That is, if VCARD vocabulary term someTermMissingFromLibrary with IRI http://www.w3.org/2006/vcard/ns#someTermMissingFromLibrary, you can use VCARD.NS("someTermMissingFromLibrary") instead of specifying the full IRI.

Install

You can use npm to install the libraries; e.g., to install the vocab-common-rdf library:

npm install @inrupt/vocab-common-rdf

See also:

Additional References