@inrupt/solid-client / thing/build

Module: thing/build#

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>

addStringWithLocale

(property: Parameters<typeof addStringWithLocale>[1], value: Parameters<typeof addStringWithLocale>[2], locale: Parameters<typeof addStringWithLocale>[3]) => ThingBuilder<T>

addTerm

Adder<Quad_Object, T>

addTime

Adder<Time, T>

addUrl

Adder<Url | UrlString | Thing, T>

build

() => T

removeAll

(property: Parameters<typeof removeLiteral>[1]) => ThingBuilder<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>

removeStringWithLocale

(property: Parameters<typeof removeStringWithLocale>[1], value: Parameters<typeof removeStringWithLocale>[2], locale: Parameters<typeof removeStringWithLocale>[3]) => ThingBuilder<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>

setStringWithLocale

(property: Parameters<typeof setStringWithLocale>[1], value: Parameters<typeof setStringWithLocale>[2], locale: Parameters<typeof setStringWithLocale>[3]) => ThingBuilder<T>

setTerm

Setter<Quad_Object, T>

setTime

Setter<Time, T>

setUrl

Setter<Url | UrlString | Thing, T>

Defined in#

src/thing/build.ts:109

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.

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.

Since

1.9.0

Defined in#

src/thing/build.ts:183

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.

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.

Since

1.9.0

Defined in#

src/thing/build.ts:200

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.

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.

Since

1.9.0

Defined in#

src/thing/build.ts:217

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.

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.

Since

1.9.0

Defined in#

src/thing/build.ts:236

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.

Returns#

ThingBuilder<ThingLocal>

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

Since

1.9.0

Defined in#

src/thing/build.ts:254