@inrupt/solid-client / thing/build

Module: thing/build

Table of contents

Type aliases

Functions

Type aliases

ThingBuilder

Ƭ ThingBuilder<T>: Object

A Fluent interface to build a Thing.

Add, replace or remove property values using consecutive calls to .add*(), .set*() and .remove*(), then finally generate a Thing with the given properties using .build().

since 1.9.0

Type parameters

Name

Type

T

extends Thing

Type declaration

Name

Type

addBoolean

Adder<boolean, T>

addDate

Adder<Date, T>

addDatetime

Adder<Date, T>

addDecimal

Adder<number, T>

addInteger

Adder<number, T>

addIri

Adder<Url | UrlString | Thing, T>

addLiteral

Adder<Literal, T>

addNamedNode

Adder<NamedNode, T>

addStringEnglish

Adder<string, T>

addStringNoLocale

Adder<string, T>

addTerm

Adder<Quad_Object, T>

addTime

Adder<Time, T>

addUrl

Adder<Url | UrlString | Thing, T>

removeBoolean

Remover<boolean, T>

removeDate

Remover<Date, T>

removeDatetime

Remover<Date, T>

removeDecimal

Remover<number, T>

removeInteger

Remover<number, T>

removeIri

Remover<Url | UrlString | Thing, T>

removeLiteral

Remover<Literal, T>

removeNamedNode

Remover<NamedNode, T>

removeStringEnglish

Remover<string, T>

removeStringNoLocale

Remover<string, T>

removeTime

Remover<Time, T>

removeUrl

Remover<Url | UrlString | Thing, T>

setBoolean

Setter<boolean, T>

setDate

Setter<Date, T>

setDatetime

Setter<Date, T>

setDecimal

Setter<number, T>

setInteger

Setter<number, T>

setIri

Setter<Url | UrlString | Thing, T>

setLiteral

Setter<Literal, T>

setNamedNode

Setter<NamedNode, T>

setStringEnglish

Setter<string, T>

setStringNoLocale

Setter<string, T>

setTerm

Setter<Quad_Object, T>

setTime

Setter<Time, T>

setUrl

Setter<Url | UrlString | Thing, T>

addStringWithLocale

(property: string | Url, value: string, locale: string) => ThingBuilder<T>

build

() => T

removeAll

(property: string | Url) => ThingBuilder<T>

removeStringWithLocale

(property: string | Url, value: string, locale: string) => ThingBuilder<T>

setStringWithLocale

(property: string | Url, value: string, locale: string) => ThingBuilder<T>

Defined in

src/thing/build.ts:113

Functions

buildThing

buildThing(init): ThingBuilder<ThingLocal>

Modify a Thing, setting multiple properties in a single expresssion.

For example, you can initialise several properties of a given Thing as follows:

const me = buildThing(createThing({ name: "profile-vincent" }))
  .addUrl(rdf.type, schema.Person)
  .addStringNoLocale(schema.givenName, "Vincent")
  .build();

Take note of the final call to .build() to obtain the actual Thing.

since 1.9.0

Parameters

Name

Type

Description

init

ThingLocal

A Thing to modify.

Returns

ThingBuilder<ThingLocal>

a ThingBuilder, a Fluent API that allows you to set multiple properties in a single expression.

Defined in

src/thing/build.ts:187

buildThing(init): ThingBuilder<ThingPersisted>

Modify a Thing, setting multiple properties in a single expresssion.

For example, you can initialise several properties of a given Thing as follows:

const me = buildThing(createThing({ url: "https://example.pod/profile#vincent" }))
  .addUrl(rdf.type, schema.Person)
  .addStringNoLocale(schema.givenName, "Vincent")
  .build();

Take note of the final call to .build() to obtain the actual Thing.

since 1.9.0

Parameters

Name

Type

Description

init

ThingPersisted

A Thing to modify.

Returns

ThingBuilder<ThingPersisted>

a ThingBuilder, a Fluent API that allows you to set multiple properties in a single expression.

Defined in

src/thing/build.ts:204

buildThing(init): ThingBuilder<ThingLocal>

Create a Thing, setting multiple properties in a single expresssion.

For example, you can create a new Thing and initialise several properties as follows:

const me = buildThing({ name: "profile-vincent" })
  .addUrl(rdf.type, schema.Person)
  .addStringNoLocale(schema.givenName, "Vincent")
  .build();

Take note of the final call to .build() to obtain the actual Thing.

since 1.9.0

Parameters

Name

Type

Description

init

CreateThingLocalOptions

Options used to initialise a new Thing.

Returns

ThingBuilder<ThingLocal>

a ThingBuilder, a Fluent API that allows you to set multiple properties in a single expression.

Defined in

src/thing/build.ts:221

buildThing(init): ThingBuilder<ThingPersisted>

Create a Thing, setting multiple properties in a single expresssion.

For example, you can create a new Thing and initialise several properties as follows:

const me = buildThing({ url: "https://example.pod/profile#vincent" })
  .addUrl(rdf.type, schema.Person)
  .addStringNoLocale(schema.givenName, "Vincent")
  .build();

Take note of the final call to .build() to obtain the actual Thing.

since 1.9.0

Parameters

Name

Type

Description

init

CreateThingPersistedOptions

Optionally pass an existing Thing to modify the properties of. If left empty, buildThing will initialise a new Thing.

Returns

ThingBuilder<ThingPersisted>

a ThingBuilder, a Fluent API that allows you to set multiple properties in a single expression.

Defined in

src/thing/build.ts:240

buildThing(): ThingBuilder<ThingLocal>

Create a Thing, setting multiple properties in a single expresssion.

For example, you can create a new Thing and initialise several properties as follows:

const me = buildThing()
  .addUrl(rdf.type, schema.Person)
  .addStringNoLocale(schema.givenName, "Vincent")
  .build();

Take note of the final call to .build() to obtain the actual Thing.

since 1.9.0

Returns

ThingBuilder<ThingLocal>

a ThingBuilder, a Fluent API that allows you to set multiple properties in a single expression.

Defined in

src/thing/build.ts:258