Carbon LDP JavaScript SDK API Reference
carbonldp Module
Classes
Interfaces
CarbonLDP Class
The main class of the SDK. Create an instance with the information of the platform to communicate.
The class contains, as static members, the references to all the reexported submodules in the SDK.
Constructor
CarbonLDP( url:string )
Creates the instance of the SDK with the URL of the platform to communicate.
Param | Type | Default | Description |
---|---|---|---|
url | string | The URL of the of the platform. |
CarbonLDP( settings:CarbonLDPSettings )
Creates the instance of the SDK with all the configurable settings of the SDK.
Param | Type | Default | Description |
---|---|---|---|
settings | CarbonLDPSettings | Object to fully configure the instance. |
Properties
#AbstractContext : typeof AbstractContext
#AccessPoint : typeof AccessPoint
#ContainerType : typeof ContainerType
#DigestedObjectSchema : typeof DigestedObjectSchema
#DigestedObjectSchemaProperty : typeof DigestedObjectSchemaProperty
#Document : typeof Document
#Errors : typeof Errors
#Fragment : typeof Fragment
#FreeResources : typeof FreeResources
#GlobalContext : typeof GlobalContext
#HTTP : typeof HTTP
#JSONLD : typeof JSONLD
#LDP : typeof LDP
#LDPatch : typeof LDPatch
#Messaging : typeof Messaging
#ObjectSchemaDigester : typeof ObjectSchemaDigester
#ObjectSchemaUtils : typeof ObjectSchemaUtils
#Pointer : typeof Pointer
#PointerType : typeof PointerType
#RDF : typeof RDF
#Resource : typeof Resource
#SHACL : typeof SHACL
#SPARQL : typeof SPARQL
#System : typeof System
#TransientAccessPoint : typeof TransientAccessPoint
#TransientFragment : typeof TransientFragment
#Utils : typeof Utils
#Vocabularies : typeof Vocabularies
#version : string
Version of the SDK.
.documents : CarbonLDP.Document
The root document of the platform.
.version : string
Methods
.getPlatformMetadata() : Promise<CarbonLDP.System.PlatformMetadata>
getPlatformMetadata():Promise<System.PlatformMetadata>
Retrieves the metadata document of the platform.
CarbonLDP.CarbonLDPSettings Interface
carbonldp/AccessPoint Module
Interfaces
c:AccessPoint
. CarbonLDP.AccessPoint
object. CarbonLDP.TransientAccessPoint
. c:AccessPoint
. CarbonLDP.TransientAccessPoint
objects. Properties
#AccessPoint : CarbonLDP.AccessPointFactory
Constant that implements the CarbonLDP.AccessPointFactory
interface.
#TransientAccessPoint : CarbonLDP.TransientAccessPointFactory
Constant that implements the CarbonLDP.TransientAccessPointFactory
interface.
CarbonLDP.AccessPoint Interface
Model that represents a c:AccessPoint
.
Properties
.hasMemberRelation : CarbonLDP.Pointer
The relation the access point manages.
.insertedContentRelation : CarbonLDP.Pointer
The inserted content relation the access point have.
.isMemberOfRelation : CarbonLDP.Pointer
The optional inverted relation the access point also manages.
.membershipResource : CarbonLDP.Document
The resource the access point belongs to.
CarbonLDP.AccessPointFactory Interface
Factory, decorator and utils of a CarbonLDP.AccessPoint
object.
Properties
.TYPE : CarbonLDP.TransientAccessPointFactory["TYPE"]
.create : CarbonLDP.TransientAccessPointFactory["create"]
.createFrom : CarbonLDP.TransientAccessPointFactory["createFrom"]
Methods
.is() : value is CarbonLDP.AccessPoint
is( value:any ):value is AccessPoint
Returns true if the value provided is considered an CarbonLDP.AccessPoint
.
Param | Type | Default | Description |
---|---|---|---|
value | any | Element to be checked. |
CarbonLDP.BaseAccessPoint Interface
Basic properties to construct a CarbonLDP.TransientAccessPoint
.
Properties
.hasMemberRelation : string | CarbonLDP.Pointer
The relation the access point will manage.
.insertedContentRelation : string | CarbonLDP.Pointer
The inserted content relation the access point will have.
.isMemberOfRelation : string | CarbonLDP.Pointer
The optional inverted relation the access point will manage.
.membershipResource : CarbonLDP.Pointer
The parent resource the access point will manage the determined relation.
CarbonLDP.TransientAccessPoint Interface
The in-memory model that represents a c:AccessPoint
.
Properties
.hasMemberRelation : CarbonLDP.Pointer
The relation the access point will manage.
.insertedContentRelation : CarbonLDP.Pointer
The inserted content relation the access point will have.
.isMemberOfRelation : CarbonLDP.Pointer
The optional inverted relation the access point will manage.
CarbonLDP.TransientAccessPointFactory Interface
Factory, decorator and utils for CarbonLDP.TransientAccessPoint
objects.
Properties
Methods
.create() : T & CarbonLDP.TransientAccessPoint
create<T extends object>( data:T & BaseAccessPoint ):T & TransientAccessPoint
Create a CarbonLDP.TransientAccessPoint
object with the base data specified.
Param | Type | Default | Description |
---|---|---|---|
data | T & BaseAccessPoint | Data to create the transient access point. |
.createFrom() : T & CarbonLDP.TransientAccessPoint
createFrom<T extends object>( object:T & BaseAccessPoint ):T & TransientAccessPoint
Create a CarbonLDP.TransientAccessPoint
object from the object specified containing the base data.
Param | Type | Default | Description |
---|---|---|---|
object | T & BaseAccessPoint | Object with the base data that will be converted into an access point. |
.is() : value is CarbonLDP.TransientAccessPoint
is( value:any ):value is TransientAccessPoint
Returns true if the value provided is considered a CarbonLDP.TransientAccessPoint
.
Param | Type | Default | Description |
---|---|---|---|
value | any |
carbonldp/Context Module
Classes
CarbonLDP.Document
's. CarbonLDP
context as its parent. Interfaces
CarbonLDP.AbstractContext
. CarbonLDP.DocumentsContext
. CarbonLDP.DocumentPaths
where one can add sub-paths of the desired document. Abstract class used to define any context of the SDK.
Constructor
AbstractContext( parentContext:PARENT )
Create the context with an optional associated parent.
Param | Type | Default | Description |
---|---|---|---|
parentContext | PARENT | The optional parent context to be associated to the context. |
Properties
._baseURI : string
._generalObjectSchema : CarbonLDP.DigestedObjectSchema
._parentContext : PARENT
._settings : CarbonLDP.ContextSettings
._typeObjectSchemaMap : Map<string, CarbonLDP.DigestedObjectSchema>
.baseURI : string
.jsonldConverter : CarbonLDP.JSONLD.JSONLDConverter
.parentContext : PARENT
.registry : REGISTRY extends {} ? GeneralRegistry<REGISTRY> : undefined
.repository : REPOSITORY extends {} ? GeneralRepository<REPOSITORY> : undefined
Methods
.__extendGeneralSchema() : this
__extendGeneralSchema( objectSchema:ObjectSchema ):this
Param | Type | Default | Description |
---|---|---|---|
objectSchema | ObjectSchema |
.__extendTypeSchema() : this
__extendTypeSchema( objectSchema:ObjectSchema, type:string ):this
Param | Type | Default | Description |
---|---|---|---|
objectSchema | ObjectSchema | ||
type | string |
.__getInheritGeneralSchema() : CarbonLDP.DigestedObjectSchema
__getInheritGeneralSchema():DigestedObjectSchema
.__getInheritTypeSchema() : CarbonLDP.DigestedObjectSchema
__getInheritTypeSchema( type:string ):DigestedObjectSchema
Param | Type | Default | Description |
---|---|---|---|
type | string |
.__getObjectSchemasTypes() : string[]
__getObjectSchemasTypes():string[]
.__resolveTypeURI() : string
__resolveTypeURI( uri:string ):string
Param | Type | Default | Description |
---|---|---|---|
uri | string |
._getTypeObjectSchemas() : CarbonLDP.DigestedObjectSchema[]
_getTypeObjectSchemas( excepts:string[] ):DigestedObjectSchema[]
Returns all the typed schemas including the ones from the parent contexts.
Param | Type | Default | Description |
---|---|---|---|
excepts | string[] | Optional types to exclude in the returning of the stored schemas. |
.clearObjectSchema() : void
clearObjectSchema( type?:string ):void
Param | Type | Default | Description |
---|---|---|---|
type | string |
.extendObjectSchema() : this
extendObjectSchema( type:string, objectSchema:ObjectSchema ):this
Param | Type | Default | Description |
---|---|---|---|
type | string | ||
objectSchema | ObjectSchema |
extendObjectSchema( modelSchemaOrObjectSchema:ObjectSchema | ModelSchema<string> ):this
Param | Type | Default | Description |
---|---|---|---|
modelSchemaOrObjectSchema | ObjectSchema | ModelSchema<string> |
extendObjectSchema( modelSchemasOrObjectSchemas:(ObjectSchema | ModelSchema<string>)[] ):this
Param | Type | Default | Description |
---|---|---|---|
modelSchemasOrObjectSchemas | (ObjectSchema | ModelSchema<string>)[] |
.getObjectSchema() : CarbonLDP.DigestedObjectSchema
getObjectSchema( type?:string ):DigestedObjectSchema
Param | Type | Default | Description |
---|---|---|---|
type | string |
.hasObjectSchema() : boolean
hasObjectSchema( type:string ):boolean
Param | Type | Default | Description |
---|---|---|---|
type | string |
.resolve() : string
resolve( relativeURI:string ):string
Param | Type | Default | Description |
---|---|---|---|
relativeURI | string |
CarbonLDP.Context Interface
Interface that every context in the SDK must implement.
Properties
.baseURI : string
Base URI of the resources that can be used by the context.
.jsonldConverter : CarbonLDP.JSONLD.JSONLDConverter
Converter of JSONLD objects associated to the current context.
.parentContext : CarbonLDP.Context<any, any> | undefined
Parent context from where the context inherit some data, configurations and more.
.registry : REGISTRY extends {} ? GeneralRegistry<REGISTRY> : undefined
Registry where the context stores its associated resources.
.repository : REPOSITORY extends {} ? GeneralRepository<REPOSITORY> : undefined
Repository that can fetch the data of the resources of the context.
Methods
.clearObjectSchema() : void
clearObjectSchema( type?:string ):void
Remove the schema of a specific type if provided, or clear the general schema if no type is provided.
Param | Type | Default | Description |
---|---|---|---|
type | string | The URI of the type to remove its schema. |
.extendObjectSchema() : this
extendObjectSchema( objectSchema:ObjectSchema ):this
Extends the general object schema.
If the first extension, the general schema of the parent context will be duplicated into the current before its extended.
Param | Type | Default | Description |
---|---|---|---|
objectSchema | ObjectSchema | The schema data from where to extend the general schema. |
extendObjectSchema( type:string, objectSchema:ObjectSchema ):this
Extends the schema of the type specified.
If the first extension, the typed schema of the parent context will be duplicated into the current before its extended.
Param | Type | Default | Description |
---|---|---|---|
type | string | The URI of the type to extend its schema. | |
objectSchema | ObjectSchema | The schema data from where to extend the typed schema. |
extendObjectSchema( modelSchema:ModelSchema<string> ):this
Extends the schema of the type specified.
The signature behaves as the previous one but uses CarbonLDP.Model.ModelSchema.TYPE
as the type and CarbonLDP.Model.ModelSchema.SCHEMA
as the schema data extender.
Param | Type | Default | Description |
---|---|---|---|
modelSchema | ModelSchema<string> | The object with the type and the schema to extend. |
extendObjectSchema( schemas:(ObjectSchema | ModelSchema<string>)[] ):this
Extends a multiple of typed schemas using the interface CarbonLDP.Model.ModelSchema
or also extends the general schema when a direct object schema is provided.
Param | Type | Default | Description |
---|---|---|---|
schemas | (ObjectSchema | ModelSchema<string>)[] | The array of typed schemas and/or schemas to extend. |
.getObjectSchema() : CarbonLDP.DigestedObjectSchema
getObjectSchema( type?:string ):DigestedObjectSchema
Returns the object schema for the specified type if provided, otherwise the general object schema will be the one returned.
Param | Type | Default | Description |
---|---|---|---|
type | string | The URI of the type to look for tis schema. |
.hasObjectSchema() : boolean
hasObjectSchema( type:string ):boolean
Returns true if there is an object schema fot the specified type.
Param | Type | Default | Description |
---|---|---|---|
type | string | The URI of the type to check if has a schema. |
.resolve() : string
resolve( relativeURI:string ):string
Resolved the relative URI provided with the base URI of the context.
Param | Type | Default | Description |
---|---|---|---|
relativeURI | string | The URI to be resolved. |
CarbonLDP.ContextSettings Interface
Base settings of every CarbonLDP.AbstractContext
.
Properties
.vocabulary : string
Optional default vocabulary that will be used in the general schema of the associated context.
CarbonLDP.DocumentPaths Interface
Describe the paths inside a specified document.
Properties
.paths : CarbonLDP.Paths
The set of paths inside the specified document.
.slug : string
The slug that specifies the document to add paths.
Context to manage CarbonLDP.Document
's.
Constructor
DocumentsContext( url:string )
Create an instance of the document context with the URL as the base URI.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL to be set as the base URI of the context. |
Properties
._baseURI : string
._settings : CarbonLDP.DocumentsContextSettings
.messaging : CarbonLDP.Messaging.MessagingService
Messaging service with the raw methods to configure and connect a notification broker by Sock.js using the STOMP and AMQP protocols.
.registry : CarbonLDP.DocumentsRegistry
Registry that can only stores CarbonLDP.Document
's.
.repository : CarbonLDP.DocumentsRepository
Repository to fetch the CarbonLDP.Document
's data.
Methods
#__mergePaths() : CarbonLDP.Paths | undefined
__mergePaths( target?:Paths, source?:Paths ):Paths | undefined
Param | Type | Default | Description |
---|---|---|---|
target | Paths | ||
source | Paths |
._extendPaths() : void
_extendPaths( paths:Paths ):void
Param | Type | Default | Description |
---|---|---|---|
paths | Paths |
._extendsSettings() : void
_extendsSettings( settings:DocumentsContextSettings ):void
Param | Type | Default | Description |
---|---|---|---|
settings | DocumentsContextSettings |
._resolvePath() : string
_resolvePath( path:string ):string
Resolves the path provided into an URL using the path
settings of the context. If such path does hasn't been declared an CarbonLDP.Errors.IllegalStateError
will be thrown.
Example: The path system.platform
with the default setting:
{
paths: {
system: {
slug: ".system/",
paths: { platform: "platform/" }
}
}
}
This should resolve to something like https://example.com/.system/platform/
.
Param | Type | Default | Description |
---|---|---|---|
path | string | The dot notation string that refers the path declared in the settings of the context. |
CarbonLDP.DocumentsContextSettings Interface
Settings of a CarbonLDP.DocumentsContext
.
Properties
.paths : CarbonLDP.Paths
The configurable paths of the documents context.
CarbonLDP.GlobalContext Class
Shared context used by every CarbonLDP
context as its parent.
This context contains the shared schemas of the Platform and all the references to external resources.
Constructor
GlobalContext()
Properties
#instance : CarbonLDP.GlobalContext
Singleton instance of the CarbonLDP.GlobalContext
. This exact instance is used as parent by every CarbonLDP
instance.
._baseURI : ""
.registry : CarbonLDP.GeneralRegistry<CarbonLDP.RegisteredPointer>
Registry that stores the external resources of any CarbonLDP
instance.
.repository : undefined
Undefined repository since external resources cannot be fetched.
Methods
.__registerDefaultDecorators() : void
__registerDefaultDecorators():void
.__registerDefaultObjectSchemas() : void
__registerDefaultObjectSchemas():void
CarbonLDP.Paths Interface
Describe a set of paths by a key and its respective URI slug or a CarbonLDP.DocumentPaths
where one can add sub-paths of the desired document.
Properties
.[ document: string ] : string | CarbonLDP.DocumentPaths | null
carbonldp/Document Module
Interfaces
CarbonLDP.Document
. c:Document
. c:Document
. Type Aliases
CarbonLDP.Document
objects. CarbonLDP.TransientDocument
objects. Reexports
Properties
#Document : CarbonLDP.DocumentFactory
Constant that implements CarbonLDP.DocumentFactory
.
#TransientDocument : CarbonLDP.TransientDocumentFactory
Constant that implements CarbonLDP.TransientDocumentFactory
.
CarbonLDP.BaseDocument Interface
Base configurable properties of a CarbonLDP.Document
.
Properties
.defaultInteractionModel : string | CarbonLDP.Pointer
Default interaction model the document will have when no Prefer
interaction header is set in a request.
.hasMemberRelation : string | CarbonLDP.Pointer
Member relation the document will have.
.insertedContentRelation : string | CarbonLDP.Pointer
Inserted relation the document will have.
.isMemberOfRelation : string | CarbonLDP.Pointer
Optional inverted relation the document will have.
CarbonLDP.Document Interface
Model that represents a c:Document
.
Properties
.$__modelDecorator : CarbonLDP.Model.ModelDecorator<CarbonLDP.Fragment>
.$__resourcesMap : Map<string, CarbonLDP.Fragment>
.$__savedFragments : CarbonLDP.Fragment[]
Array with the fragments that has been persisted.
.$registry : CarbonLDP.DocumentsRegistry
Registry where the document exists.
.$repository : CarbonLDP.DocumentsRepository
Repository where the document can manage its data.
.accessPoints : CarbonLDP.AccessPoint[]
Set with the access points of the document.
.contains : CarbonLDP.Document[]
Set with the children of the document.
.created : Date
Datetime when the document was persisted.
.modified : Date
Last datetime when the document was modified.
Methods
.$_syncSavedFragments() : void
$_syncSavedFragments():void
Makes all the current fragments in the document as fragments that has been persisted in the served.
.$createFragment() : T & CarbonLDP.Fragment
$createFragment<T extends object>( object:T, id?:string ):T & Fragment
Param | Type | Default | Description |
---|---|---|---|
object | T | ||
id | string |
$createFragment( slug?:string ):Fragment
Param | Type | Default | Description |
---|---|---|---|
slug | string |
.$delete() : Promise<void>
$delete( requestOptions?:RequestOptions ):Promise<void>
Deletes the current document.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | Customizable options for the request. |
$delete( uri:string, requestOptions?:RequestOptions ):Promise<void>
Deletes the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to be deleted. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$exists() : Promise<boolean>
$exists( requestOptions?:RequestOptions ):Promise<boolean>
Checks if the current document exists.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | Customizable options for the request. |
$exists( uri:string, requestOptions?:RequestOptions ):Promise<boolean>
Checks if the document of the specified URI exists.
Param | Type | Default | Description |
---|---|---|---|
uri | string | The URI of the document to check its existence. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$get() : Promise<T & CarbonLDP.Document>
$get<T extends object>( queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$get<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
requestOptions | GETOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$get<T extends object>( uri:string, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$get<T extends object>( uri:string, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
requestOptions | GETOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$get<T extends object>( uris:string[], queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>
Param | Type | Default | Description |
---|---|---|---|
uris | string[] | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$get<T extends object>( uris:string[], requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>
Param | Type | Default | Description |
---|---|---|---|
uris | string[] | ||
requestOptions | GETOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
.$getFragment() : (T & CarbonLDP.Fragment) | null
$getFragment<T extends object>( id:string ):(T & Fragment) | null
Param | Type | Default | Description |
---|---|---|---|
id | string |
.$getFragments() : CarbonLDP.Fragment[]
$getFragments():Fragment[]
.$getPointer() : CarbonLDP.RegisteredPointer
$getPointer( id:string ):RegisteredPointer
Param | Type | Default | Description |
---|---|---|---|
id | string |
$getPointer( id:string, local:true ):Fragment
Param | Type | Default | Description |
---|---|---|---|
id | string | ||
local | true |
.$getPointers() : CarbonLDP.RegisteredPointer[]
$getPointers():RegisteredPointer[]
$getPointers( local:true ):Fragment[]
Param | Type | Default | Description |
---|---|---|---|
local | true |
.$refresh() : Promise<T & this>
$refresh<T extends object>( requestOptions?:RequestOptions ):Promise<T & this>
Refreshes with the latest data of the current document. If the document was retrieved partially, only the partial properties will be refreshed.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | Customizable options for the request. |
$refresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Refreshes with the latest data of the specified document. If the document was retrieved partially, only the partial properties will be refreshed.
Param | Type | Default | Description |
---|---|---|---|
document | Document | The document to be refreshed. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$removeFragment() : boolean
$removeFragment( slugOrFragment:string | Fragment ):boolean
Param | Type | Default | Description |
---|---|---|---|
slugOrFragment | string | Fragment |
.$resolve() : Promise<T & this & CarbonLDP.Document>
$resolve<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>
Param | Type | Default | Description |
---|---|---|---|
requestOptions | GETOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$resolve<T extends object>( queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>
Param | Type | Default | Description |
---|---|---|---|
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$resolve<T extends object>( document:Document, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$resolve<T extends object>( document:Document, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
requestOptions | GETOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
.$save() : Promise<T & this>
$save<T extends object>( requestOptions?:RequestOptions ):Promise<T & this>
Saves the changes of the current document.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | Customizable options for the request. |
$save<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Saves the changes of the specified document.
Param | Type | Default | Description |
---|---|---|---|
document | Document | The document to be saved. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$saveAndRefresh() : Promise<T & this>
$saveAndRefresh<T extends object>( requestOptions?:RequestOptions ):Promise<T & this>
Saves the changes of the current document and retrieves its latest changes. If the document was retrieved partially, only the partial properties will be refreshed.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | Customizable options for the request. |
$saveAndRefresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Saves the changes of the specified document and retrieves its latest changes. If the document was retrieved partially, only the partial properties will be refreshed.
Param | Type | Default | Description |
---|---|---|---|
document | Document | The resource to saved and refreshed. | |
requestOptions | RequestOptions | Customizable options for the request. |
CarbonLDP.DocumentFactory Type Alias
Factory, decorator and utils for CarbonLDP.Document
objects.
type DocumentFactory = ModelSchema<C["Document"]> & ModelPrototype<Document, SPARQLDocumentTrait & EventEmitterDocumentTrait & QueryableDocumentTrait, OverriddenMembers> & ModelDecorator<Document, BaseResolvableDocument> & ModelTypeGuard<Document> & ModelFactory<TransientDocument, BaseDocument>
CarbonLDP.TransientDocument Interface
In-memory model that represents a c:Document
.
Properties
.$registry : CarbonLDP.DocumentsRegistry | undefined
Registry where the resource will exits.
.defaultInteractionModel : CarbonLDP.Pointer
.hasMemberRelation : CarbonLDP.Pointer
.insertedContentRelation : CarbonLDP.Pointer
.isMemberOfRelation : CarbonLDP.Pointer
Methods
.$_getLocalID() : string
$_getLocalID( id:string ):string
Param | Type | Default | Description |
---|---|---|---|
id | string |
.$_normalize() : void
$_normalize():void
Search over the document for normal object and converted them into fragments. If unused fragments with BNode label as ID are detected, they will be removed from the document.
.$createFragment() : T & CarbonLDP.TransientFragment
$createFragment<T extends object>( object:T, id?:string ):T & TransientFragment
Creates a CarbonLDP.TransientFragment
from the object and ID specified.
Param | Type | Default | Description |
---|---|---|---|
object | T | The object to be converted into a fragment. | |
id | string | Optional ID to be set for the fragment, if no provided a random BNode label will be assigned. |
$createFragment( id?:string ):TransientFragment
Creates a CarbonLDP.TransientFragment
with the ID specified.
Param | Type | Default | Description |
---|---|---|---|
id | string | Optional ID to be set for the fragment, if no provided a random BNode label will be assigned. |
.$getFragment() : (T & CarbonLDP.TransientFragment) | null
$getFragment<T extends object>( id:string ):(T & TransientFragment) | null
Returns the fragment with the ID specified. If no fragment exists, null
will be returned.
Param | Type | Default | Description |
---|---|---|---|
id | string | The ID of the fragment to look for. |
.$getFragments() : CarbonLDP.TransientFragment[]
$getFragments():TransientFragment[]
Returns an array with all the fragments in the document.
.$hasFragment() : boolean
$hasFragment( id:string ):boolean
Returns true if the document has a fragment with the ID specified.
Param | Type | Default | Description |
---|---|---|---|
id | string | The ID of the fragment to check if exists. |
.$removeFragment() : boolean
$removeFragment( idOrFragment:string | TransientFragment ):boolean
Removes the fragment provided from the document. If a string is provided, it will be used as the ID of the fragment to be removed.
Param | Type | Default | Description |
---|---|---|---|
idOrFragment | string | TransientFragment |
.toJSON() : CarbonLDP.RDF.RDFDocument
toJSON( contextOrKey?:string | Context<RegisteredPointer, ResolvablePointer> ):RDFDocument
Returns the JSON-LD representation of the current document.
Param | Type | Default | Description |
---|---|---|---|
contextOrKey | string | Context<RegisteredPointer, ResolvablePointer> | A specific context to use for expand the data into JSON-LD instead of the internal one. |
CarbonLDP.TransientDocumentFactory Type Alias
Factory, decorator and utils for CarbonLDP.TransientDocument
objects.
type TransientDocumentFactory = ModelPrototype<TransientDocument, Resource & $Registry<TransientFragment>, OverriddenMembers> & ModelDecorator<TransientDocument, BaseDocument> & ModelFactoryOptional<TransientDocument, BaseDocument> & ModelTypeGuard<TransientDocument>
carbonldp/Document/Traits Module
Interfaces
CarbonLDP.Document
with methods for event subscriptions. CarbonLDP.Document
with methods for LDP related requests. CarbonLDP.Document
with methods for advanced reading requests. CarbonLDP.Document
with methods for SPARQL requests. Type Aliases
CarbonLDP.Document.Traits.EventEmitterDocumentTrait
. CarbonLDP.Document.Traits.LDPDocumentTrait
. CarbonLDP.Document.Traits.QueryableDocumentTrait
. CarbonLDP.Document.Traits.SPARQLDocumentTrait
. Properties
#EventEmitterDocumentTrait : CarbonLDP.Document.Traits.EventEmitterDocumentTraitFactory
Constant that implements CarbonLDP.Document.Traits.EventEmitterDocumentTraitFactory
#LDPDocumentTrait : CarbonLDP.Document.Traits.LDPDocumentTraitFactory
Constant that implements CarbonLDP.Document.Traits.LDPDocumentTraitFactory
.
#QueryableDocumentTrait : CarbonLDP.Document.Traits.QueryableDocumentTraitFactory
Constant that implements CarbonLDP.Document.Traits.QueryableDocumentTraitFactory
.
#SPARQLDocumentTrait : CarbonLDP.Document.Traits.SPARQLDocumentTraitFactory
Constant that implements CarbonLDP.Document.Traits.SPARQLDocumentTraitFactory
.
Trait of a CarbonLDP.Document
with methods for event subscriptions.
Properties
.$repository : CarbonLDP.DocumentsRepository.Traits.EventEmitterDocumentsRepositoryTrait
Repository trait that actually executes the request of the current trait.
Methods
.$off() : void
$off( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the child created event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.CHILD_CREATED | Child created event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that was used to subscribe to the child created event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:Event.CHILD_CREATED, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the child created event and onEvent callback for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.CHILD_CREATED | Child created event of the subscription to be removed. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that was used to subscribe to the child created event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the document modified event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_MODIFIED | Document modified event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that was used to subscribe to the document modified event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:Event.DOCUMENT_MODIFIED, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the document modified event and onEvent callback for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_MODIFIED | Document modified event of the subscription to be removed. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that was used to subscribe to the document modified event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the document deleted event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_DELETED | Document deleted event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that was used to subscribe to the document deleted event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:Event.DOCUMENT_DELETED, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the document deleted event and onEvent callback for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_DELETED | Document deleted event of the subscription to be removed. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that was used to subscribe to the document deleted event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the member added event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_ADDED | Member added event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: MemberAddedEvent) => void | Callback that was used to subscribe to the member added event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:Event.MEMBER_ADDED, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the member added event and onEvent callback for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_ADDED | Member added event of the subscription to be removed. | |
onEvent | (message: MemberAddedEvent) => void | Callback that was used to subscribe to the member added event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the member removed event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_REMOVED | Member removed event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that was used to subscribe to the member removed event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:Event.MEMBER_REMOVED, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the member removed event and onEvent callback for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_REMOVED | Member removed event of the subscription to be removed. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that was used to subscribe to the member removed event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void
Removes the subscription of the specified event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | string | Event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: EventMessage) => void | Callback that was used to subscribe to the specified event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
$off( event:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void
Removes the subscription of the specified event and onEvent callback for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | string | Event of the subscription to be removed. | |
onEvent | (message: EventMessage) => void | Callback that was used to subscribe to the specified event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
.$on() : void
$on( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the child created event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.CHILD_CREATED | Child created event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that will receive the child created event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:Event.CHILD_CREATED, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the child created event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.CHILD_CREATED | Child created event to subscribe for its notifications. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that will receive the child created event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document modified event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_MODIFIED | Document modified event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that will receive the document modified message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:Event.DOCUMENT_MODIFIED, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document modified event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_MODIFIED | Document modified event to subscribe for its notifications. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that will receive the document modified message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document deleted event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_DELETED | Document deleted event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that will receive the document deleted message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:Event.DOCUMENT_DELETED, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document deleted event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_DELETED | Document deleted event to subscribe for its notifications. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that will receive the document deleted message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member added event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_ADDED | Member added event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberAddedEvent) => void | Callback that will receive the member added message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:Event.MEMBER_ADDED, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member added event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_ADDED | Member added event to subscribe for its notifications. | |
onEvent | (message: MemberAddedEvent) => void | Callback that will receive the member added message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member removed event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_REMOVED | Member removed event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that will receive the member removed message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:Event.MEMBER_REMOVED, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member removed event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_REMOVED | Member removed event to subscribe for its notifications. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that will receive the member removed message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void
Subscribe to the specified event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | string | Event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: EventMessage) => void | Callback that will receive the notification message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$on( event:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void
Subscribe to the specified event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | string | Event to subscribe for its notifications. | |
onEvent | (message: EventMessage) => void | Callback that will receive the notification message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.$onChildCreated() : void
$onChildCreated( uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the child created event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that will receive the child created event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$onChildCreated( onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the child created event for the current document.
Param | Type | Default | Description |
---|---|---|---|
onEvent | (message: ChildCreatedEvent) => void | Callback that will receive the child created event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.$onDocumentDeleted() : void
$onDocumentDeleted( uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document deleted event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that will receive the document deleted event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$onDocumentDeleted( onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document deleted event for the current document.
Param | Type | Default | Description |
---|---|---|---|
onEvent | (message: DocumentDeletedEvent) => void | Callback that will receive the document deleted event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.$onDocumentModified() : void
$onDocumentModified( uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document modified event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that will receive the document modified event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$onDocumentModified( onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document modified event for the current document.
Param | Type | Default | Description |
---|---|---|---|
onEvent | (message: DocumentModifiedEvent) => void | Callback that will receive the child created event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.$onMemberAdded() : void
$onMemberAdded( uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member added event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberAddedEvent) => void | Callback that will receive the member added event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$onMemberAdded( onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member added event for the current document.
Param | Type | Default | Description |
---|---|---|---|
onEvent | (message: MemberAddedEvent) => void | Callback that will receive the member added event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.$onMemberRemoved() : void
$onMemberRemoved( uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member removed event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that will receive the member removed event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$onMemberRemoved( onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member removed event for the current document.
Param | Type | Default | Description |
---|---|---|---|
onEvent | (message: MemberRemovedEvent) => void | Callback that will receive the member removed event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.$one() : void
$one( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the child created event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.CHILD_CREATED | Child created event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that will receive the child created event message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:Event.CHILD_CREATED, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the child created event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.CHILD_CREATED | Child created event to subscribe for one notification. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that will receive the child created event message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the document modified event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_MODIFIED | Document modified event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that will receive the document modified message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:Event.DOCUMENT_MODIFIED, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the document modified event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_MODIFIED | Document modified event to subscribe for one notification. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that will receive the document modified message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the document deleted event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_DELETED | Document deleted event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that will receive the document deleted message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:Event.DOCUMENT_DELETED, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the document deleted event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_DELETED | Document deleted event to subscribe for one notification. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that will receive the document deleted message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the member added event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_ADDED | Member added event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberAddedEvent) => void | Callback that will receive the member added message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:Event.MEMBER_ADDED, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the member added event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_ADDED | Member added event to subscribe for one notification. | |
onEvent | (message: MemberAddedEvent) => void | Callback that will receive the member added message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the member removed event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_REMOVED | Member removed event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that will receive the member removed message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:Event.MEMBER_REMOVED, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the member removed event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_REMOVED | Member removed event to subscribe for one notification. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that will receive the member removed message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the specified event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | string | Event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: EventMessage) => void | Callback that will receive the notification message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
$one( event:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the specified event for the current document.
Param | Type | Default | Description |
---|---|---|---|
event | string | Event to subscribe for one notification. | |
onEvent | (message: EventMessage) => void | Callback that will receive the notification message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
Factory, decorator and utils for CarbonLDP.Document.Traits.EventEmitterDocumentTrait
.
type EventEmitterDocumentTraitFactory = ModelPrototype<EventEmitterDocumentTrait, TransientDocument & ResolvablePointer> & ModelDecorator<EventEmitterDocumentTrait, BaseEventEmitterDocumentTrait>
Trait of a CarbonLDP.Document
with methods for LDP related requests.
Properties
.$repository : CarbonLDP.DocumentsRepository.Traits.LDPDocumentsRepositoryTrait
Repository trait that actually executes the request of the current trait.
Methods
.$addMember() : Promise<void>
$addMember( member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>
Adds the provided resource as member of the current document.
Param | Type | Default | Description |
---|---|---|---|
member | string | Pointer | Resource to be added as member. | |
requestOptions | RequestOptions | Customizable options for the request. |
$addMember( uri:string, member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>
Adds the provided resource as member of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to add the member. | |
member | string | Pointer | Resource to be added as member. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$addMembers() : Promise<void>
$addMembers( members:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>
Adds the provided resources as members of the current document.
Param | Type | Default | Description |
---|---|---|---|
members | (string | Pointer)[] | Resources to be added as members. | |
requestOptions | RequestOptions | Customizable options for the request. |
$addMembers( uri:string, members:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>
Adds the provided resources as members of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to add the members. | |
members | (string | Pointer)[] | Resources to be added as members. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$create() : Promise<(T & CarbonLDP.Document)[]>
$create<T extends object>( children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the current document.
Param | Type | Default | Description |
---|---|---|---|
children | T[] | Objects to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
$create<T extends object>( children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the current document.
Param | Type | Default | Description |
---|---|---|---|
children | T[] | Objects to be persisted. | |
slugs | string[] | Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided. | |
requestOptions | RequestOptions | Customizable options for the request. |
$create<T extends object>( child:T, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the current document.
Param | Type | Default | Description |
---|---|---|---|
child | T | Object to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
$create<T extends object>( child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the current document.
Param | Type | Default | Description |
---|---|---|---|
child | T | Object to be persisted. | |
slug | string | Suggested slug for the child URI. | |
requestOptions | RequestOptions | Customizable options for the request. |
$create<T extends object>( uri:string, children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the children. | |
children | T[] | Objects to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
$create<T extends object>( uri:string, children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the children. | |
children | T[] | Objects to be persisted. | |
slugs | string[] | Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided. | |
requestOptions | RequestOptions | Customizable options for the request. |
$create<T extends object>( uri:string, child:T, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the child. | |
child | T | Object to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
$create<T extends object>( uri:string, child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the child. | |
child | T | Object to be persisted. | |
slug | string | Suggested slug for the child URI. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$createAndRetrieve() : Promise<(T & CarbonLDP.Document)[]>
$createAndRetrieve<T extends object>( children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the current document and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
children | T[] | Objects to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
$createAndRetrieve<T extends object>( children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the current document and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
children | T[] | Objects to be persisted. | |
slugs | string[] | Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided. | |
requestOptions | RequestOptions | Customizable options for the request. |
$createAndRetrieve<T extends object>( child:T, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the current document and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
child | T | Object to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
$createAndRetrieve<T extends object>( child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the current document and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
child | T | Object to be persisted. | |
slug | string | Suggested slug for the child URI. | |
requestOptions | RequestOptions | Customizable options for the request. |
$createAndRetrieve<T extends object>( uri:string, children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the document of the specified URI and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the children. | |
children | T[] | Objects to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
$createAndRetrieve<T extends object>( uri:string, children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the document of the specified URI and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the children. | |
children | T[] | Objects to be persisted. | |
slugs | string[] | Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided. | |
requestOptions | RequestOptions | Customizable options for the request. |
$createAndRetrieve<T extends object>( uri:string, child:T, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the document of the specified URI and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the child. | |
child | T | Object to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
$createAndRetrieve<T extends object>( uri:string, child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the document of the specified URI and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the child. | |
child | T | Object to be persisted. | |
slug | string | Suggested slug for the child URI. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$removeMember() : Promise<void>
$removeMember( member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>
Removes the provided resource as member of the current document.
Param | Type | Default | Description |
---|---|---|---|
member | string | Pointer | Resource to be removed as member. | |
requestOptions | RequestOptions | Customizable options for the request. |
$removeMember( uri:string, member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>
Removes the provided resource as member of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to remove the member. | |
member | string | Pointer | Resource to be removed as member. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$removeMembers() : Promise<void>
$removeMembers( members?:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>
Removes the provided resources as members of the current document. IF no members is provided all the members of the current document will be removed.
Param | Type | Default | Description |
---|---|---|---|
members | (string | Pointer)[] | Resources to be removed as members. | |
requestOptions | RequestOptions | Customizable options for the request. |
$removeMembers( requestOptions?:RequestOptions ):Promise<void>
Removes all the members of the current document.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | Customizable options for the request. |
$removeMembers( uri:string, members?:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>
Removes the provided resources as members of the document of the specified URI. IF no members is provided all the members of the specified document will be removed.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to remove the members. | |
members | (string | Pointer)[] | Resources to be removed as members. | |
requestOptions | RequestOptions | Customizable options for the request. |
$removeMembers( uri:string, requestOptions?:RequestOptions ):Promise<void>
Removes all the members of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to remove its members. | |
requestOptions | RequestOptions | Customizable options for the request. |
Factory, decorator and utils for CarbonLDP.Document.Traits.LDPDocumentTrait
.
type LDPDocumentTraitFactory = ModelPrototype<LDPDocumentTrait, TransientDocument & ResolvablePointer> & ModelDecorator<LDPDocumentTrait, BaseLDPDocumentTrait>
Trait of a CarbonLDP.Document
with methods for advanced reading requests.
Properties
.$repository : CarbonLDP.DocumentsRepository.Traits.QueryableDocumentsRepositoryTrait
Repository trait that actually executes the request of the current trait.
Methods
.$get() : Promise<T & CarbonLDP.Document>
$get<T extends object>( queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Retrieves the specific properties of the current document set by the query function.
Param | Type | Default | Description |
---|---|---|---|
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be retrieved. |
$get<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Retrieves the entire current document or only the properties set by the query function when provided.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | GETOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be retrieved. |
$get<T extends object>( uri:string, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Retrieves the properties of the document of the URI specified set by the query function.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to be retrieved. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be retrieved. |
$get<T extends object>( uri:string, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Retrieves the entire document of the URI specified or only the properties set by the query function when provided.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to be retrieved. | |
requestOptions | GETOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be retrieved. |
$get<T extends object>( uris:string[], queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>
Retrieves the properties set by the query function, of the documents specified.
Param | Type | Default | Description |
---|---|---|---|
uris | string[] | URIs of the documents to be retrieved. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the documents to be retrieved. |
$get<T extends object>( uris:string[], requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>
Retrieves the entire documents of the URIs specified or only the properties set by the query function when provided.
Param | Type | Default | Description |
---|---|---|---|
uris | string[] | URIs of the documents to be retrieved. | |
requestOptions | GETOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the documents to be retrieved. |
.$getChildren() : Promise<(T & CarbonLDP.Document)[]>
$getChildren<T extends object>( requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieves the entire children of the current document or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the children to be retrieved. |
$getChildren<T extends object>( queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieves the entry children of the current document or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the children to be retrieved. |
$getChildren<T extends object>( uri:string, requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieves the entire children of the document of the specified URI or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its children. | |
requestOptions | RequestOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the children to be retrieved. |
$getChildren<T extends object>( uri:string, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieved the entire children of the document of the specified URI or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its children. | |
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the children to be retrieved. |
.$getMembers() : Promise<(T & CarbonLDP.Document)[]>
$getMembers<T extends object>( requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieves the entire members of the current document or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the members to be retrieved. |
$getMembers<T extends object>( queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieves the entry members of the current document or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the members to be retrieved. |
$getMembers<T extends object>( uri:string, requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieves the entire members of the document of the specified URI or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its members. | |
requestOptions | RequestOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the members to be retrieved. |
$getMembers<T extends object>( uri:string, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieved the entire members of the document of the specified URI or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its members. | |
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the members to be retrieved. |
.$listChildren() : Promise<(T & CarbonLDP.Document)[]>
$listChildren<T extends object>( requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Retrieves the shallow children of the current document.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | Customizable options for the request. |
$listChildren<T extends object>( uri:string, requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Retrieves the shallow children of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its shallow children. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$listMembers() : Promise<(T & CarbonLDP.Document)[]>
$listMembers<T extends object>( requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Retrieves the shallow members of the current document.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | Customizable options for the request. |
$listMembers<T extends object>( uri:string, requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Retrieves the shallow members of the document of the specified URI
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its shallow members. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$resolve() : Promise<T & this & CarbonLDP.Document>
$resolve<T extends object>( queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>
Resolves the specific properties of the current document set by the query function.
Param | Type | Default | Description |
---|---|---|---|
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be resolved. |
$resolve<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>
Resolves the entire current document or only the properties set by the query function when provided.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | GETOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be resolved. |
$resolve<T extends object>( document:Document, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Resolves the properties of the document of the URI specified set by the query function.
Param | Type | Default | Description |
---|---|---|---|
document | Document | Document to be resolved. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be resolved. |
$resolve<T extends object>( document:Document, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Resolves the entire document of the URI specified or only the properties set by the query function when provided.
Param | Type | Default | Description |
---|---|---|---|
document | Document | Document to be resolved. | |
requestOptions | GETOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be resolved. |
Factory, decorator and utils for CarbonLDP.Document.Traits.QueryableDocumentTrait
.
type QueryableDocumentTraitFactory = ModelPrototype<QueryableDocumentTrait, LDPDocumentTrait & QueryablePointer, "$get"> & ModelDecorator<QueryableDocumentTrait, BaseQueryableDocumentTrait>
Trait of a CarbonLDP.Document
with methods for SPARQL requests.
Properties
.$repository : CarbonLDP.DocumentsRepository.Traits.SPARQLDocumentsRepositoryTrait
Repository trait that actually executes the request of the current trait.
Methods
.$executeASKQuery() : Promise<boolean>
$executeASKQuery( uri:string, askQuery:string, requestOptions?:RequestOptions ):Promise<boolean>
Executes an ASK query on the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to execute the query. | |
askQuery | string | ASK query to be executed. | |
requestOptions | RequestOptions | Customizable options for the request. |
$executeASKQuery( askQuery:string, requestOptions?:RequestOptions ):Promise<boolean>
Execute an ASK query on the current document.
Param | Type | Default | Description |
---|---|---|---|
askQuery | string | ASK query to be executed. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$executeSELECTQuery() : Promise<CarbonLDP.SPARQL.SPARQLSelectResults<T>>
$executeSELECTQuery<T extends object>( uri:string, selectQuery:string, requestOptions?:RequestOptions ):Promise<SPARQLSelectResults<T>>
Executes a SELECT query on the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to execute the query. | |
selectQuery | string | SELECT query to be executed. | |
requestOptions | RequestOptions | Customizable options for the request. |
$executeSELECTQuery<T extends object>( selectQuery:string, requestOptions?:RequestOptions ):Promise<SPARQLSelectResults<T>>
Executes a SELECT query in the current document.
Param | Type | Default | Description |
---|---|---|---|
selectQuery | string | SELECT query to be executed. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$executeUPDATE() : Promise<void>
$executeUPDATE( uri:string, update:string, requestOptions?:RequestOptions ):Promise<void>
Executes an UPDATE in the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to execute the update. | |
update | string | UPDATE to be executed. | |
requestOptions | RequestOptions | Customizable options for the request. |
$executeUPDATE( update:string, requestOptions?:RequestOptions ):Promise<void>
Executes an UPDATE in the current document.
Param | Type | Default | Description |
---|---|---|---|
update | string | UPDATE to be executed. | |
requestOptions | RequestOptions | Customizable options for the request. |
.$sparql() : QueryClause<CarbonLDP.SPARQL.FinishSPARQLSelect, CarbonLDP.SPARQL.FinishSPARQLAsk>
$sparql( uri?:string ):QueryClause<FinishSPARQLSelect, FinishSPARQLAsk>
Creates an instance of SPARQLER builder for the current document or the one specified by the URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document from where to create the query builder. |
Factory, decorator and utils for CarbonLDP.Document.Traits.SPARQLDocumentTrait
.
type SPARQLDocumentTraitFactory = ModelPrototype<SPARQLDocumentTrait, TransientDocument & ResolvablePointer> & ModelDecorator<SPARQLDocumentTrait, BaseSPARQLDocumentTrait>
carbonldp/DocumentsRegistry Module
Interfaces
CarbonLDP.DocumentsRegistry
. CarbonLDP.Document
's. Type Aliases
CarbonLDP.DocumentsRegistry
. Properties
#DocumentsRegistry : CarbonLDP.DocumentsRegistryFactory
Constant that implements CarbonLDP.DocumentsRegistryFactory
.
CarbonLDP.BaseDocumentsRegistry Interface
Properties for creating a CarbonLDP.DocumentsRegistry
.
Properties
.context : CarbonLDP.DocumentsContext
Context from where the registry is been created.
CarbonLDP.DocumentsRegistry Interface
Registry that manages CarbonLDP.Document
's.
Properties
.context : CarbonLDP.DocumentsContext
Context where the registry belongs to.
Methods
.register() : CarbonLDP.Document
register( id:string ):Document
Register a document endpoint that already exists in the platform.
Param | Type | Default | Description |
---|---|---|---|
id | string | The URI of the document to be registered. |
CarbonLDP.DocumentsRegistryFactory Type Alias
Factory, decorator and utils for CarbonLDP.DocumentsRegistry
.
type DocumentsRegistryFactory = ModelPrototype<DocumentsRegistry, GeneralRegistry<Document>, "_getLocalID"> & ModelDecorator<DocumentsRegistry, BaseDocumentsRegistry> & ModelFactory<DocumentsRegistry, BaseDocumentsRegistry>
Interfaces
CarbonLDP.DocumentsRepository
. CarbonLDP.Document
's. Type Aliases
CarbonLDP.DocumentsRepository
. Reexports
Properties
#DocumentsRepository : CarbonLDP.DocumentsRepositoryFactory
Constant that implements CarbonLDP.DocumentsRepositoryFactory
.
Methods
#_getErrorResponseParserFn() : (error: CarbonLDP.HTTP.Errors.HTTPError | Error) => Promise<never>
_getErrorResponseParserFn( registry:DocumentsRegistry ):(error: HTTPError | Error) => Promise<never>
Returns a function that can parse a CarbonLDP.HTTP.Errors.HTTPError
into a CarbonLDP.LDP.ErrorResponse
inside a rejected Promise.
Param | Type | Default | Description |
---|---|---|---|
registry | DocumentsRegistry | The registry from where to get the information to convert the |
#_parseResourceParams() : { _resource: CarbonLDP.ResolvablePointer; _args: any[]; }
_parseResourceParams<T>( resource:ResolvablePointer, $resource?:ResolvablePointer | T, args?:IArguments ):{
_resource: ResolvablePointer;
_args: any[];
}
Parse the arguments of a relative repository method detecting if has a valid resource if not, the resource will be the one provided by the param resource.
Param | Type | Default | Description |
---|---|---|---|
resource | ResolvablePointer | The resource from where is executing the repository method. | |
$resource | ResolvablePointer | T | The possible target resource to be selected or another argument. | |
args | IArguments | All the arguments of the repository method that is been executed. |
#_parseURIParams() : { _uri: string; _args: any[]; }
_parseURIParams<T>( resource:ResolvablePointer, uri?:string | T, args?:IArguments ):{
_uri: string;
_args: any[];
}
Parse the arguments of a relative repository method detecting if has a valid URI if not, the URI will be taken from the resource provided.
Param | Type | Default | Description |
---|---|---|---|
resource | ResolvablePointer | The resource from where is executing the repository method. | |
uri | string | T | The possible URI to be selected or another argument. | |
args | IArguments | All the arguments of the repository method that is been executed. |
CarbonLDP.BaseDocumentsRepository Interface
Properties for creating a CarbonLDP.DocumentsRepository
.
Properties
.context : CarbonLDP.DocumentsContext
Context from where the repository will be created.
CarbonLDP.DocumentsRepository Interface
Repository for request related to CarbonLDP.Document
's.
Properties
.context : CarbonLDP.DocumentsContext
Context where the repository belongs to.
Methods
.delete() : Promise<void>
delete( uri:string, requestOptions?:RequestOptions ):Promise<void>
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
requestOptions | RequestOptions |
.exists() : Promise<boolean>
exists( uri:string, requestOptions?:RequestOptions ):Promise<boolean>
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
requestOptions | RequestOptions |
.get() : Promise<T & CarbonLDP.Document>
get<T extends object>( uri:string, requestOptions?:GETOptions ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
requestOptions | GETOptions |
get<T extends object>( uri:string, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
get<T extends object>( uri:string, requestOptions:RequestOptions, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
requestOptions | RequestOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
get<T extends object>( uris:string[], queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>
Param | Type | Default | Description |
---|---|---|---|
uris | string[] | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
get<T extends object>( uris:string[], requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>
Param | Type | Default | Description |
---|---|---|---|
uris | string[] | ||
requestOptions | GETOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
.refresh() : Promise<T & CarbonLDP.Document>
refresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
requestOptions | RequestOptions |
.resolve() : Promise<T & CarbonLDP.Document>
resolve<T extends object>( document:Document, requestOptions?:GETOptions ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
requestOptions | GETOptions |
resolve<T extends object>( document:Document, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
resolve<T extends object>( document:Document, requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
requestOptions | RequestOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
.save() : Promise<T & CarbonLDP.Document>
save<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
requestOptions | RequestOptions |
.saveAndRefresh() : Promise<T & CarbonLDP.Document>
saveAndRefresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
requestOptions | RequestOptions |
CarbonLDP.DocumentsRepositoryFactory Type Alias
Factory, decorator and utils for CarbonLDP.DocumentsRepository
.
type DocumentsRepositoryFactory = ModelFactory<DocumentsRepository, BaseDocumentsRepository> & ModelTypeGuard<DocumentsRepository>
Interfaces
CarbonLDP.DocumentsRepository
with methods for event subscriptions. CarbonLDP.DocumentsRepository
with base methods of every REST repository. CarbonLDP.DocumentsRepository
with methods for LDP related requests. CarbonLDP.DocumentsRepository
with methods for advanced reading requests. CarbonLDP.DocumentsRepository
with methods for SPARQL requests. Type Aliases
CarbonLDP.DocumentsRepository.Traits.HTTPRepositoryTrait
. CarbonLDP.DocumentsRepository.Traits.LDPDocumentsRepositoryTrait
. Properties
#EventEmitterDocumentsRepositoryTrait : CarbonLDP.DocumentsRepository.Traits.EventEmitterDocumentsRepositoryTraitFactory
Constant that implements CarbonLDP.DocumentsRepository.Traits.EventEmitterDocumentsRepositoryTraitFactory
.
#HTTPRepositoryTrait : CarbonLDP.DocumentsRepository.Traits.HTTPRepositoryTraitFactory
Constant that implements CarbonLDP.DocumentsRepository.Traits.HTTPRepositoryTraitFactory
-
#LDPDocumentsRepositoryTrait : CarbonLDP.DocumentsRepository.Traits.LDPDocumentsRepositoryTraitFactory
Constant that implements CarbonLDP.DocumentsRepository.Traits.LDPDocumentsRepositoryTraitFactory
.
#QueryableDocumentsRepositoryTrait : CarbonLDP.DocumentsRepository.Traits.QueryableDocumentsRepositoryTraitFactory
Constant that implements CarbonLDP.DocumentsRepository.Traits.QueryableDocumentsRepositoryTraitFactory
.
#SPARQLDocumentsRepositoryTrait : CarbonLDP.DocumentsRepository.Traits.SPARQLDocumentsRepositoryTraitFactory
Constant that implements CarbonLDP.DocumentsRepository.Traits.SPARQLDocumentsRepositoryTraitFactory
.
Trait of a CarbonLDP.DocumentsRepository
with methods for event subscriptions.
Properties
.context : CarbonLDP.DocumentsContext
Context from where the repository is created.
Methods
.off() : void
off( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the child created event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.CHILD_CREATED | Child created event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that was used to subscribe to the child created event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
off( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the document modified event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_MODIFIED | Document modified event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that was used to subscribe to the document modified event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
off( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the document deleted event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_DELETED | Document deleted event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that was used to subscribe to the document deleted event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
off( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the member added event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_ADDED | Member added event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: MemberAddedEvent) => void | Callback that was used to subscribe to the member added event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
off( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Removes the subscription of the member removed event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_REMOVED | Member removed event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that was used to subscribe to the member removed event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
off( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void
Removes the subscription of the specified event and onEvent callback for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | string | Event of the subscription to be removed. | |
uriPattern | string | URI or pattern of the resources to unsubscribe for. | |
onEvent | (message: EventMessage) => void | Callback that was used to subscribe to the specified event. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription removal. |
.on() : void
on( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the child created event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.CHILD_CREATED | Child created event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that will receive the child created event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
on( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document modified event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_MODIFIED | Document modified event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that will receive the document modified message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
on( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document deleted event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_DELETED | Document deleted event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that will receive the document deleted message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
on( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member added event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_ADDED | Member added event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberAddedEvent) => void | Callback that will receive the member added message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
on( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member removed event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_REMOVED | Member removed event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that will receive the member removed message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
on( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void
Subscribe to the specified event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | string | Event to subscribe for its notifications. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: EventMessage) => void | Callback that will receive the notification message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.onChildCreated() : void
onChildCreated( uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the child created event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that will receive the child created event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.onDocumentDeleted() : void
onDocumentDeleted( uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document deleted event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that will receive the document deleted event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.onDocumentModified() : void
onDocumentModified( uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the document modified event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that will receive the document modified event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.onMemberAdded() : void
onMemberAdded( uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member added event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberAddedEvent) => void | Callback that will receive the member added event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.onMemberRemoved() : void
onMemberRemoved( uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to the member removed event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that will receive the member removed event message when an event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
.one() : void
one( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the child created event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.CHILD_CREATED | Child created event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: ChildCreatedEvent) => void | Callback that will receive the child created event message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
one( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the document modified event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_MODIFIED | Document modified event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentModifiedEvent) => void | Callback that will receive the document modified message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
one( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the document deleted event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.DOCUMENT_DELETED | Document deleted event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: DocumentDeletedEvent) => void | Callback that will receive the document deleted message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
one( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the member added event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_ADDED | Member added event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberAddedEvent) => void | Callback that will receive the member added message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
one( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the member removed event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | Event.MEMBER_REMOVED | Member removed event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: MemberRemovedEvent) => void | Callback that will receive the member removed message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
one( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void
Subscribe to only one notification of the specified event for the desired URI pattern.
Param | Type | Default | Description |
---|---|---|---|
event | string | Event to subscribe for one notification. | |
uriPattern | string | URI or pattern of the resources to subscribe for. | |
onEvent | (message: EventMessage) => void | Callback that will receive the notification message when the event occurs. | |
onError | (error: Error) => void | Callback that will receive any error in the subscription. |
Factory, decorator and utils for CarbonLDP.DocumentsRepository.Traits.EventEmitterDocumentsRepositoryTrait
.
type EventEmitterDocumentsRepositoryTraitFactory = ModelPrototype<EventEmitterDocumentsRepositoryTrait, GeneralRepository<Document>> & ModelDecorator<EventEmitterDocumentsRepositoryTrait, BaseDocumentsRepository>
Trait of a CarbonLDP.DocumentsRepository
with base methods of every REST repository.
Properties
.context : CarbonLDP.Context<MODEL & CarbonLDP.RegisteredPointer, MODEL>
Context from where the repository is created.
Methods
._parseResponseData() : Promise<T & MODEL>
_parseResponseData<T extends object>( response:Response, id:string ):Promise<T & MODEL>
Method that parses the CarbonLDP.HTTP.Response
of a retrieval request into the desired resource model. This method must be overridden in the specialized repositories in accordance of its model since, the current behaviour only creates a shallow pointer in the associated CarbonLDP.Registry
.
Param | Type | Default | Description |
---|---|---|---|
response | Response | The response to be parsed into a resource model. | |
id | string | The identification of the resource, commonly the URL of the resource. |
.delete() : Promise<void>
delete( uri:string, requestOptions?:RequestOptions ):Promise<void>
Deletes the resource of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the resource to be deleted. | |
requestOptions | RequestOptions | Customizable options for the request. |
.exists() : Promise<boolean>
exists( uri:string, requestOptions?:RequestOptions ):Promise<boolean>
Checks if the resource of the specified URI exists.
Param | Type | Default | Description |
---|---|---|---|
uri | string | The URI of the resource to check its existence. | |
requestOptions | RequestOptions | Customizable options for the request. |
.get() : Promise<T & MODEL>
get<T extends object>( uri:string, requestOptions?:GETOptions ):Promise<T & MODEL>
Retrieves the resource of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | The URI of the resource to be retrieved. | |
requestOptions | GETOptions | Customizable options for the request. |
.refresh() : Promise<T & MODEL>
refresh<T extends object>( resource:MODEL, requestOptions?:RequestOptions ):Promise<T & MODEL>
Refreshes with the latest data of the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | The resource to be refreshed. | |
requestOptions | RequestOptions | Customizable options for the request. |
.resolve() : Promise<T & MODEL>
resolve<T extends object>( resource:MODEL, requestOptions?:RequestOptions ):Promise<T & MODEL>
Resolves the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | The resource to be resolved. | |
requestOptions | RequestOptions | Customizable options for the request. |
.save() : Promise<T & MODEL>
save<T extends object>( resource:MODEL, requestOptions?:RequestOptions ):Promise<T & MODEL>
Saves the changes of the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | The resource to be saved. | |
requestOptions | RequestOptions | Customizable options for the request. |
.saveAndRefresh() : Promise<T & MODEL>
saveAndRefresh<T extends object>( resource:MODEL, requestOptions?:RequestOptions ):Promise<T & MODEL>
Saves the changes of the specified resource and retrieves its latest changes.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | The resource to saved and refreshed. | |
requestOptions | RequestOptions | Customizable options for the request. |
Factory, decorator and utils for CarbonLDP.DocumentsRepository.Traits.HTTPRepositoryTrait
.
type HTTPRepositoryTraitFactory = ModelPrototype<HTTPRepositoryTrait, GeneralRepository, OverriddenMembers> & ModelDecorator<HTTPRepositoryTrait<any>, BaseGeneralRepository>
Trait of a CarbonLDP.DocumentsRepository
with methods for LDP related requests.
Properties
.context : CarbonLDP.DocumentsContext
Context from where the repository is created.
Methods
._parseResponseData() : Promise<T & CarbonLDP.Document>
_parseResponseData<T extends object>( response:Response, id:string ):Promise<T & Document>
Override method to parse the data that is a JSON-LD Document into the CarbonLDP.Document
model.
Param | Type | Default | Description |
---|---|---|---|
response | Response | ||
id | string |
.addMember() : Promise<void>
addMember( uri:string, member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>
Adds the provided resource as member of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to add the member. | |
member | string | Pointer | Resource to be added as member. | |
requestOptions | RequestOptions | Customizable options for the request. |
.addMembers() : Promise<void>
addMembers( uri:string, members:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>
Adds the provided resources as members of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to add the members. | |
members | (string | Pointer)[] | Resources to be added as members. | |
requestOptions | RequestOptions | Customizable options for the request. |
.create() : Promise<(T & CarbonLDP.Document)[]>
create<T extends object>( uri:string, children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the children. | |
children | T[] | Objects to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
create<T extends object>( uri:string, children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the children. | |
children | T[] | Objects to be persisted. | |
slugs | string[] | Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided. | |
requestOptions | RequestOptions | Customizable options for the request. |
create<T extends object>( uri:string, child:T, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the child. | |
child | T | Object to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
create<T extends object>( uri:string, child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the child. | |
child | T | Object to be persisted. | |
slug | string | Suggested slug for the child URI. | |
requestOptions | RequestOptions | Customizable options for the request. |
.createAndRetrieve() : Promise<(T & CarbonLDP.Document)[]>
createAndRetrieve<T extends object>( uri:string, children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the document of the specified URI and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the children. | |
children | T[] | Objects to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
createAndRetrieve<T extends object>( uri:string, children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Persists multiple objects as children of the document of the specified URI and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the children. | |
children | T[] | Objects to be persisted. | |
slugs | string[] | Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided. | |
requestOptions | RequestOptions | Customizable options for the request. |
createAndRetrieve<T extends object>( uri:string, child:T, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the document of the specified URI and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the child. | |
child | T | Object to be persisted. | |
requestOptions | RequestOptions | Customizable options for the request. |
createAndRetrieve<T extends object>( uri:string, child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>
Persists the object as a child of the document of the specified URI and retrieves the updated data from the server.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to create the child. | |
child | T | Object to be persisted. | |
slug | string | Suggested slug for the child URI. | |
requestOptions | RequestOptions | Customizable options for the request. |
.delete() : Promise<void>
delete( uri:string, requestOptions?:RequestOptions ):Promise<void>
Deletes the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to be deleted. | |
requestOptions | RequestOptions | Customizable options for the request. |
.get() : Promise<T & CarbonLDP.Document>
get<T extends object>( uri:string, requestOptions?:GETOptions ):Promise<T & Document>
Retrieves the entire document of the URI specified.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to be retrieved. | |
requestOptions | GETOptions | Customizable options for the request. |
.refresh() : Promise<T & CarbonLDP.Document>
refresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Refreshes with the latest data of the specified document.
Param | Type | Default | Description |
---|---|---|---|
document | Document | The document to be refreshed. | |
requestOptions | RequestOptions | Customizable options for the request. |
.removeMember() : Promise<void>
removeMember( uri:string, member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>
Removes the provided resource as member of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to remove the member. | |
member | string | Pointer | Resource to be removed as member. | |
requestOptions | RequestOptions | Customizable options for the request. |
.removeMembers() : Promise<void>
removeMembers( uri:string, members?:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>
Removes the provided resources as members of the document of the specified URI. IF no members is provided all the members of the specified document will be removed.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to remove the members. | |
members | (string | Pointer)[] | Resources to be removed as members. | |
requestOptions | RequestOptions | Customizable options for the request. |
removeMembers( uri:string, requestOptions?:RequestOptions ):Promise<void>
Removes all the members of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to remove its members. | |
requestOptions | RequestOptions | Customizable options for the request. |
.resolve() : Promise<T & CarbonLDP.Document>
resolve<T extends object>( document:Document, requestOptions?:GETOptions ):Promise<T & Document>
Resolves the entire document of the URI specified.
Param | Type | Default | Description |
---|---|---|---|
document | Document | Document to be resolved. | |
requestOptions | GETOptions | Customizable options for the request. |
.save() : Promise<T & CarbonLDP.Document>
save<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Saves the changes of the specified document.
Param | Type | Default | Description |
---|---|---|---|
document | Document | The document to be saved. | |
requestOptions | RequestOptions | Customizable options for the request. |
.saveAndRefresh() : Promise<T & CarbonLDP.Document>
saveAndRefresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Saves the changes of the specified document and retrieves its latest changes.
Param | Type | Default | Description |
---|---|---|---|
document | Document | The resource to saved and refreshed. | |
requestOptions | RequestOptions | Customizable options for the request. |
Factory, decorator and utils for CarbonLDP.DocumentsRepository.Traits.LDPDocumentsRepositoryTrait
.
type LDPDocumentsRepositoryTraitFactory = ModelPrototype<LDPDocumentsRepositoryTrait, HTTPRepositoryTrait, OverriddenMembers> & ModelDecorator<LDPDocumentsRepositoryTrait, BaseDocumentsRepository>
Trait of a CarbonLDP.DocumentsRepository
with methods for advanced reading requests.
Methods
.get() : Promise<T & CarbonLDP.Document>
get<T extends object>( uri:string, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Retrieves the properties of the document of the URI specified set by the query function.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to be retrieved. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be retrieved. |
get<T extends object>( uri:string, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Retrieves the entire document of the URI specified or only the properties set by the query function when provided.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to be retrieved. | |
requestOptions | GETOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be retrieved. |
get<T extends object>( uris:string[], queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>
Retrieves the properties set by the query function, of the documents specified.
Param | Type | Default | Description |
---|---|---|---|
uris | string[] | URIs of the documents to be retrieved. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the documents to be retrieved. |
get<T extends object>( uris:string[], requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>
Retrieves the entire documents of the URIs specified or only the properties set by the query function when provided.
Param | Type | Default | Description |
---|---|---|---|
uris | string[] | URIs of the documents to be retrieved. | |
requestOptions | GETOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the documents to be retrieved. |
.getChildren() : Promise<(T & CarbonLDP.Document)[]>
getChildren<T extends object>( uri:string, requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieves the entire children of the document of the specified URI or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its children. | |
requestOptions | RequestOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the children to be retrieved. |
getChildren<T extends object>( uri:string, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieved the entire children of the document of the specified URI or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its children. | |
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the children to be retrieved. |
.getMembers() : Promise<(T & CarbonLDP.Document)[]>
getMembers<T extends object>( uri:string, requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieves the entire members of the document of the specified URI or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its members. | |
requestOptions | RequestOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the members to be retrieved. |
getMembers<T extends object>( uri:string, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>
Retrieved the entire members of the document of the specified URI or only the properties set by the query function.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its members. | |
queryBuilderFn | (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder | Function that specify the structure of the members to be retrieved. |
.listChildren() : Promise<(T & CarbonLDP.Document)[]>
listChildren<T extends object>( uri:string, requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Retrieves the shallow children of the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its shallow children. | |
requestOptions | RequestOptions | Customizable options for the request. |
.listMembers() : Promise<(T & CarbonLDP.Document)[]>
listMembers<T extends object>( uri:string, requestOptions?:RequestOptions ):Promise<(T & Document)[]>
Retrieves the shallow members of the document of the specified URI
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document to retrieve its shallow members. | |
requestOptions | RequestOptions | Customizable options for the request. |
.refresh() : Promise<T & CarbonLDP.Document>
refresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Refreshes with the latest data of the specified document. If the document was retrieved partially, only the partial properties will be refreshed.
Param | Type | Default | Description |
---|---|---|---|
document | Document | The document to be refreshed. | |
requestOptions | RequestOptions | Customizable options for the request. |
.resolve() : Promise<T & CarbonLDP.Document>
resolve<T extends object>( document:Document, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Resolves the properties of the document of the URI specified set by the query function.
Param | Type | Default | Description |
---|---|---|---|
document | Document | Document to be resolved. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be resolved. |
resolve<T extends object>( document:Document, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Resolves the entire document of the URI specified or only the properties set by the query function when provided.
Param | Type | Default | Description |
---|---|---|---|
document | Document | Document to be resolved. | |
requestOptions | GETOptions | Customizable options for the request. | |
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder | Function that specify the structure of the document to be resolved. |
.saveAndRefresh() : Promise<T & CarbonLDP.Document>
saveAndRefresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Saves the changes of the specified document and retrieves its latest changes. If the document was retrieved partially, only the partial properties will be refreshed.
Param | Type | Default | Description |
---|---|---|---|
document | Document | The resource to saved and refreshed. | |
requestOptions | RequestOptions | Customizable options for the request. |
Factory, decorator and utils for CarbonLDP.DocumentsRepository.Traits.QueryableDocumentsRepositoryTrait
.
type QueryableDocumentsRepositoryTraitFactory = ModelPrototype<QueryableDocumentsRepositoryTrait, LDPDocumentsRepositoryTrait, OverriddenMembers> & ModelDecorator<QueryableDocumentsRepositoryTrait, BaseDocumentsRepository>
Trait of a CarbonLDP.DocumentsRepository
with methods for SPARQL requests.
Properties
.context : CarbonLDP.DocumentsContext
Context from where the repository is created.
Methods
.executeASKQuery() : Promise<boolean>
executeASKQuery( uri:string, askQuery:string, requestOptions?:RequestOptions ):Promise<boolean>
Executes an ASK query on the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to execute the query. | |
askQuery | string | ASK query to be executed. | |
requestOptions | RequestOptions | Customizable options for the request. |
.executeSELECTQuery() : Promise<CarbonLDP.SPARQL.SPARQLSelectResults<T>>
executeSELECTQuery<T extends object>( uri:string, selectQuery:string, requestOptions?:RequestOptions ):Promise<SPARQLSelectResults<T>>
Executes a SELECT query on the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to execute the query. | |
selectQuery | string | SELECT query to be executed. | |
requestOptions | RequestOptions | Customizable options for the request. |
.executeUPDATE() : Promise<void>
executeUPDATE( uri:string, update:string, requestOptions?:RequestOptions ):Promise<void>
Executes an UPDATE in the document of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document where to execute the update. | |
update | string | UPDATE to be executed. | |
requestOptions | RequestOptions | Customizable options for the request. |
.sparql() : QueryClause<CarbonLDP.SPARQL.FinishSPARQLSelect, CarbonLDP.SPARQL.FinishSPARQLAsk>
sparql( uri:string ):QueryClause<FinishSPARQLSelect, FinishSPARQLAsk>
Creates an instance of SPARQLER builder for the current document or the one specified by the URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the document from where to create the query builder. |
Factory, decorator and utils for CarbonLDP.DocumentsRepository.Traits.SPARQLDocumentsRepositoryTrait
.
type SPARQLDocumentsRepositoryTraitFactory = ModelPrototype<SPARQLDocumentsRepositoryTrait, HTTPRepositoryTrait> & ModelDecorator<SPARQLDocumentsRepositoryTrait, BaseDocumentsRepository>
carbonldp/Errors Module
Classes
Class that works as template for the custom errors in the SDK.
Constructor
AbstractError( message:string )
Param | Type | Default | Description |
---|---|---|---|
message | string |
Properties
.name : string
Error class to indicate that a different argument than the expected was provided.
Properties
.name : string
Error class to indicate that a task can't be completed because of the lack of pre-required configuration or execution of previous tasks.
Constructor
IllegalStateError( message:string )
Param | Type | Default | Description |
---|---|---|---|
message | string |
Properties
.name : string
Error class to indicate that an action is not yet implemented.
Constructor
NotImplementedError( message:string )
Param | Type | Default | Description |
---|---|---|---|
message | string |
Properties
.name : string
carbonldp/Fragment Module
Interfaces
c:Document
. c:Document
. Type Aliases
CarbonLDP.Fragment
. CarbonLDP.TransientFragment
. Properties
#Fragment : CarbonLDP.FragmentFactory
Constant that implements CarbonLDP.FragmentFactory
.
#TransientFragment : CarbonLDP.TransientFragmentFactory
Constant that implements CarbonLDP.TransientFragmentFactory
.
CarbonLDP.BaseResolvableFragment Interface
Properties to create a persisted fragment.
Properties
.$registry : CarbonLDP.Document
Registry the fragment will belong to.
CarbonLDP.BaseTransientFragment Interface
Properties to create an in-memory fragment.
Properties
.$registry : CarbonLDP.TransientDocument
Registry the fragment will belong to.
CarbonLDP.Fragment Interface
Model that represents a fragment of a persisted c:Document
.
Properties
.$document : CarbonLDP.Document
The document the fragment belongs to.
.$registry : CarbonLDP.Document
Registry where the fragment belongs to.
.$repository : CarbonLDP.Document
Repository where the fragment can make requests.
Methods
.$delete() : Promise<void>
$delete( requestOptions?:RequestOptions ):Promise<void>
Accessor to the CarbonLDP.Document.$delete
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions |
$delete( uri:string, requestOptions?:RequestOptions ):Promise<void>
Accessor to the CarbonLDP.Document.$delete
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
requestOptions | RequestOptions |
.$exists() : Promise<boolean>
$exists( requestOptions?:RequestOptions ):Promise<boolean>
Accessor to the CarbonLDP.Document.$exists
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions |
$exists( uri:string, requestOptions?:RequestOptions ):Promise<boolean>
Accessor to the CarbonLDP.Document.$exists
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
requestOptions | RequestOptions |
.$get() : Promise<T & CarbonLDP.Document>
$get<T extends object>( queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Accessor to the CarbonLDP.Document.$get
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$get<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Accessor to the CarbonLDP.Document.$get
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | GETOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$get<T extends object>( uri:string, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Accessor to the CarbonLDP.Document.$get
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$get<T extends object>( uri:string, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Accessor to the CarbonLDP.Document.$get
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
uri | string | ||
requestOptions | GETOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
.$refresh() : Promise<T & this & CarbonLDP.Document>
$refresh<T extends object>( requestOptions?:RequestOptions ):Promise<T & this & Document>
Accessor to the CarbonLDP.Document.$refresh
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions |
$refresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Accessor to the CarbonLDP.Document.$refresh
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
requestOptions | RequestOptions |
.$resolve() : Promise<T & this & CarbonLDP.Document>
$resolve<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>
Accessor to the CarbonLDP.Document.$resolve
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | GETOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$resolve<T extends object>( queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>
Accessor to the CarbonLDP.Document.$resolve
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$resolve<T extends object>( document:Document, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Accessor to the CarbonLDP.Document.$resolve
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
$resolve<T extends object>( document:Document, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>
Accessor to the CarbonLDP.Document.$resolve
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
requestOptions | GETOptions | ||
queryBuilderFn | (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder |
.$save() : Promise<T & this & CarbonLDP.Document>
$save<T extends object>( requestOptions?:RequestOptions ):Promise<T & this & Document>
Accessor to the CarbonLDP.Document.$save
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions |
$save<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Accessor to the CarbonLDP.Document.$save
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
requestOptions | RequestOptions |
.$saveAndRefresh() : Promise<T & this & CarbonLDP.Document>
$saveAndRefresh<T extends object>( requestOptions?:RequestOptions ):Promise<T & this & Document>
Accessor to the CarbonLDP.Document.$saveAndRefresh
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions |
$saveAndRefresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>
Accessor to the CarbonLDP.Document.$saveAndRefresh
method of the document where the fragment belongs to.
Param | Type | Default | Description |
---|---|---|---|
document | Document | ||
requestOptions | RequestOptions |
CarbonLDP.FragmentFactory Type Alias
Factory, decorator and utils for CarbonLDP.Fragment
.
type FragmentFactory = ModelPrototype<Fragment, TransientFragment & QueryablePointer, OverriddenMembers> & ModelDecorator<Fragment, BaseResolvableFragment> & ModelFactory<TransientFragment, BaseTransientFragment>
CarbonLDP.TransientFragment Interface
In-memory model that represents a fragment of c:Document
.
Properties
.$document : CarbonLDP.TransientDocument
The document the fragment belongs to.
.$registry : CarbonLDP.TransientDocument
Registry where the fragment belongs to.
CarbonLDP.TransientFragmentFactory Type Alias
Factory, decorator and utils for CarbonLDP.TransientFragment
.
type TransientFragmentFactory = ModelPrototype<TransientFragment & BaseTransientFragment, Resource, OverriddenMembers> & ModelDecorator<TransientFragment, BaseTransientFragment> & ModelFactory<TransientFragment, BaseTransientFragment> & ModelTypeGuard<TransientFragment>
carbonldp/FreeResources Module
Interfaces
CarbonLDP.FreeResources
. Type Aliases
CarbonLDP.FreeResources
. Properties
#FreeResources : CarbonLDP.FreeResourcesFactory
Constant that implements CarbonLDP.FreeResourcesFactory
.
CarbonLDP.BaseFreeResources Interface
Properties to create a CarbonLDP.FreeResources
.
Properties
.registry : CarbonLDP.GeneralRegistry<any>
Registry where the CarbonLDP.FreeResources
scope will be in.
CarbonLDP.FreeResources Interface
Model that represents resources that doesn't have a context.
Properties
.registry : CarbonLDP.GeneralRegistry<any>
Registry where the CarbonLDP.FreeResources
scope is in.
Methods
._addPointer() : T & CarbonLDP.Resource
_addPointer<T extends object>( base:T & Partial<Pointer> ):T & Resource
Param | Type | Default | Description |
---|---|---|---|
base | T & Partial<Pointer> |
._getLocalID() : string
_getLocalID( id:string ):string
Param | Type | Default | Description |
---|---|---|---|
id | string |
.toJSON() : CarbonLDP.RDF.RDFNode[]
toJSON( contextOrKey?:string | Context<RegisteredPointer, ResolvablePointer> ):RDFNode[]
Returns the JSON-LD representation of the every resources inside an array.
Param | Type | Default | Description |
---|---|---|---|
contextOrKey | string | Context<RegisteredPointer, ResolvablePointer> | A specific context to use for expand the data into JSON-LD instead of the internal one. |
CarbonLDP.FreeResourcesFactory Type Alias
Factory, decorator and utils for CarbonLDP.FreeResources
.
type FreeResourcesFactory = ModelPrototype<FreeResources, Registry, OverriddenMembers> & ModelDecorator<FreeResources, BaseFreeResources> & ModelTypeGuard<FreeResources> & ModelFactory<FreeResources, BaseFreeResources> & FreeResourcesUtils
CarbonLDP.FreeResourcesUtils Interface
Utils for CarbonLDP.FreeResources
.
Methods
.parseFreeNodes() : CarbonLDP.FreeResources
parseFreeNodes( registry:GeneralRegistry<any>, freeNodes:RDFNode[] ):FreeResources
Param | Type | Default | Description |
---|---|---|---|
registry | GeneralRegistry<any> | ||
freeNodes | RDFNode[] |
carbonldp/GeneralRegistry Module
Interfaces
CarbonLDP.GeneralRegistry
. CarbonLDP.Context
. CarbonLDP.TypedModelDecorator.TYPE
. Type Aliases
CarbonLDP.GeneralRegistry
. Properties
#GeneralRegistry : CarbonLDP.GeneralRegistryFactory
Constant that implements CarbonLDP.GeneralRegistryFactory
.
CarbonLDP.BaseGeneralRegistry Interface
Properties for create a CarbonLDP.GeneralRegistry
.
Properties
.context : CarbonLDP.Context<any, any>
Context where the registry will belong to.
.registry : CarbonLDP.GeneralRegistry | undefined
Optional parent registry used to inherit resources and more data.
CarbonLDP.GeneralRegistry Interface
Base registry used by CarbonLDP.Context
.
Properties
.__modelDecorators : Map<string, CarbonLDP.TypedModelDecorator>
Map that stores the decorators in the registry.
.context : CarbonLDP.Context<M, any>
Context where the registry belongs to.
.registry : CarbonLDP.GeneralRegistry | undefined
Parent registry used to inherit resources and more data.
Methods
._addPointer() : T & M
_addPointer<T extends object>( pointer:T & Pointer ):T & M
Param | Type | Default | Description |
---|---|---|---|
pointer | T & Pointer |
._getLocalID() : string
_getLocalID( id:string ):string
Param | Type | Default | Description |
---|---|---|---|
id | string |
.addDecorator() : this
addDecorator( decorator:TypedModelDecorator ):this
Stores a decorator in the current registry.
Param | Type | Default | Description |
---|---|---|---|
decorator | TypedModelDecorator | The information of the decorator to store. |
.decorate() : void
decorate( object:{ types?: string[]; } ):void
Applies the corresponding decorators in the entire registry tree.
Param | Type | Default | Description |
---|---|---|---|
object | { types?: string[]; } | with an array of types used to match the decorator to be applied. |
CarbonLDP.GeneralRegistryFactory Type Alias
Factory, decorator and utils for CarbonLDP.GeneralRegistry
.
type GeneralRegistryFactory = ModelPrototype<GeneralRegistry, Registry & ObjectSchemaResolver, OverloadedFns> & ModelDecorator<GeneralRegistry<any>, BaseGeneralRegistry> & ModelFactory<GeneralRegistry<any>, BaseGeneralRegistry>
CarbonLDP.TypedModelDecorator Interface
Object that has implements a model decorator for an specific type defined by the property CarbonLDP.TypedModelDecorator.TYPE
.
Properties
.TYPE : string
The type associated to the model decorator methods.
carbonldp/GeneralRepository Module
Interfaces
CarbonLDP.GeneralRepository
CarbonLDP.Context
. Type Aliases
CarbonLDP.GeneralRepository
. Properties
#GeneralRepository : CarbonLDP.GeneralRepositoryFactory
Constant that implements CarbonLDP.GeneralRepositoryFactory
.
CarbonLDP.BaseGeneralRepository Interface
Properties for create a CarbonLDP.GeneralRepository
Properties
.context : CarbonLDP.Context<MODEL & CarbonLDP.RegisteredPointer, MODEL>
Context where the repository will belong to.
CarbonLDP.GeneralRepository Interface
Base repository used by CarbonLDP.Context
.
Properties
.context : CarbonLDP.Context<MODEL & CarbonLDP.RegisteredPointer, MODEL>
Context where the repository belongs to.
CarbonLDP.GeneralRepositoryFactory Type Alias
Factory, decorator and utils for CarbonLDP.GeneralRepository
.
type GeneralRepositoryFactory = ModelPrototype<GeneralRepository, Repository> & ModelDecorator<GeneralRepository<any>, BaseGeneralRepository> & ModelFactory<GeneralRepository, BaseGeneralRepository>
carbonldp/HTTP Module
Classes
JSON.parse()
function using the Promise
pattern. Interfaces
GET
request. CarbonLDP.HTTP.RequestUtils#setRetrievalPreferences
which specifies the behaviour of a request when using an ldp:Container
interaction model. Reexports
.HTTPMethod : enum
Enum for the HTTP/1.1 methods.
Enumeration | Description |
---|---|
CarbonLDP.HTTP.HTTPMethod.OPTIONS | Identifies the OPTIONS HTTP/1.1 method, which allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. |
CarbonLDP.HTTP.HTTPMethod.HEAD | Identifies the HEAD HTTP/1.1 method, which returns only the headers of a GET HTTP request. |
CarbonLDP.HTTP.HTTPMethod.GET | Identifies the GET HTTP/1.1 method, which returns whatever information is identified by the request URI. |
CarbonLDP.HTTP.HTTPMethod.POST | Identifies the POST HTTP/1.1 method, which requests to the server to create a new entity. |
CarbonLDP.HTTP.HTTPMethod.PUT | Identifies the PUT HTTP/1.1 method, which allows you to replace an entirely entity, or to send a signal to a resource. |
CarbonLDP.HTTP.HTTPMethod.PATCH | Identifies the PATCH HTTP/1.1 method, which allows you to update specified fields of an entity. |
CarbonLDP.HTTP.HTTPMethod.DELETE | Identifies the DELETE HTTP/1.1 method, which allows you to request the deletion of a resource identified by the request URI. |
.StatusCode : enum
Enum with the HTTP/1.1 status codes.
Enumeration | Description |
---|---|
CarbonLDP.HTTP.StatusCode.CONTINUE | Identifies the HTTP/1.1 100 status code. |
CarbonLDP.HTTP.StatusCode.SWITCHING_PROTOCOLS | Identifies the HTTP/1.1 101 status code. |
CarbonLDP.HTTP.StatusCode.OK | Identifies the HTTP/1.1 200 status code. |
CarbonLDP.HTTP.StatusCode.CREATED | Identifies the HTTP/1.1 201 status code. |
CarbonLDP.HTTP.StatusCode.ACCEPTED | Identifies the HTTP/1.1 202 status code. |
CarbonLDP.HTTP.StatusCode.NON_AUTHORITATIVE_INFORMATION | Identifies the HTTP/1.1 203 status code. |
CarbonLDP.HTTP.StatusCode.NO_CONTENT | Identifies the HTTP/1.1 204 status code. |
CarbonLDP.HTTP.StatusCode.RESET_CONTENT | Identifies the HTTP/1.1 205 status code. |
CarbonLDP.HTTP.StatusCode.PARTIAL_CONTENT | Identifies the HTTP/1.1 206 status code. |
CarbonLDP.HTTP.StatusCode.MULTIPLE_CHOICES | Identifies the HTTP/1.1 300 status code. |
CarbonLDP.HTTP.StatusCode.MOVED_PERMANENTLY | Identifies the HTTP/1.1 301 status code. |
CarbonLDP.HTTP.StatusCode.FOUND | Identifies the HTTP/1.1 302 status code. |
CarbonLDP.HTTP.StatusCode.SEE_OTHER | Identifies the HTTP/1.1 303 status code. |
CarbonLDP.HTTP.StatusCode.NOT_MODIFIED | Identifies the HTTP/1.1 304 status code. |
CarbonLDP.HTTP.StatusCode.USE_PROXY | Identifies the HTTP/1.1 305 status code. |
CarbonLDP.HTTP.StatusCode.TEMPORARY_REDIRECT | Identifies the HTTP/1.1 307 status code. |
CarbonLDP.HTTP.StatusCode.BAD_REQUEST | Identifies the HTTP/1.1 400 status code. |
CarbonLDP.HTTP.StatusCode.UNAUTHORIZED | Identifies the HTTP/1.1 401 status code. |
CarbonLDP.HTTP.StatusCode.PAYMENT_REQUIRED | Identifies the HTTP/1.1 402 status code. |
CarbonLDP.HTTP.StatusCode.FORBIDDEN | Identifies the HTTP/1.1 403 status code. |
CarbonLDP.HTTP.StatusCode.NOT_FOUND | Identifies the HTTP/1.1 404 status code. |
CarbonLDP.HTTP.StatusCode.METHOD_NOT_ALLOWED | Identifies the HTTP/1.1 405 status code. |
CarbonLDP.HTTP.StatusCode.NOT_ACCEPTABLE | Identifies the HTTP/1.1 406 status code. |
CarbonLDP.HTTP.StatusCode.PROXY_AUTHENTICATION_REQUIRED | Identifies the HTTP/1.1 407 status code. |
CarbonLDP.HTTP.StatusCode.REQUEST_TIME_OUT | Identifies the HTTP/1.1 408 status code. |
CarbonLDP.HTTP.StatusCode.CONFLICT | Identifies the HTTP/1.1 409 status code. |
CarbonLDP.HTTP.StatusCode.GONE | Identifies the HTTP/1.1 410 status code. |
CarbonLDP.HTTP.StatusCode.LENGTH_REQUIRED | Identifies the HTTP/1.1 411 status code. |
CarbonLDP.HTTP.StatusCode.PRECONDITION_FAILED | Identifies the HTTP/1.1 412 status code. |
CarbonLDP.HTTP.StatusCode.REQUEST_ENTITY_TOO_LARGE | Identifies the HTTP/1.1 413 status code. |
CarbonLDP.HTTP.StatusCode.REQUEST_URI_TOO_LARGE | Identifies the HTTP/1.1 414 status code. |
CarbonLDP.HTTP.StatusCode.UNSUPPORTED_MEDIA_TYPE | Identifies the HTTP/1.1 415 status code. |
CarbonLDP.HTTP.StatusCode.REQUESTED_RANGE_NOT_SATISFIABLE | Identifies the HTTP/1.1 416 status code. |
CarbonLDP.HTTP.StatusCode.EXPECTATION_FAILED | Identifies the HTTP/1.1 417 status code. |
CarbonLDP.HTTP.StatusCode.INTERNAL_SERVER_ERROR | Identifies the HTTP/1.1 500 status code. |
CarbonLDP.HTTP.StatusCode.NOT_IMPLEMENTED | Identifies the HTTP/1.1 501 status code. |
CarbonLDP.HTTP.StatusCode.BAD_GATEWAY | Identifies the HTTP/1.1 502 status code. |
CarbonLDP.HTTP.StatusCode.SERVICE_UNAVAILABLE | Identifies the HTTP/1.1 503 status code. |
CarbonLDP.HTTP.StatusCode.GATEWAY_TIME_OUT | Identifies the HTTP/1.1 504 status code. |
CarbonLDP.HTTP.StatusCode.HTTP_VERSION_NOT_SUPPORTED | Identifies the HTTP/1.1 505 status code. |
CarbonLDP.HTTP.GETOptions Interface
Customizable options for a GET
request.
Properties
.ensureLatest : boolean
Flag that ignores the cache of the SDK and ensures to make a request.
CarbonLDP.HTTP.Header Class
Class to manage the values in an HTTP header.
Constructor
Header( values?:string | string[] )
Create an instance with an array of values or a string that will be parsed into the multiple values that may contain.
Param | Type | Default | Description |
---|---|---|---|
values | string | string[] | The array of values of the string to be parsed. |
Properties
.values : string[]
Array with each value of the header.
Methods
#__parseValues() : string[]
__parseValues( strValues:string ):string[]
Param | Type | Default | Description |
---|---|---|---|
strValues | string |
#parseHeaders() : Map<string, CarbonLDP.HTTP.Header>
parseHeaders( headersString:string ):Map<string, Header>
Returns a Map which relates all header names with a CarbonLDP.HTTP.Header
object containing their values.
Param | Type | Default | Description |
---|---|---|---|
headersString | string | The string to be parsed into a map of name -> Header. |
.addValue() : void
addValue( value:string ):void
Parse and add the string value(s) into the current header.
Param | Type | Default | Description |
---|---|---|---|
value | string | Value or values to add. |
.hasValue() : boolean
hasValue( value:string ):boolean
Returns true when the specified value exists in the values stored.
Param | Type | Default | Description |
---|---|---|---|
value | string | The value to check if is stored. |
.toString() : string
toString():string
Returns the string representation of all the values of the headers.
CarbonLDP.HTTP.Parser Interface
Interface that represents a what a parser must contains to be used when converting the response of a request.
Methods
.parse() : Promise<T>
parse( body:string ):Promise<T>
Parses the provided string to a specified T element.
Param | Type | Default | Description |
---|---|---|---|
body | string | The body string of the request to parse. |
CarbonLDP.HTTP.RequestOptions Interface
Customizable options that can change the behaviour of a request.
Properties
.headers : Map<string, CarbonLDP.HTTP.Header>
Map that contains the headers to include in the request.
.request : XMLHttpRequest
Specific XMLHttpRequest to be used for the request.
.sendCredentialsOnCORS : boolean
Flag that enables Cross-Origin Resource Sharing (CORS).
.timeout : number
Timeout of the request.
Service with static methods to send HTTP request.
Properties
Methods
#__contentTypeIsAccepted() : boolean
__contentTypeIsAccepted( requestOptions:RequestOptions, response:Response ):boolean
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions | ||
response | Response |
#__handleGETResponse() : Promise<CarbonLDP.HTTP.Response>
__handleGETResponse( url:string, requestOptions:RequestOptions, response:Response ):Promise<Response>
GET requests can be affected by previously cached resources that were originally requested with a different Accept header. This method identifies that and retries the request with headers that force browsers to ignore cache.
Param | Type | Default | Description |
---|---|---|---|
url | string | ||
requestOptions | RequestOptions | ||
response | Response |
#__isChromiumAgent() : boolean
__isChromiumAgent():boolean
#__setFalseETag() : void
__setFalseETag( requestOptions:RequestOptions ):void
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions |
#__setNoCacheHeaders() : void
__setNoCacheHeaders( requestOptions:RequestOptions ):void
Param | Type | Default | Description |
---|---|---|---|
requestOptions | RequestOptions |
#delete() : any
delete( url:string, options?:RequestOptions ):Promise<Response>
Sends an DELETE
request.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
options | RequestOptions | Customizable options for the request. |
delete( url:string, body:string, options?:RequestOptions ):Promise<Response>
Sends an DELETE
request.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
body | string | Body to be sent int he request. | |
options | RequestOptions | Customizable options for the request. |
delete<T>( url:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>
Sends an DELETE
request and parses its response data.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
options | RequestOptions | Customizable options for the request. | |
parser | Parser<T> | Parser to be used in the response body of the request. |
delete<T>( url:string, body:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>
Sends an DELETE
request and parses its response data.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
body | string | Body to be sent int he request. | |
options | RequestOptions | Customizable options for the request. | |
parser | Parser<T> | Parser to be used in the response body of the request. |
#get() : any
get( url:string, options?:RequestOptions ):Promise<Response>
Sends an GET
request.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
options | RequestOptions | Customizable options for the request. |
get<T>( url:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>
Sends an GET
request and parses its response data.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
options | RequestOptions | Customizable options for the request. | |
parser | Parser<T> | Parser to be used in the response body of the request. |
#head() : Promise<CarbonLDP.HTTP.Response>
head( url:string, options:RequestOptions ):Promise<Response>
Sends an HEAD
request.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
options | RequestOptions | Customizable options for the request. |
#options() : Promise<CarbonLDP.HTTP.Response>
options( url:string, options:RequestOptions ):Promise<Response>
Sends an OPTIONS
request.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
options | RequestOptions | Customizable options for the request. |
#patch() : any
patch( url:string, body:string, options?:RequestOptions ):Promise<Response>
Sends an PATCH
request.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
body | string | Body to be sent int he request. | |
options | RequestOptions | Customizable options for the request. |
patch<T>( url:string, body:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>
Sends an PATCH
request and parses its response data.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
body | string | Body to be sent int he request. | |
options | RequestOptions | Customizable options for the request. | |
parser | Parser<T> | Parser to be used in the response body of the request. |
#post() : any
post( url:string, body:any, options?:RequestOptions ):Promise<Response>
Sends an POST
request.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
body | any | Body to be sent int he request. | |
options | RequestOptions | Customizable options for the request. |
post<T>( url:string, body:any, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>
Sends an POST
request and parses its response data.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
body | any | Body to be sent int he request. | |
options | RequestOptions | Customizable options for the request. | |
parser | Parser<T> | Parser to be used in the response body of the request. |
#put() : any
put( url:string, body:string, options?:RequestOptions ):Promise<Response>
Sends an PUT
request.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
body | string | Body to be sent int he request. | |
options | RequestOptions | Customizable options for the request. |
put<T>( url:string, body:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>
Sends an PUT
request and parses its response data.
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the request to be sent. | |
body | string | Body to be sent int he request. | |
options | RequestOptions | Customizable options for the request. | |
parser | Parser<T> | Parser to be used in the response body of the request. |
#send() : any
send( method:string | HTTPMethod, url:string, options?:RequestOptions ):Promise<Response>
Generic send method, to be used by the others methods in the class.
Param | Type | Default | Description |
---|---|---|---|
method | string | HTTPMethod | The method of the request to be sent. | |
url | string | URL of the request to be sent. | |
options | RequestOptions | Customizable options for the request. |
send( method:string | HTTPMethod, url:string, body:any, options?:RequestOptions ):Promise<Response>
Generic send method, to be used by the others methods in the class.
Param | Type | Default | Description |
---|---|---|---|
method | string | HTTPMethod | The method of the request to be sent. | |
url | string | URL of the request to be sent. | |
body | any | Body to be sent int he request. | |
options | RequestOptions | Customizable options for the request. |
send<T>( method:string | HTTPMethod, url:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>
Generic send method, to be used by the others methods in the class.
Param | Type | Default | Description |
---|---|---|---|
method | string | HTTPMethod | The method of the request to be sent. | |
url | string | URL of the request to be sent. | |
options | RequestOptions | Customizable options for the request. | |
parser | Parser<T> | Parser to be used in the response body of the request. |
send<T>( method:string | HTTPMethod, url:string, body?:any, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>
Generic send method, to be used by the others methods in the class.
Param | Type | Default | Description |
---|---|---|---|
method | string | HTTPMethod | The method of the request to be sent. | |
url | string | URL of the request to be sent. | |
body | any | Body to be sent int he request. | |
options | RequestOptions | Customizable options for the request. | |
parser | Parser<T> | Parser to be used in the response body of the request. |
Service with static utils methods for elements related to requests.
Methods
#__addHeaderValue() : void
__addHeaderValue( headerName:string, headerValue:string, requestOptions:RequestOptions ):void
Param | Type | Default | Description |
---|---|---|---|
headerName | string | ||
headerValue | string | ||
requestOptions | RequestOptions |
#cloneOptions() : CarbonLDP.HTTP.RequestOptions
cloneOptions( options:RequestOptions ):RequestOptions
Clones the options into a new object including coping the headers map into a different map.
Param | Type | Default | Description |
---|---|---|---|
options | RequestOptions | The options to be clones. |
#getHeader() : CarbonLDP.HTTP.Header | undefined
getHeader( headerName:string, requestOptions:RequestOptions, initialize?:true ):Header | undefined
Returns the header object inside an options object. Returns undefined
if the header doesn't exists. If initialize
flag is provided with true, an empty header will be created if not exits.
Param | Type | Default | Description |
---|---|---|---|
headerName | string | The name of the header to return/create. | |
requestOptions | RequestOptions | The options where to look/create the header. | |
initialize | true | Flag to create the header of not exists. |
#isOptions() : value is CarbonLDP.HTTP.RequestOptions
isOptions( value:any ):value is RequestOptions
Checks if the value provided can be considered a CarbonLDP.HTTP.RequestOptions
.
Param | Type | Default | Description |
---|---|---|---|
value | any | The value to be checked. |
#setAcceptHeader() : CarbonLDP.HTTP.RequestOptions
setAcceptHeader( accept:string, requestOptions:RequestOptions ):RequestOptions
Sets an accept
header in the options object request.
Param | Type | Default | Description |
---|---|---|---|
accept | string | The | |
requestOptions | RequestOptions | The options where to set the header. |
#setContentTypeHeader() : CarbonLDP.HTTP.RequestOptions
setContentTypeHeader( contentType:string, requestOptions:RequestOptions ):RequestOptions
Sets a content-type
header in the options object request.
Param | Type | Default | Description |
---|---|---|---|
contentType | string | The | |
requestOptions | RequestOptions | The options where to set the header. |
#setIfMatchHeader() : CarbonLDP.HTTP.RequestOptions
setIfMatchHeader( eTag:string, requestOptions:RequestOptions ):RequestOptions
Sets an if-match
header in the options object request.
Param | Type | Default | Description |
---|---|---|---|
eTag | string | The | |
requestOptions | RequestOptions | The options where to set the header. |
#setIfNoneMatchHeader() : CarbonLDP.HTTP.RequestOptions
setIfNoneMatchHeader( eTag:string, requestOptions:RequestOptions ):RequestOptions
Sets an if-none
header in the options object request.
Param | Type | Default | Description |
---|---|---|---|
eTag | string | The | |
requestOptions | RequestOptions | The options where to set the header. |
#setPreferredInteractionModel() : CarbonLDP.HTTP.RequestOptions
setPreferredInteractionModel( interactionModelURI:string, requestOptions:RequestOptions ):RequestOptions
Sets a prefer
header with rel=interaction-model
in the options object request.
Param | Type | Default | Description |
---|---|---|---|
interactionModelURI | string | The | |
requestOptions | RequestOptions | The options where to set the header. |
#setPreferredRetrieval() : CarbonLDP.HTTP.RequestOptions
setPreferredRetrieval( retrievalType:"representation" | "minimal", requestOptions:RequestOptions ):RequestOptions
Sets a prefer
header with return
in the options object request.
Param | Type | Default | Description |
---|---|---|---|
retrievalType | "representation" | "minimal" | The | |
requestOptions | RequestOptions | The options where to set the header. |
#setRetrievalPreferences() : CarbonLDP.HTTP.RequestOptions
setRetrievalPreferences( preferences:RetrievalPreferences, requestOptions:RequestOptions ):RequestOptions
Sets a prefer
header with include/omit
preferences in the options object request.
Param | Type | Default | Description |
---|---|---|---|
preferences | RetrievalPreferences | The preferences to be set. | |
requestOptions | RequestOptions | The options where to set the header. |
#setSlug() : CarbonLDP.HTTP.RequestOptions
setSlug( slug:string, requestOptions:RequestOptions ):RequestOptions
Sets an slug
header in the options object request.
Param | Type | Default | Description |
---|---|---|---|
slug | string | The | |
requestOptions | RequestOptions | The options where to set the header. |
CarbonLDP.HTTP.Response Class
Class that represents an HTTP response.
Constructor
Response( request:XMLHttpRequest )
Creates an instance from a XMLHttpRequest.
Param | Type | Default | Description |
---|---|---|---|
request | XMLHttpRequest | The XMLHttpRequest used in the Browser request. |
Response( request:any, data:string, response?:any )
Creates an instance from a ClientRequest, a data and an IncomingMessage.
Param | Type | Default | Description |
---|---|---|---|
request | any | The ClientRequest used in the Node.js request. | |
data | string | The full data received in the Node.js request. | |
response | any | The IncomingMessage of the Node.js request. |
Properties
.data : string
The RAW body of the request.
.headers : Map<string, CarbonLDP.HTTP.Header>
A map object containing the headers of the request's response.
.request : XMLHttpRequest | ClientRequest
The XMLHttpRequest or ClientRequest provided in the constructor.
.status : number
The status code of the request.
Methods
.getETag() : string
getETag():string
Returns the eTag header value. If no such header exists a CarbonLDP.HTTP.Errors.BadResponseError
will be thrown.
.getHeader() : CarbonLDP.HTTP.Header | null
getHeader( name:string ):Header | null
Returns the Header object referred by the name specified. If no header exists null
will be returned.
Param | Type | Default | Description |
---|---|---|---|
name | string | The name of the header to look for. |
CarbonLDP.HTTP.RetrievalPreferences Interface
Object used by CarbonLDP.HTTP.RequestUtils#setRetrievalPreferences
which specifies the behaviour of a request when using an ldp:Container
interaction model.
Properties
carbonldp/HTTP/Errors Module
Classes
Properties
#statusCodeMap : any
Map where all the HTTP Status Codes used in the SDK are assigned to their specific error class.
Error class to indicate that the server was acting as a gateway or proxy and received an invalid response from the upstream server.
Properties
Error class to indicate that the response obtained isn't the expected or can't be interpreted.
Properties
Error class to indicate that the request could not be processed because of a conflict, such as an ID conflict.
Properties
Error class to indicate that the current user doesn't have permissions to fulfill the request.
Properties
Error class to indicate that the server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.
Properties
Generic error class that defines any type of HTTP Error used in the SDK.
Constructor
HTTPError( message:string, response:Response )
Param | Type | Default | Description |
---|---|---|---|
message | string | ||
response | Response |
Properties
#statusCode : number | null
Status code of the HTTP error.
.name : string
.response : CarbonLDP.HTTP.Response
Response that was received with the HTTP error.
Error class to indicate that the server doesn't support the HTTP protocol version used in the request.
Properties
Error class to indicate that the server encountered an unexpected condition. This generic error is given when no other specific error is suitable.
Properties
Error class to indicate that the server cannot respond with the data type specified by the accept header of the request.
Properties
Error class to indicate that the server doesn't have the ability to fulfill the request yet.
Properties
Error class to indicate that the request entity is larger than the server is able to process.
Properties
Error class to indicate that the server is not able to process the request because its header fields are too large.
Properties
Error class to indicate that the server is not able to process the request because the URI is too long.
Properties
Error class to indicate that the server is currently unavailable (because it's overloaded or down for maintenance).
Properties
Error class to indicate that the current user has sent too many request in a given amount of time.
Properties
carbonldp/JSONLD Module
Classes
Methods
#_guessXSDType() : string | null
_guessXSDType( value:any ):string | null
Returns the guessed CarbonLDP.Vocabularies.XSD
type from the specified value.
Param | Type | Default | Description |
---|---|---|---|
value | any | the value to check its matching |
Service with that can convert expanded JSON-LD objects to compacted resources and viceversa.
Constructor
JSONLDConverter( literalSerializers?:any )
Creates a JSONLD Converter from optional literal serializers.
Param | Type | Default | Description |
---|---|---|---|
literalSerializers | any | Serializers to be set in the instance. |
Properties
._literalSerializers : Map<string, CarbonLDP.RDF.Serializer>
.literalSerializers : Map<string, CarbonLDP.RDF.Serializer>
Map object with data-type/serializer pairs for stringify the data of a resource when expanding it.
Methods
#getDefaultSerializers() : Map<string, CarbonLDP.RDF.Serializer>
getDefaultSerializers():Map<string, Serializer>
.__compactPropertyLiteral() : any[] | undefined
__compactPropertyLiteral( propertyValues:any[], definition:DigestedObjectSchemaProperty, digestedSchema:DigestedObjectSchema ):any[] | undefined
Param | Type | Default | Description |
---|---|---|---|
propertyValues | any[] | ||
definition | DigestedObjectSchemaProperty | ||
digestedSchema | DigestedObjectSchema |
.__compactSingle() : void
__compactSingle( expandedObject:any, targetObject:any, digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary, strict?:boolean ):void
Param | Type | Default | Description |
---|---|---|---|
expandedObject | any | ||
targetObject | any | ||
digestedSchema | DigestedObjectSchema | ||
pointerLibrary | PointerLibrary | $PointerLibrary | ||
strict | boolean |
.__expandLiteralValue() : any | null
__expandLiteralValue( literalValue:any, literalType:string ):any | null
Param | Type | Default | Description |
---|---|---|---|
literalValue | any | ||
literalType | string |
.__expandPointerValue() : CarbonLDP.RDF.RDFNode | null
__expandPointerValue( propertyValue:any, digestedSchema:DigestedObjectSchema, generalSchema:DigestedObjectSchema ):RDFNode | null
Param | Type | Default | Description |
---|---|---|---|
propertyValue | any | ||
digestedSchema | DigestedObjectSchema | ||
generalSchema | DigestedObjectSchema |
.__expandProperty() : any[] | null
__expandProperty( propertyName:string, propertyValue:any, digestedSchema:DigestedObjectSchema, generalSchema:DigestedObjectSchema ):any[] | null
Param | Type | Default | Description |
---|---|---|---|
propertyName | string | ||
propertyValue | any | ||
digestedSchema | DigestedObjectSchema | ||
generalSchema | DigestedObjectSchema |
.__expandPropertyLanguageMap() : any
__expandPropertyLanguageMap( propertyValue:any ):any
Param | Type | Default | Description |
---|---|---|---|
propertyValue | any |
.__expandPropertyLiteral() : any[]
__expandPropertyLiteral( propertyValue:any[], definition:DigestedObjectSchemaProperty, digestedSchema:DigestedObjectSchema ):any[]
Param | Type | Default | Description |
---|---|---|---|
propertyValue | any[] | ||
definition | DigestedObjectSchemaProperty | ||
digestedSchema | DigestedObjectSchema |
.__expandPropertyPointer() : any[]
__expandPropertyPointer( propertyValue:any[], digestedSchema:DigestedObjectSchema, generalSchema:DigestedObjectSchema ):any[]
Param | Type | Default | Description |
---|---|---|---|
propertyValue | any[] | ||
digestedSchema | DigestedObjectSchema | ||
generalSchema | DigestedObjectSchema |
.__expandPropertyValue() : any[]
__expandPropertyValue( propertyValue:any[], digestedSchema:DigestedObjectSchema, generalSchema:DigestedObjectSchema ):any[]
Param | Type | Default | Description |
---|---|---|---|
propertyValue | any[] | ||
digestedSchema | DigestedObjectSchema | ||
generalSchema | DigestedObjectSchema |
.__expandSingle() : CarbonLDP.RDF.RDFNode
__expandSingle( compactedObject:Object, generalSchema:DigestedObjectSchema, digestedSchema:DigestedObjectSchema ):RDFNode
Param | Type | Default | Description |
---|---|---|---|
compactedObject | Object | ||
generalSchema | DigestedObjectSchema | ||
digestedSchema | DigestedObjectSchema |
.__expandValue() : any
__expandValue( propertyValue:any, digestedSchema:DigestedObjectSchema, generalSchema:DigestedObjectSchema ):any
Param | Type | Default | Description |
---|---|---|---|
propertyValue | any | ||
digestedSchema | DigestedObjectSchema | ||
generalSchema | DigestedObjectSchema |
.__getProperties() : any[] | undefined
__getProperties( propertyValues:any[], pointerLibrary:PointerLibrary | $PointerLibrary ):any[] | undefined
Param | Type | Default | Description |
---|---|---|---|
propertyValues | any[] | ||
pointerLibrary | PointerLibrary | $PointerLibrary |
.__getPropertyContainerType() : CarbonLDP.ContainerType | null
__getPropertyContainerType( propertyValues:any ):ContainerType | null
Param | Type | Default | Description |
---|---|---|---|
propertyValues | any |
.__getPropertyPointers() : any[] | undefined
__getPropertyPointers( propertyValues:any[], pointerLibrary:PointerLibrary | $PointerLibrary ):any[] | undefined
Param | Type | Default | Description |
---|---|---|---|
propertyValues | any[] | ||
pointerLibrary | PointerLibrary | $PointerLibrary |
.__getPropertyURINameMap() : Map<string, string>
__getPropertyURINameMap( digestedSchema:DigestedObjectSchema ):Map<string, string>
Param | Type | Default | Description |
---|---|---|---|
digestedSchema | DigestedObjectSchema |
.__getPropertyValue() : any
__getPropertyValue( propertyName:string, propertyValues:any[], digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary ):any
Param | Type | Default | Description |
---|---|---|---|
propertyName | string | ||
propertyValues | any[] | ||
digestedSchema | DigestedObjectSchema | ||
pointerLibrary | PointerLibrary | $PointerLibrary |
.compact() : any
compact( expandedObjects:object[], targetObjects:object[], digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary ):object[]
Assigns the data of the expanded JSON-LD objects to the target objects in a friendly mode. i.e. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.
Param | Type | Default | Description |
---|---|---|---|
expandedObjects | object[] | The JSON-LD objects to compact. | |
targetObjects | object[] | The target objects where will be added the compact data of the expanded object. | |
digestedSchema | DigestedObjectSchema | The schema that describes how compact the expanded object. | |
pointerLibrary | PointerLibrary | $PointerLibrary | An object from where one can obtain the pointers of resources. |
compact( expandedObject:object, targetObject:object, digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary, strict?:boolean ):object
Assigns the data of the expanded JSON-LD object to the target object in a friendly mode. i.e. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.
Param | Type | Default | Description |
---|---|---|---|
expandedObject | object | The JSON-LD object to compact. | |
targetObject | object | The target object where will be added the compact data of the expanded object. | |
digestedSchema | DigestedObjectSchema | The schema that describes how compact the expanded object. | |
pointerLibrary | PointerLibrary | $PointerLibrary | An object from where one can obtain the pointers of resources. | |
strict | boolean | Flag to ignore the compaction of properties that are not defined in the schema. |
compact( expandedObjects:object[], digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary ):object[]
Assigns the data of the expanded JSON-LD objects into new objects in a friendly mode. i.e. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.
Param | Type | Default | Description |
---|---|---|---|
expandedObjects | object[] | The JSON-LD objects to compact. | |
digestedSchema | DigestedObjectSchema | The schema that describes how compact the expanded object. | |
pointerLibrary | PointerLibrary | $PointerLibrary | An object from where one can obtain the pointers of resources. |
compact( expandedObject:object, digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary ):object
Assigns the data of the expanded JSON-LD object into a new object in a friendly mode. i.e. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.
Param | Type | Default | Description |
---|---|---|---|
expandedObject | object | The JSON-LD object to compact. | |
digestedSchema | DigestedObjectSchema | The schema that describes how compact the expanded object. | |
pointerLibrary | PointerLibrary | $PointerLibrary | An object from where one can obtain the pointers of resources. |
.expand() : any
expand( compactedObjects:object[], generalSchema:DigestedObjectSchema, digestedSchema:DigestedObjectSchema ):RDFNode[]
Creates an expanded JSON-LD object from the compacted objects in accordance to the schema provided.
Param | Type | Default | Description |
---|---|---|---|
compactedObjects | object[] | The compacted resources to expand. | |
generalSchema | DigestedObjectSchema | The general schema that applies to any compacted resource. | |
digestedSchema | DigestedObjectSchema | The specific schema that applies to the compacted resources. |
expand( compactedObject:object, generalSchema:DigestedObjectSchema, digestedSchema:DigestedObjectSchema ):RDFNode
Creates an expanded JSON-LD object from the compacted object in accordance to the schema provided.
Param | Type | Default | Description |
---|---|---|---|
compactedObject | object | The compacted resource to expand. | |
generalSchema | DigestedObjectSchema | The general schema that applies to any compacted resource. | |
digestedSchema | DigestedObjectSchema | The specific schema that applies to the compacted resource. |
.update() : void
update( target:object, node:RDFNode, digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary, strict?:boolean ):void
Compacts and updates the data of the expanded JSON-LD object into the target object. i.e. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.
Param | Type | Default | Description |
---|---|---|---|
target | object | Object to be updated from the expanded one. | |
node | RDFNode | The expanded object to be compacted and updated into the target | |
digestedSchema | DigestedObjectSchema | The schema that describes how compact the expanded object. | |
pointerLibrary | PointerLibrary | $PointerLibrary | An object from where one can obtain the pointers of resources. | |
strict | boolean | Flag to ignore the compaction of properties that are not defined in the schema. |
Parser that normalises JSON-LD objects into a complete expanded form.
Methods
.parse() : Promise<object[]>
parse( input:string ):Promise<object[]>
Parse the string provided using the CarbonLDP.JSONLD.JSONLDProcessor#expand
` method.
Param | Type | Default | Description |
---|---|---|---|
input | string | The JSON-LD string to parse. |
Service that has methods to process JSON-LD objects.
Methods
#__addValue() : void
__addValue( element:Object, propertyName:string, value:any, options:{ propertyIsArray: boolean; } ):void
Param | Type | Default | Description |
---|---|---|---|
element | Object | ||
propertyName | string | ||
value | any | ||
options | { propertyIsArray: boolean; } |
#__compareValues() : boolean
__compareValues( value1:any, value2:any ):boolean
Param | Type | Default | Description |
---|---|---|---|
value1 | any | ||
value2 | any |
#__expandLanguageMap() : any
__expandLanguageMap( languageMap:any ):any
Param | Type | Default | Description |
---|---|---|---|
languageMap | any |
#__expandURI() : string
__expandURI( schema:DigestedObjectSchema, uri:string, relativeTo?:{ vocab?: boolean; base?: boolean; } ):string
Param | Type | Default | Description |
---|---|---|---|
schema | DigestedObjectSchema | ||
uri | string | ||
relativeTo | { vocab?: boolean; base?: boolean; } |
#__expandValue() : any
__expandValue( context:DigestedObjectSchema, value:any, propertyName?:string ):any
Param | Type | Default | Description |
---|---|---|---|
context | DigestedObjectSchema | ||
value | any | ||
propertyName | string |
#__findContextURLs() : boolean
__findContextURLs( input:Object, contexts:{ [index: string]: any; }, base:string, replace:boolean ):boolean
Param | Type | Default | Description |
---|---|---|---|
input | Object | ||
contexts | { [index: string]: any; } | ||
base | string | ||
replace | boolean |
#__getContainer() : CarbonLDP.ContainerType | null
__getContainer( context:DigestedObjectSchema, property?:string ):ContainerType | null
Param | Type | Default | Description |
---|---|---|---|
context | DigestedObjectSchema | ||
property | string |
#__getTargetFromLinkHeader() : string | undefined
__getTargetFromLinkHeader( header:Header ):string | undefined
Param | Type | Default | Description |
---|---|---|---|
header | Header |
#__hasProperty() : boolean
__hasProperty( element:Object, propertyName:string ):boolean
Param | Type | Default | Description |
---|---|---|---|
element | Object | ||
propertyName | string |
#__hasValue() : boolean
__hasValue( element:Object, propertyName:string, value:any ):boolean
Param | Type | Default | Description |
---|---|---|---|
element | Object | ||
propertyName | string | ||
value | any |
#__isKeyword() : boolean
__isKeyword( value?:string ):boolean
Param | Type | Default | Description |
---|---|---|---|
value | string |
#__isValidType() : boolean
__isValidType( value:any ):boolean
Param | Type | Default | Description |
---|---|---|---|
value | any |
#__process() : object | null
__process( context:DigestedObjectSchema, element:object, activeProperty?:string, insideList?:boolean ):object | null
Param | Type | Default | Description |
---|---|---|---|
context | DigestedObjectSchema | ||
element | object | ||
activeProperty | string | ||
insideList | boolean |
#__retrieveContexts() : Promise<void>
__retrieveContexts( input:Object, contextsRequested:{ [index: string]: boolean; }, base:string ):Promise<void>
Param | Type | Default | Description |
---|---|---|---|
input | Object | ||
contextsRequested | { [index: string]: boolean; } | ||
base | string |
#expand() : Promise<object[]>
expand( input:object ):Promise<object[]>
Expands a compact JSON-LD object. This expansion understands local or remotes @context
entities.
Param | Type | Default | Description |
---|---|---|---|
input | object | The JSON-LD object to expand. |
carbonldp/LDP Module
Interfaces
c:AddMemberAction
. CarbonLDP.LDP.AddMemberAction
. CarbonLDP.LDP.AddMemberAction
. CarbonLDP.LDP.TransientDirectContainer
. CarbonLDP.LDP.RemoveMemberAction
. ldp:DirectContainer
. CarbonLDP.LDP.DirectContainer
. c:DocumentMetadata
. CarbonLDP.LDP.DocumentMetadata
. c:Error
. CarbonLDP.LDP.Error
. c:ErrorResponse
. CarbonLDP.LDP.ErrorResponse
. c:Map
. c:Map
. CarbonLDP.LDP.MapEntry
. CarbonLDP.LDP.Map
. c:RemoveMemberAction
. CarbonLDP.LDP.RemoveMemberAction
. c:ResponseMetadata
. CarbonLDP.LDP.ResponseMetadata
. ldp:DirectContainer
. CarbonLDP.LDP.TransientDirectContainer
. c:ValidationError
. CarbonLDP.LDP.ValidationError
. c:VolatileResource
. CarbonLDP.LDP.VolatileResource
. Properties
#AddMemberAction : CarbonLDP.LDP.AddMemberActionFactory
Constant that implements CarbonLDP.LDP.AddMemberActionFactory
.
#DirectContainer : CarbonLDP.LDP.DirectContainerFactory
Constant that implements CarbonLDP.LDP.DirectContainerFactory
.
#DocumentMetadata : CarbonLDP.LDP.DocumentMetadataFactory
Constant that implements CarbonLDP.LDP.DocumentMetadataFactory
.
#Error : CarbonLDP.LDP.ErrorFactory
Constant that implements CarbonLDP.LDP.ErrorFactory
.
#ErrorResponse : CarbonLDP.LDP.ErrorResponseFactory
Constant that implements CarbonLDP.LDP.ErrorResponseFactory
.
#Map : CarbonLDP.LDP.MapFactory
Constant that implements CarbonLDP.LDP.MapFactory
.
#MapEntry : CarbonLDP.LDP.MapEntryFactory
Constant the implements CarbonLDP.LDP.MapEntryFactory
.
#RemoveMemberAction : CarbonLDP.LDP.RemoveMemberActionFactory
Constant that implements CarbonLDP.LDP.RemoveMemberActionFactory
.
#ResponseMetadata : CarbonLDP.LDP.ResponseMetadataFactory
Constant that implements CarbonLDP.LDP.ResponseMetadataFactory
.
#TransientDirectContainer : CarbonLDP.LDP.TransientDirectContainerFactory
Constant that implements CarbonLDP.LDP.TransientDirectContainerFactory
.
#ValidationError : CarbonLDP.LDP.ValidationErrorFactory
Constant that implements CarbonLDP.LDP.ValidationErrorFactory
.
#VolatileResource : CarbonLDP.LDP.VolatileResourceFactory
Constant that implements CarbonLDP.LDP.VolatileResourceFactory
.
CarbonLDP.LDP.AddMemberAction Interface
Model that represents a c:AddMemberAction
. This model is used as a request body for adding members.
Properties
.targetMembers : CarbonLDP.Pointer[]
Resources to add as members.
CarbonLDP.LDP.AddMemberActionFactory Interface
Factory, decorator and utils for CarbonLDP.LDP.AddMemberAction
.
Properties
Methods
.create() : T & CarbonLDP.LDP.AddMemberAction
create<T extends object>( data:T & BaseAddMemberAction ):T & AddMemberAction
Param | Type | Default | Description |
---|---|---|---|
data | T & BaseAddMemberAction |
.createFrom() : T & CarbonLDP.LDP.AddMemberAction
createFrom<T extends object>( data:T & BaseAddMemberAction ):T & AddMemberAction
Param | Type | Default | Description |
---|---|---|---|
data | T & BaseAddMemberAction |
.is() : value is CarbonLDP.LDP.AddMemberAction
is( value:any ):value is AddMemberAction
Param | Type | Default | Description |
---|---|---|---|
value | any |
CarbonLDP.LDP.BaseAddMemberAction Interface
Base properties for a CarbonLDP.LDP.AddMemberAction
.
Properties
.targetMembers : CarbonLDP.Pointer[]
The resources to be added as members.
CarbonLDP.LDP.BaseDirectContainer Interface
Base properties for a CarbonLDP.LDP.TransientDirectContainer
.
Properties
.hasMemberRelation : string | CarbonLDP.Pointer
The relation the direct container will manage.
.isMemberOfRelation : string | CarbonLDP.Pointer
The optional inverted relation the direct container will manage.
.membershipResource : CarbonLDP.Pointer
The resource the direct container belongs to.
CarbonLDP.LDP.BaseRemoveMemberAction Interface
Base properties for a CarbonLDP.LDP.RemoveMemberAction
.
Properties
.targetMembers : CarbonLDP.Pointer[]
The resources to be removed as members.
CarbonLDP.LDP.DirectContainer Interface
Model that represents a ldp:DirectContainer
.
CarbonLDP.LDP.DirectContainerFactory Interface
Factory, decorator and utils for CarbonLDP.LDP.DirectContainer
.
Properties
.TYPE : CarbonLDP.LDP.TransientDirectContainerFactory["TYPE"]
.create : CarbonLDP.LDP.TransientDirectContainerFactory["create"]
.createFrom : CarbonLDP.LDP.TransientDirectContainerFactory["createFrom"]
Methods
.is() : value is CarbonLDP.LDP.DirectContainer
is( value:any ):value is DirectContainer
Param | Type | Default | Description |
---|---|---|---|
value | any |
CarbonLDP.LDP.DocumentMetadata Interface
Model that represents a c:DocumentMetadata
. This model contains volatile information about an specific resource.
Properties
.bNodesMap : CarbonLDP.LDP.Map<CarbonLDP.Pointer, CarbonLDP.Pointer>
c:Map
that contains the changed IDs when persisting BNodes.
.relatedDocument : CarbonLDP.Document
Resource the metadata refers to.
CarbonLDP.LDP.DocumentMetadataFactory Interface
CarbonLDP.LDP.Error Interface
Model that represents a c:Error
. This model is returned by the server when an error occurs.
Properties
.errorCode : string
Code that indicates the type of error ocurred.
.errorMessage : string
Message that explains the error.
.errorParameters : CarbonLDP.LDP.Map<string, any>
c:Map
that contains the specific elements that generated the error.
CarbonLDP.LDP.ErrorFactory Interface
CarbonLDP.LDP.ErrorResponse Interface
Model that represents a c:ErrorResponse
. This model is returned as the response of a request when any error occurs.
Properties
.errors : CarbonLDP.LDP.Error[]
Set of all the errors that the request generated.
.requestID : string
String that identifies the request that caused the error.
.statusCode : number
The HTTP status code for the general error of the request.
CarbonLDP.LDP.ErrorResponseFactory Interface
Factory, decorator and utils for CarbonLDP.LDP.ErrorResponse
.
Properties
Methods
.getMessage() : string
getMessage( errorResponse:ErrorResponse ):string
Param | Type | Default | Description |
---|---|---|---|
errorResponse | ErrorResponse |
.is() : value is CarbonLDP.LDP.ErrorResponse
is( value:any ):value is ErrorResponse
Param | Type | Default | Description |
---|---|---|---|
value | any |
CarbonLDP.LDP.Map Interface
Model that represents a c:Map
. This model contains a set of entries in a form of a key/value pair.
Properties
.entries : CarbonLDP.LDP.MapEntry<K, V>[]
Array of the entries's pairs.
CarbonLDP.LDP.MapEntry Interface
Model that represents an entry of a c:Map
.
Properties
.entryKey : K
The key element of the entry's pair.
.entryValue : V
The value element of the entry's pair.
CarbonLDP.LDP.MapEntryFactory Interface
CarbonLDP.LDP.MapFactory Interface
Factory, decorator and utils for CarbonLDP.LDP.Map
.
Properties
Methods
.is() : object is CarbonLDP.LDP.Map<any, any>
is( object:object ):object is Map<any, any>
Param | Type | Default | Description |
---|---|---|---|
object | object |
CarbonLDP.LDP.RemoveMemberAction Interface
Model that represents a c:RemoveMemberAction
. This model is used as a request body for removing members.
Properties
.targetMembers : CarbonLDP.Pointer[]
The resources to remove as members.
CarbonLDP.LDP.RemoveMemberActionFactory Interface
Factory, decorator and utils for CarbonLDP.LDP.RemoveMemberAction
.
Properties
Methods
.create() : T & CarbonLDP.LDP.RemoveMemberAction
create<T extends object>( data:T & BaseRemoveMemberAction ):T & RemoveMemberAction
Param | Type | Default | Description |
---|---|---|---|
data | T & BaseRemoveMemberAction |
.createFrom() : T & CarbonLDP.LDP.RemoveMemberAction
createFrom<T extends object>( object:T & BaseRemoveMemberAction ):T & RemoveMemberAction
Param | Type | Default | Description |
---|---|---|---|
object | T & BaseRemoveMemberAction |
.is() : value is CarbonLDP.LDP.RemoveMemberAction
is( value:any ):value is RemoveMemberAction
Param | Type | Default | Description |
---|---|---|---|
value | any |
CarbonLDP.LDP.ResponseMetadata Interface
Model that represents a c:ResponseMetadata
. This model is returned in the response of a request when volatile metadata needs to be returned.
Properties
.documentsMetadata : CarbonLDP.LDP.DocumentMetadata[]
Array with metadata of resources affected by the request.
CarbonLDP.LDP.ResponseMetadataFactory Interface
Factory, decorator and utils for CarbonLDP.LDP.ResponseMetadata
.
Properties
Methods
.is() : object is CarbonLDP.LDP.ResponseMetadata
is( object:object ):object is ResponseMetadata
Param | Type | Default | Description |
---|---|---|---|
object | object |
CarbonLDP.LDP.TransientDirectContainer Interface
The in-memory model that represents a ldp:DirectContainer
.
Properties
.hasMemberRelation : CarbonLDP.Pointer
The relation the direct container will manage.
.membershipResource : CarbonLDP.Pointer
The resource the direct container belongs to.
Factory, decorator and utils for CarbonLDP.LDP.TransientDirectContainer
.
Properties
Methods
.create() : T & CarbonLDP.LDP.TransientDirectContainer
create<T extends object>( data:T & BaseDirectContainer ):T & TransientDirectContainer
Param | Type | Default | Description |
---|---|---|---|
data | T & BaseDirectContainer |
.createFrom() : T & CarbonLDP.LDP.TransientDirectContainer
createFrom<T extends object>( object:T & BaseDirectContainer ):T & TransientDirectContainer
Param | Type | Default | Description |
---|---|---|---|
object | T & BaseDirectContainer |
.is() : value is CarbonLDP.LDP.TransientDirectContainer
is( value:any ):value is TransientDirectContainer
Param | Type | Default | Description |
---|---|---|---|
value | any |
CarbonLDP.LDP.ValidationError Interface
Model that represents a c:ValidationError
. This model is used in a c:Error
when that error was caused by a failed SHACL validation.
Properties
.errorDetails : CarbonLDP.SHACL.ValidationReport
Object with a report of the failed validation.
CarbonLDP.LDP.ValidationErrorFactory Interface
CarbonLDP.LDP.VolatileResource Interface
Model that represents a c:VolatileResource
. This model represents a free resource that was dynamically generated.
CarbonLDP.LDP.VolatileResourceFactory Interface
Factory, decorator and utils for CarbonLDP.LDP.VolatileResource
.
Properties
Methods
.create() : T & CarbonLDP.LDP.VolatileResource
create<T extends object>( data?:T ):T & VolatileResource
Param | Type | Default | Description |
---|---|---|---|
data | T |
.createFrom() : T & CarbonLDP.LDP.VolatileResource
createFrom<T extends object>( object:T ):T & VolatileResource
Param | Type | Default | Description |
---|---|---|---|
object | T |
.is() : value is CarbonLDP.LDP.VolatileResource
is( value:any ):value is VolatileResource
Param | Type | Default | Description |
---|---|---|---|
value | any |
carbonldp/LDPatch Module
Classes
Type Aliases
Token for defining a LD Patch add statement.
Constructor
AddToken()
Properties
Methods
.toString() : string
toString():string
Token for defining a LD Patch delete statement.
Constructor
DeleteToken()
Properties
Methods
.toString() : string
toString():string
Creates a LD Patch delta for the resources provided.
Constructor
DeltaCreator( context:Context<RegisteredPointer, ResolvablePointer> )
Creates the instant with the provided context as the addition data source.
Param | Type | Default | Description |
---|---|---|---|
context | Context<RegisteredPointer, ResolvablePointer> | The context of the resources to create its LD Patch delta. |
Properties
.addToken : CarbonLDP.LDPatch.AddToken
.context : CarbonLDP.Context
.deleteToken : CarbonLDP.LDPatch.DeleteToken
.prefixesMap : Map<string, CarbonLDP.LDPatch.PrefixToken>
.updateLists : CarbonLDP.LDPatch.UpdateListToken[]
Methods
.__addPrefixFrom() : void
__addPrefixFrom( object:VariableToken | IRIRefToken | PrefixedNameToken | RDFLiteralToken | LiteralToken | BlankNodeToken | CollectionToken | BlankNodePropertyToken | "a" | PathNegatedToken | ... 4 more ... | PathAlternativeToken<...>, schema:DigestedObjectSchema ):void
Param | Type | Default | Description |
---|---|---|---|
object | VariableToken | IRIRefToken | PrefixedNameToken | RDFLiteralToken | LiteralToken | BlankNodeToken | CollectionToken | BlankNodePropertyToken | "a" | PathNegatedToken | ... | ||
schema | DigestedObjectSchema |
.__compactIRI() : IRIToken
__compactIRI( schema:DigestedObjectSchema, iri:string ):IRIToken
Param | Type | Default | Description |
---|---|---|---|
schema | DigestedObjectSchema | ||
iri | string |
.__expandLanguageMap() : ObjectToken[]
__expandLanguageMap( values:any[], schema:DigestedObjectSchema ):ObjectToken[]
Param | Type | Default | Description |
---|---|---|---|
values | any[] | ||
schema | DigestedObjectSchema |
.__expandLiteral() : LiteralToken | null
__expandLiteral( value:any, schema:DigestedObjectSchema, definition?:DigestedObjectSchemaProperty ):LiteralToken | null
Param | Type | Default | Description |
---|---|---|---|
value | any | ||
schema | DigestedObjectSchema | ||
definition | DigestedObjectSchemaProperty |
.__expandPointer() : IRIToken | BlankNodeToken | null
__expandPointer( value:any, schema:DigestedObjectSchema ):IRIToken | BlankNodeToken | null
Param | Type | Default | Description |
---|---|---|---|
value | any | ||
schema | DigestedObjectSchema |
.__expandValues() : ObjectToken[]
__expandValues( values:any[], schema:DigestedObjectSchema, definition?:DigestedObjectSchemaProperty ):ObjectToken[]
Param | Type | Default | Description |
---|---|---|---|
values | any[] | ||
schema | DigestedObjectSchema | ||
definition | DigestedObjectSchemaProperty |
.__getObjects() : ObjectToken[]
__getObjects( value:any, schema:DigestedObjectSchema, definition?:DigestedObjectSchemaProperty ):ObjectToken[]
Param | Type | Default | Description |
---|---|---|---|
value | any | ||
schema | DigestedObjectSchema | ||
definition | DigestedObjectSchemaProperty |
.__getSchema() : CarbonLDP.DigestedObjectSchema
__getSchema( $id:string, previousResource:Partial<Pick<Resource, "types"> & Pick<QueryablePointer, "$_queryableMetadata">>, currentResource:Partial<Pick<Resource, "types"> & Pick<QueryablePointer, "$_queryableMetadata">> ):DigestedObjectSchema
Param | Type | Default | Description |
---|---|---|---|
$id | string | ||
previousResource | Partial<Pick<Resource, "types"> & Pick<QueryablePointer, "$_queryableMetadata">> | ||
currentResource | Partial<Pick<Resource, "types"> & Pick<QueryablePointer, "$_queryableMetadata">> |
._getPropertyIRI() : IRIToken
_getPropertyIRI( schema:DigestedObjectSchema, propertyName:string ):IRIToken
Param | Type | Default | Description |
---|---|---|---|
schema | DigestedObjectSchema | ||
propertyName | string |
.addResource() : void
addResource( id:string, previousResource:object, currentResource:object ):void
Add the resources states (previousResource and currentResource) from where to create the delta.
Param | Type | Default | Description |
---|---|---|---|
id | string | The URI of the resource been added. | |
previousResource | object | The previous state of the resource to compare for its delta. | |
currentResource | object | The current state of the resource to compare for its delta. |
.getPatch() : string
getPatch():string
Returns the LD Patch string of the resources set in CarbonLDP.LDPatch.DeltaCreator.addResource
.
Token for defining an LD Patch expression.
Constructor
LDPatchToken()
Properties
.prologues : CarbonLDP.LDPatch.PrefixToken[]
.statements : CarbonLDP.LDPatch.StatementToken[]
.token : "ldpatch"
Methods
.toString() : string
toString():string
Token for defining a LD Patch prefix statement.
Constructor
PrefixToken( namespace:string, iri:IRIToken )
Param | Type | Default | Description |
---|---|---|---|
namespace | string | ||
iri | IRIToken |
Properties
Methods
.toString() : string
toString():string
Token for defining a LD Patch slice expression of a update list statement.
Constructor
SliceToken( minIndex?:number, maxIndex?:number )
Param | Type | Default | Description |
---|---|---|---|
minIndex | number | ||
maxIndex | number |
Properties
Methods
.toString() : string
toString():string
CarbonLDP.LDPatch.StatementToken Type Alias
The tokens that states a change in the data.
Used in the CarbonLDP.LDPatch.LDPatchToken.statements
.
type StatementToken = AddToken | DeleteToken | UpdateListToken
Token for defining a LD Patch update list statement.
Constructor
UpdateListToken( subject:VariableToken | IRIRefToken | PrefixedNameToken | BlankNodeToken, predicate:IRIToken, slice:SliceToken, collection:CollectionToken )
Param | Type | Default | Description |
---|---|---|---|
subject | VariableToken | IRIRefToken | PrefixedNameToken | BlankNodeToken | ||
predicate | IRIToken | ||
slice | SliceToken | ||
collection | CollectionToken |
Properties
.collection : CollectionToken
.predicate : IRIToken
.slice : CarbonLDP.LDPatch.SliceToken
.subject : VariableOrIRIToken | BlankNodeToken
.token : "updateList"
Methods
.toString() : string
toString():string
carbonldp/Messaging Module
Classes
Interfaces
c:ChildCreatedEvent
. CarbonLDP.Messaging.ChildCreatedEvent
. c:DocumentCreatedEventDetails
. CarbonLDP.Messaging.DocumentCreatedEventDetails
. c:DocumentDeletedEvent
. CarbonLDP.Messaging.DocumentDeletedEvent
. c:DocumentModifiedEvent
. CarbonLDP.Messaging.DocumentModifiedEvent
. CarbonLDP.Messaging.EventMessage
. c:MemberAddedEvent
. c:MemberAddedEventDetails
. CarbonLDP.Messaging.MemberAddedEventDetails
. CarbonLDP.Messaging.MemberAddedEvent
. CarbonLDP.Messaging.MemberAddedEventDetails
and CarbonLDP.Messaging.MemberRemovedEventDetails
models. CarbonLDP.Messaging.MemberEventDetails
. c:MemberRemovedEvent
. c:MemberRemovedEventDetails
. CarbonLDP.Messaging.MemberRemovedEventDetails
. CarbonLDP.Messaging.MemberRemovedEvent
. .Event : enum
Enum with the base events in the platform.
Enumeration | Description |
---|---|
CarbonLDP.Messaging.Event.CHILD_CREATED | |
CarbonLDP.Messaging.Event.DOCUMENT_MODIFIED | |
CarbonLDP.Messaging.Event.DOCUMENT_DELETED | |
CarbonLDP.Messaging.Event.MEMBER_ADDED | |
CarbonLDP.Messaging.Event.MEMBER_REMOVED |
Properties
#ChildCreatedEvent : CarbonLDP.Messaging.ChildCreatedEventFactory
Constant that implements CarbonLDP.Messaging.ChildCreatedEventFactory
.
#DocumentCreatedEventDetails : CarbonLDP.Messaging.DocumentCreatedEventDetailsFactory
Constant that implements CarbonLDP.Messaging.DocumentCreatedEventDetailsFactory
.
#DocumentDeletedEvent : CarbonLDP.Messaging.DocumentDeletedEventFactory
Constant that implements CarbonLDP.Messaging.DocumentDeletedEventFactory
#DocumentModifiedEvent : CarbonLDP.Messaging.DocumentModifiedEventFactory
Constant that implements CarbonLDP.Messaging.DocumentModifiedEventFactory
.
#EventMessage : CarbonLDP.Messaging.EventMessageFactory
Constant that implements CarbonLDP.Messaging.EventMessageFactory
.
#MemberAddedEvent : CarbonLDP.Messaging.MemberAddedEventFactory
Constant that implements CarbonLDP.Messaging.MemberAddedEventFactory
.
#MemberAddedEventDetails : CarbonLDP.Messaging.MemberAddedEventDetailsFactory
Constant that implements CarbonLDP.Messaging.MemberAddedEventDetailsFactory
.
#MemberEventDetails : CarbonLDP.Messaging.MemberEventDetailsFactory
Constant that implements CarbonLDP.Messaging.MemberEventDetailsFactory
.
#MemberRemovedEvent : CarbonLDP.Messaging.MemberRemovedEventFactory
Constant that implements CarbonLDP.Messaging.MemberRemovedEventFactory
.
#MemberRemovedEventDetails : CarbonLDP.Messaging.MemberRemovedEventDetailsFactory
Constant that implements CarbonLDP.Messaging.MemberRemovedEventDetailsFactory
.
Methods
#_createDestination() : string
_createDestination( event:string, uriPattern:string, baseURI:string ):string
Creates a complete AMQP path to use as the destination of a subscription.
Param | Type | Default | Description |
---|---|---|---|
event | string | The event target to subscribe. | |
uriPattern | string | The URI pattern to subscribe. | |
baseURI | string | The base URI ro remove from an absolute URI pattern. |
#_parseURIPattern() : string
_parseURIPattern( uriPattern:string, baseURI:string ):string
Parses an URI pattern into the form of a AMQP path.
Param | Type | Default | Description |
---|---|---|---|
uriPattern | string | The URI pattern to parse. | |
baseURI | string | The base URI to remove from an absolute URI pattern since the AMQP requires a relative path. |
#_validateEventType() : void
_validateEventType( event:string ):void
Throws an error when an invalid event is provided.
Param | Type | Default | Description |
---|---|---|---|
event | string | The event to check. |
CarbonLDP.Messaging.ChildCreatedEvent Interface
Model that represents a c:ChildCreatedEvent
.
Properties
.details : CarbonLDP.Messaging.DocumentCreatedEventDetails
Object with the child that was created.
Model that represents a c:DocumentCreatedEventDetails
.
Properties
.createdDocuments : CarbonLDP.Document[]
Set of the created documents.
CarbonLDP.Messaging.DocumentDeletedEvent Interface
Model that represents a c:DocumentDeletedEvent
.
Model that represents a c:DocumentModifiedEvent
.
CarbonLDP.Messaging.EventMessage Interface
Base model for every notification message in a subscription event.
Properties
.target : CarbonLDP.Document
Target document where the event occurred.
CarbonLDP.Messaging.EventMessageFactory Interface
Factory, decorator and utils for CarbonLDP.Messaging.EventMessage
.
Properties
Methods
.is() : value is CarbonLDP.Messaging.EventMessage
is( value:any ):value is EventMessage
Param | Type | Default | Description |
---|---|---|---|
value | any |
CarbonLDP.Messaging.MemberAddedEvent Interface
Model that represents a c:MemberAddedEvent
.
Properties
.details : CarbonLDP.Messaging.MemberAddedEventDetails
Object with the members added.
Model that represents a c:MemberAddedEventDetails
.
CarbonLDP.Messaging.MemberEventDetails Interface
Base model or the CarbonLDP.Messaging.MemberAddedEventDetails
and CarbonLDP.Messaging.MemberRemovedEventDetails
models.
Properties
.members : CarbonLDP.Document[]
The affected members of the event.
CarbonLDP.Messaging.MemberRemovedEvent Interface
Model that represents a c:MemberRemovedEvent
.
Properties
.details : CarbonLDP.Messaging.MemberRemovedEventDetails
Object with the members removed.
Model that represents a c:MemberRemovedEventDetails
.
CarbonLDP.Messaging.MessagingOptions Interface
Options to configure in the messaging service.
Properties
.maxReconnectAttempts : number | null
The maximum numbers of reconnect attempts. Set to null
of you don't want to set a limit.
.reconnectDelay : number
The milliseconds of wait to the next reconnection attempt.
Service that manages the messaging client, connecting and subscriptions.
Constructor
MessagingService( context:DocumentsContext )
Param | Type | Default | Description |
---|---|---|---|
context | DocumentsContext |
Properties
._attempts : number
._client : webstomp.Client
._options : CarbonLDP.Messaging.MessagingOptions
._subscriptionsMap : Map<string, Map<(data: CarbonLDP.Messaging.EventMessage) => void, Subscription>>
._subscriptionsQueue : Function[]
.context : CarbonLDP.DocumentsContext
Methods
.__broadcastError() : void
__broadcastError( error:Error ):void
Param | Type | Default | Description |
---|---|---|---|
error | Error |
.__makeSubscription() : () => void
__makeSubscription( id:string, destination:string, eventCallback:(data: EventMessage) => void, errorCallback?:(error: Error) => void ):() => void
Param | Type | Default | Description |
---|---|---|---|
id | string | ||
destination | string | ||
eventCallback | (data: EventMessage) => void | ||
errorCallback | (error: Error) => void |
.__saveSubscriptions() : void
__saveSubscriptions():void
.connect() : void
connect( onConnect?:() => void, onError?:(error: Error) => void ):void
Connects to the platform's messaging broker. If the service is already connected, an error will be thrown.
Param | Type | Default | Description |
---|---|---|---|
onConnect | () => void | Callback to be invoked when the client has established a connection. It will be invoked again when a reconnection is been executed. | |
onError | (error: Error) => void | Callback to be invoked when a error has occurred in the connection or server. If none is provided, the errors will be broadcasted to every connected subscription. |
.reconnect() : void
reconnect( onConnect?:() => void, onError:(error: Error) => void ):void
Reconnects the service to the platform broker. If the service is already connected, it will be closed and opened again.
Param | Type | Default | Description |
---|---|---|---|
onConnect | () => void | Callback to be invoked when the client has established a connection. It will be invoked again when a reconnection is been executed. | |
onError | (error: Error) => void | Callback to be invoked when a error has occurred in the connection or server. If none is provided, the errors will be broadcasted to every connected subscription. |
.setOptions() : void
setOptions( options:MessagingOptions ):void
Updates the messaging service options.
If any property is no defined the default is used:
{
maxReconnectAttempts: 10,
reconnectDelay: 1000
}
Param | Type | Default | Description |
---|---|---|---|
options | MessagingOptions | The options to be updated. |
.subscribe() : void
subscribe( destination:string, onEvent:(data: EventMessage) => void, onError?:(error: Error) => void ):void
Subscribes to the destination provided.
Param | Type | Default | Description |
---|---|---|---|
destination | string | The destination to subscribe. | |
onEvent | (data: EventMessage) => void | Callback to be invoked in every notification and will be provided with the data message of the notification. | |
onError | (error: Error) => void | Callback to be invoked when a error has occurred in the subscription. |
.unsubscribe() : void
unsubscribe( destination:string, onEvent:(data: EventMessage) => void ):void
Removes the subscription set for the specific destination and onEvent callback.
Param | Type | Default | Description |
---|---|---|---|
destination | string | The destination of the subscription to remove. | |
onEvent | (data: EventMessage) => void | Callback used in the subscription to remove. |
carbonldp/Model Module
Interfaces
CarbonLDP.Model.ModelDecorator
. Properties
#ModelDecorator : CarbonLDP.Model.ModelDecoratorFactory
Constant that implements CarbonLDP.Model.ModelDecoratorFactory
.
#ModelSchema : { is(object: object): object is any; }
Constant with the utils for CarbonLDP.Model.ModelSchema
.
CarbonLDP.Model.ModelDecorator Interface
Interface with the methods of a model decoration.
Methods
.decorate() : W & MODEL
decorate<W extends object>( object:W & BASE ):W & MODEL
Decorates an object with the correct prototypes to create a model.
Param | Type | Default | Description |
---|---|---|---|
object | W & BASE | The object to decorate. |
.isDecorated() : object is MODEL
isDecorated( object:object ):object is MODEL
Returns true if the object provided has the decorated properties and methods of a model.
Param | Type | Default | Description |
---|---|---|---|
object | object | The object to check. |
CarbonLDP.Model.ModelDecoratorFactory Interface
Factory and utils for CarbonLDP.Model.ModelDecorator
.
Methods
.decorateMultiple() : O & M1
decorateMultiple<O extends B1, M1 extends object, B1 extends object>( object:O, model1:ModelDecorator<M1, B1> ):O & M1
Param | Type | Default | Description |
---|---|---|---|
object | O | ||
model1 | ModelDecorator<M1, B1> |
decorateMultiple<O extends B1 & Pick<B2, Exclude<keyof B2, keyof M1>>, M1 extends object, B1 extends object, M2 extends object, B2 extends object>( object:O, model1:ModelDecorator<M1, B1>, model2:ModelDecorator<M2, B2> ):O & M1 & M2
Param | Type | Default | Description |
---|---|---|---|
object | O | ||
model1 | ModelDecorator<M1, B1> | ||
model2 | ModelDecorator<M2, B2> |
decorateMultiple<O extends B1 & B2 & B3, M1 extends object, B1 extends object, M2 extends object, B2 extends object, M3 extends object, B3 extends object>( object:O, model1:ModelDecorator<M1, B1>, model2:ModelDecorator<M2, B2>, model3:ModelDecorator<M3, B3> ):O & M1 & M2 & M3
Param | Type | Default | Description |
---|---|---|---|
object | O | ||
model1 | ModelDecorator<M1, B1> | ||
model2 | ModelDecorator<M2, B2> | ||
model3 | ModelDecorator<M3, B3> |
decorateMultiple<O extends B1 & B2 & B3 & B4, M1 extends object, B1 extends object, M2 extends object, B2 extends object, M3 extends object, B3 extends object, M4 extends object, B4 extends object>( object:O, model1:ModelDecorator<M1, B1>, model2:ModelDecorator<M2, B2>, model3:ModelDecorator<M3, B3>, model4:ModelDecorator<M4, B4> ):O & M1 & M2 & M3 & M4
Param | Type | Default | Description |
---|---|---|---|
object | O | ||
model1 | ModelDecorator<M1, B1> | ||
model2 | ModelDecorator<M2, B2> | ||
model3 | ModelDecorator<M3, B3> | ||
model4 | ModelDecorator<M4, B4> |
decorateMultiple<O extends B1 & B2 & B3 & B4 & B5, M1 extends object, B1 extends object, M2 extends object, B2 extends object, M3 extends object, B3 extends object, M4 extends object, B4 extends object, M5 extends object, B5 extends object>( object:O, model1:ModelDecorator<M1, B1>, model2:ModelDecorator<M2, B2>, model3:ModelDecorator<M3, B3>, model4:ModelDecorator<M4, B4>, model5:ModelDecorator<M5, B5> ):O & M1 & M2 & M3 & M4 & M5
Param | Type | Default | Description |
---|---|---|---|
object | O | ||
model1 | ModelDecorator<M1, B1> | ||
model2 | ModelDecorator<M2, B2> | ||
model3 | ModelDecorator<M3, B3> | ||
model4 | ModelDecorator<M4, B4> | ||
model5 | ModelDecorator<M5, B5> |
decorateMultiple<O extends B1 & B2 & B3 & B4 & B5 & B6, M1 extends object, B1 extends object, M2 extends object, B2 extends object, M3 extends object, B3 extends object, M4 extends object, B4 extends object, M5 extends object, B5 extends object, M6 extends object, B6 extends object>( object:O, model1:ModelDecorator<M1, B1>, model2:ModelDecorator<M2, B2>, model3:ModelDecorator<M3, B3>, model4:ModelDecorator<M4, B4>, model5:ModelDecorator<M5, B5>, model6:ModelDecorator<M6, B6> ):O & M1 & M2 & M3 & M4 & M5 & M6
Param | Type | Default | Description |
---|---|---|---|
object | O | ||
model1 | ModelDecorator<M1, B1> | ||
model2 | ModelDecorator<M2, B2> | ||
model3 | ModelDecorator<M3, B3> | ||
model4 | ModelDecorator<M4, B4> | ||
model5 | ModelDecorator<M5, B5> | ||
model6 | ModelDecorator<M6, B6> |
.definePropertiesFrom() : O & P
definePropertiesFrom<P extends object, O extends object>( prototype:P, object:O ):O & P
Param | Type | Default | Description |
---|---|---|---|
prototype | P | ||
object | O |
.hasPropertiesFrom() : boolean
hasPropertiesFrom<P extends object, O extends object>( prototype:P, object:O ):boolean
Param | Type | Default | Description |
---|---|---|---|
prototype | P | ||
object | O |
CarbonLDP.Model.ModelFactory Interface
Interface with the standard methods for a model creation.
Methods
.create() : W & MODEL
create<W extends object>( data:W & BASE ):W & MODEL
Creates an object model with the provided data.
Param | Type | Default | Description |
---|---|---|---|
data | W & BASE | The data to create the model. |
.createFrom() : W & MODEL
createFrom<W extends object>( object:W & BASE ):W & MODEL
Creates an object model from the provided object.
Param | Type | Default | Description |
---|---|---|---|
object | W & BASE | The object with the base data to be converted into the model. |
CarbonLDP.Model.ModelFactoryOptional Interface
CarbonLDP.Model.ModelPrototype Interface
Interface with the property for describing a model prototype.
- The
MODEL
generic specifies the interface of the model - The
EXTENDED
has all the interfaces that the model is extending so the prototype has not to re-implements that methods - And the
OVERRIDDEN
one are the names of the methods the prototype must override/re-implement
Properties
.PROTOTYPE : Pick<MODEL, DiffKeys<MODEL, EXTENDED> | OVERRIDDEN>
The object with the properties/methods to use in the decoration of a model.
CarbonLDP.Model.ModelSchema Interface
Interface to define the pair TYPE/SCHEMA of a model.
Properties
.SCHEMA : CarbonLDP.ObjectSchema
The schema associated to the model.
.TYPE : T
The type associated to the model.
CarbonLDP.Model.ModelTypeGuard Interface
carbonldp/ObjectSchema Module
Classes
Interfaces
.ContainerType : enum
Types of property with multiple values..
Enumeration | Description |
---|---|
CarbonLDP.ContainerType.SET | |
CarbonLDP.ContainerType.LIST | |
CarbonLDP.ContainerType.LANGUAGE |
.PointerType : enum
Types a property that refers to a resource can be.
Enumeration | Description |
---|---|
CarbonLDP.PointerType.ID | |
CarbonLDP.PointerType.VOCAB |
Properties
#ObjectSchemaResolver : ObjectSchemaResolverFactory
Standardized schema that is used for the SDK for compact and expand JSON-LD objects.
Constructor
DigestedObjectSchema()
Properties
.base : string
The base URI of the schema.
.language : string | null
The default language of the string properties.
.prefixes : Map<string, string>
Map that contains the prefixes of absolutes URIs.
.properties : Map<string, CarbonLDP.DigestedObjectSchemaProperty>
Map that contains the definitions of the properties in the schema.
.vocab : string | undefined
URI that will be used to resolve relative URIs that aren't defined in the schema.
Methods
.getProperty() : CarbonLDP.DigestedObjectSchemaProperty | undefined
getProperty( name:string ):DigestedObjectSchemaProperty | undefined
Returns the definition of a property resolving internal URIs using the current schema configuration.
If no property exists with the name provided undefined
is returned.
Param | Type | Default | Description |
---|---|---|---|
name | string | Property name to return its definition. |
.resolveURI() : string | null
resolveURI( uri:string, relativeTo?:{ vocab?: boolean; base?: boolean; } ):string
Tries to resolve a non absolute URI using the schema and the configuration provided.
The configuration indicates if the vocab
or the base
URI must be used to resolve the URI; if both are set, the vocab
one takes preference before the base
-
Param | Type | Default | Description |
---|---|---|---|
uri | string | Relative URI to resolve. | |
relativeTo | { vocab?: boolean; base?: boolean; } | Object with flags indicating which resolution mode to use. |
resolveURI( uri:string, relativeTo?:{ vocab?: boolean; base?: boolean; } ):string | null
Tries to resolve a non absolute URI using the schema and the configuration provided.
The configuration indicates if the vocab
or the base
URI must be used to resolve the URI; if both are set, the vocab
one takes preference before the base
-
Param | Type | Default | Description |
---|---|---|---|
uri | string | Relative URI to resolve. | |
relativeTo | { vocab?: boolean; base?: boolean; } | Object with flags indicating which resolution mode to use. |
Standardized definition of a property in a schema.
Properties
.containerType : CarbonLDP.ContainerType | null
Type of container when the property contains multiple values. Will be null
when the property is not a multiple one.
.language : string | null
The language the property value is in.
.literal : boolean | null
Indicates if the property is a literal or not.
.literalType : string | null
The type of literal the property is. Will be null
when the property is not a literal.
.pointerType : CarbonLDP.PointerType | null
Type of pointer the property value is related.
.uri : string | null
The URI that represents the property.
CarbonLDP.ObjectSchema Interface
Interface that represents an schema based in the JSON-LD contexts.
This is used to convert from the JSON-LD stored in the server to the resources used in the SDK and viceversa.
Properties
.@base : string | null
An absolute URI that is used to resolve relative URIs. If it's set to null
, this will invalidate the usage of a previous @base
value.
.@index : object
[Not Supported] This element is ignored.
.@language : string | null
The default language of the string properties.
.@reverse : object
[Not Supported] This element is ignored.
.@vocab : string | null
An absolute URI that is used to as the common prefix for all the relative properties. If it's set to null
, this will invalidate the usage of a previous @vocab
value.
.[ name: string ] : string | CarbonLDP.ObjectSchemaProperty | undefined | null
This index can be interpreted in two forms: prefix or property.
Prefix
- When the value is as string. The key is taken the prefix name and the string value must be an absolute URI.
Property
- When the value is of type
CarbonLDP.ObjectSchemaProperty
. The key is taken as the property name and theCarbonLDP.ObjectSchemaProperty
must be a valid definition.
Service with static methods to standardize a JSON-LD Context Schema.
Methods
#_combineSchemas() : CarbonLDP.DigestedObjectSchema
_combineSchemas( digestedSchemas:DigestedObjectSchema[] ):DigestedObjectSchema
Actual implementation of the schema combination. This method uses the first schema as the target schema where to combine the data.
Param | Type | Default | Description |
---|---|---|---|
digestedSchemas | DigestedObjectSchema[] | The schemas to combine. |
#_digestSchema() : CarbonLDP.DigestedObjectSchema
_digestSchema( schema:ObjectSchema ):DigestedObjectSchema
Actual implementation of the standardization of a schema.
Param | Type | Default | Description |
---|---|---|---|
schema | ObjectSchema | The schema to process. |
#combineDigestedObjectSchemas() : CarbonLDP.DigestedObjectSchema
combineDigestedObjectSchemas( digestedSchemas:DigestedObjectSchema[] ):DigestedObjectSchema
Combines several standardized schemas into one.
Param | Type | Default | Description |
---|---|---|---|
digestedSchemas | DigestedObjectSchema[] | The schemas to combine. |
#digestProperty() : CarbonLDP.DigestedObjectSchemaProperty
digestProperty( name:string, definition:ObjectSchemaProperty, digestedSchema?:DigestedObjectSchema ):DigestedObjectSchemaProperty
Processes a schema property definition before using it.
Param | Type | Default | Description |
---|---|---|---|
name | string | The name of the property. | |
definition | ObjectSchemaProperty | The definition object of the property. | |
digestedSchema | DigestedObjectSchema | Optional schema used to resolve relative URIs in the definition. |
#digestSchema() : CarbonLDP.DigestedObjectSchema
digestSchema( schema:ObjectSchema ):DigestedObjectSchema
Processes a schema to standardize it before using it.
Param | Type | Default | Description |
---|---|---|---|
schema | ObjectSchema | The object schema to process. |
digestSchema( schemas:ObjectSchema[] ):DigestedObjectSchema
Processes multiple schemas into a single one to standardize it before using it.
Param | Type | Default | Description |
---|---|---|---|
schemas | ObjectSchema[] | The object schemas to process. |
CarbonLDP.ObjectSchemaProperty Interface
Interface that defines the property of a schema.
Properties
.@container : string
If the property is multiple it can be of tree types:
@set
: An unsorted array of elements.@list
: A sorted array of elements@language
: A string property with multiple languages tags.
.@id : string
The URI of the property in the JSON-LD which is mapped to the key name where the definition is referred.
.@language : string | null
The language the string property value has.
.@type : string
The type of values the property have. This can be set to "@id"
for pointers, or a CarbonLDP.Vocabularies.XSD
type for literals.
CarbonLDP.ObjectSchemaResolver Interface
Interface that defines the methods needed for an element that can provide object schemas.
Properties
.context : CarbonLDP.Context
Optional context where to obtain the contexts.
Methods
.getGeneralSchema() : CarbonLDP.DigestedObjectSchema
getGeneralSchema():DigestedObjectSchema
Returns the general object schema that applies to all the resources.
.getSchemaFor() : CarbonLDP.DigestedObjectSchema
getSchemaFor( object:object, path?:string ):DigestedObjectSchema
Returns the specific object schema that applies to the object provided.
Param | Type | Default | Description |
---|---|---|---|
object | object | The object to look for its associated schema. | |
path | string |
.hasSchemaFor() : boolean
hasSchemaFor( object:object, path?:string ):boolean
Returns true if the object provided has an specific schema for.
Param | Type | Default | Description |
---|---|---|---|
object | object | The object to check if it has any associated schema. | |
path | string |
Service with useful static methods that helps with schemas.
Methods
#_resolveProperty() : CarbonLDP.DigestedObjectSchemaProperty
_resolveProperty( schema:DigestedObjectSchema, definition:DigestedObjectSchemaProperty, inSame?:boolean ):DigestedObjectSchemaProperty
Resolves relative URIs of a property definition using the specified schema.
Param | Type | Default | Description |
---|---|---|---|
schema | DigestedObjectSchema | The schema to use for URI resolutions. | |
definition | DigestedObjectSchemaProperty | The definition of the property to resolve. | |
inSame | boolean | Flag to indicate if to mutate the same definition or return a copy of it. |
carbonldp/Pointer Module
Interfaces
CarbonLDP.Pointer
. CarbonLDP.Pointer
. Properties
#Pointer : CarbonLDP.PointerFactory
Constant that implements CarbonLDP.PointerFactory
.
Methods
#_getPointer() : CarbonLDP.Pointer
_getPointer( pointerLibrary:PointerLibrary | $PointerLibrary, id:string ):Pointer
Returns the pointer references by the URI provided using the specified pointer library.
Param | Type | Default | Description |
---|---|---|---|
pointerLibrary | PointerLibrary | $PointerLibrary | Any type of pointer library from where to get the requested pointer. | |
id | string | The URI of the pointer to get/create. |
CarbonLDP.$PointerLibrary Interface
Interface with methods to manage pointers in models.
Methods
.$getPointer() : CarbonLDP.Pointer
$getPointer( id:string ):Pointer
Returns the pointer referenced by the URI provided. If none exists, an empty new pointer will be created.
Param | Type | Default | Description |
---|---|---|---|
id | string | The URI of the pointer to get/create. |
.$hasPointer() : boolean
$hasPointer( id:string ):boolean
Returns true if the model has a pointer referenced by the URI provided.
Param | Type | Default | Description |
---|---|---|---|
id | string | The URI of the pointer to check. |
CarbonLDP.$PointerValidator Interface
Interface with methods to validate pointers in models.
Methods
.$inScope() : boolean
$inScope( idOrPointer:string | Pointer ):boolean
Returns true if the pointer provided is in the scope of the current model.
Param | Type | Default | Description |
---|---|---|---|
idOrPointer | string | Pointer | The ID or pointer to check. |
CarbonLDP.BasePointer Interface
Base properties for a CarbonLDP.Pointer
.
Properties
.$id : string
The URI that identifies the pointer.
CarbonLDP.Pointer Interface
Interface that represents the base to any model that can be referenced by a URI.
Properties
.$id : string
The URI that identifies the pointer.
CarbonLDP.PointerFactory Interface
Factory, decorator and utils for CarbonLDP.Pointer
.
Methods
.areEqual() : boolean
areEqual( pointer1:Pointer, pointer2:Pointer ):boolean
Checks if the objects refer to the same resource by its ID.
Param | Type | Default | Description |
---|---|---|---|
pointer1 | Pointer | ||
pointer2 | Pointer |
.create() : T & CarbonLDP.Pointer
create<T extends object>( data?:T & BasePointer ):T & Pointer
Creates a pointer object with the ID provided.
Param | Type | Default | Description |
---|---|---|---|
data | T & BasePointer | The optional data to use in the pointer creation. |
.getID() : string
getID( pointerOrIRI:string | Pointer ):string
Extract the IF of the pointer provided.
Param | Type | Default | Description |
---|---|---|---|
pointerOrIRI | string | Pointer | Pointer to extract its ID, or the URI that will be immediately returned. |
.getIDs() : string[]
getIDs( pointers:Pointer[] ):string[]
Extracts the IDs of all the pointers provided.
Param | Type | Default | Description |
---|---|---|---|
pointers | Pointer[] | The array of pointers to obtain their IDs. |
CarbonLDP.PointerLibrary Interface
Interface with methods to manage pointers.
Methods
.getPointer() : CarbonLDP.Pointer
getPointer( id:string ):Pointer
Returns the pointer referenced by the URI provided. If none exists, an empty new pointer will be created.
Param | Type | Default | Description |
---|---|---|---|
id | string | The URI of the pointer to get/create. |
.hasPointer() : boolean
hasPointer( id:string ):boolean
Returns true if the service has a pointer referenced by the URI provided.
Param | Type | Default | Description |
---|---|---|---|
id | string | The URI of the pointer to check. |
CarbonLDP.PointerValidator Interface
Interface with methods to validate pointers.
Methods
.inScope() : boolean
inScope( idOrPointer:string | Pointer ):boolean
Returns true if the pointer provided is in the scope of the current service.
Param | Type | Default | Description |
---|---|---|---|
idOrPointer | string | Pointer | The ID or pointer to check. |
carbonldp/QueryDocuments Module
Classes
Interfaces
CarbonLDP.QueryDocuments.QueryableProperty
. CarbonLDP.QueryDocuments.QueryMetadata
. CarbonLDP.QueryDocuments.QueryProperty
. CarbonLDP.QueryDocuments.QueryRootProperty
. CarbonLDP.QueryDocuments.QueryProperty._addSubProperty
. Type Aliases
CarbonLDP.QueryDocuments.QueryablePointer
. .QueryContainerPropertyType : enum
Type of container mode retrieval.
Enumeration | Description |
---|---|
CarbonLDP.QueryDocuments.QueryContainerPropertyType.CHILD | Specifies that the children will be retrieved. |
CarbonLDP.QueryDocuments.QueryContainerPropertyType.MEMBER | Specified that the members will be retrieved. |
.QueryPropertyType : enum
Types of data expected to return for a property.
Enumeration | Description |
---|---|
CarbonLDP.QueryDocuments.QueryPropertyType.PARTIAL | The property is expected to point to a partial resource (document/fragment). |
CarbonLDP.QueryDocuments.QueryPropertyType.EMPTY | The property is expected to point to a resource with only its types but will be marked as unresolved. |
CarbonLDP.QueryDocuments.QueryPropertyType.ALL | The property is expected to point to a resource with all is properties but without related fragments resolved. |
CarbonLDP.QueryDocuments.QueryPropertyType.FULL | The property is expected to point to a fulled resolved document |
Properties
#QueryMetadata : CarbonLDP.QueryDocuments.QueryMetadataFactory
Constant that implements CarbonLDP.QueryDocuments.QueryMetadataFactory
.
#QueryablePointer : CarbonLDP.QueryDocuments.QueryablePointerFactory
Constant that implements CarbonLDP.QueryDocuments.QueryablePointerFactory
.
Methods
#_areDifferentType() : boolean
_areDifferentType( a:any, b:any ):boolean
Returns true if the two elements provided can be classified as different type. This simulates the basic comparision in the SPARQL language.
Param | Type | Default | Description |
---|---|---|---|
a | any | The first element to check against. | |
b | any | The second element to check against. |
#_getBestType() : CarbonLDP.QueryDocuments.QueryPropertyType
_getBestType( type1:QueryPropertyType, type2:QueryPropertyType ):QueryPropertyType
Returns the general type that would match the two provided.
Param | Type | Default | Description |
---|---|---|---|
type1 | QueryPropertyType | The first type to compare. | |
type2 | QueryPropertyType | The second type to compare. |
#_getMatchingDefinition() : CarbonLDP.DigestedObjectSchemaProperty | undefined
_getMatchingDefinition( generalSchema:DigestedObjectSchema, targetSchema:DigestedObjectSchema, propertyName:string, propertyURI?:string ):DigestedObjectSchemaProperty | undefined
Returns the definition from the target schema that matched the name and the URI provided. If no correct match is found, undefined
will be returned.
Param | Type | Default | Description |
---|---|---|---|
generalSchema | DigestedObjectSchema | The schema to use in the resolution of relative URI in the matched definition. | |
targetSchema | DigestedObjectSchema | The schema where to look for the property's definition. | |
propertyName | string | The name of the property to look for. | |
propertyURI | string | The optional URI that the property has to have for have a true matching. |
#_getPathProperty() : any
_getPathProperty( element:any, path:string ):any
Search and returns the property value indicated by the specified path inside the element provided.
Param | Type | Default | Description |
---|---|---|---|
element | any | The element where to find the desired property. | |
path | string | The path in the element to the desired property. |
#_getRootPath() : string
_getRootPath( path:string ):string
Returns the root name of a full property path.
Param | Type | Default | Description |
---|---|---|---|
path | string | The path to extract its root. |
Model of a resource that can be queried or has been queried.
Properties
.$_queryableMetadata : CarbonLDP.QueryDocuments.QueryableProperty | undefined
Metadata with the data to query the resource again.
Methods
.$isQueried() : boolean
$isQueried():boolean
Returns true if the resource has been queried.
Factory, decorator and utils for CarbonLDP.QueryDocuments.QueryablePointer
.
type QueryablePointerFactory = ModelPrototype<QueryablePointer, ResolvablePointer> & ModelDecorator<QueryablePointer, BaseResolvablePointer> & ModelTypeGuard<QueryablePointer>
Metadata of a resource that has been queried.
It is used in CarbonLDP.QueryDocuments.QueryablePointer.$_queryableMetadata
.
Constructor
QueryableProperty( data:QueryablePropertyData )
Param | Type | Default | Description |
---|---|---|---|
data | QueryablePropertyData |
Properties
.definition : CarbonLDP.DigestedObjectSchemaProperty
.optional : boolean
.pathBuilderFn : (pathBuilder: PathBuilder) => Path
.propertyType : CarbonLDP.QueryDocuments.QueryPropertyType
.subProperties : Map<string, CarbonLDP.QueryDocuments.QueryableProperty>
.values : (IRIToken | LiteralToken)[]
Methods
.__mergeDefinition() : void
__mergeDefinition( propertyName:string, newDefinition:DigestedObjectSchemaProperty ):void
Param | Type | Default | Description |
---|---|---|---|
propertyName | string | ||
newDefinition | DigestedObjectSchemaProperty |
.getProperty() : CarbonLDP.QueryDocuments.QueryableProperty
getProperty( propertyName:string, data?:QueryablePropertyData ):QueryableProperty
Gets an existing property identified by the specified name, optionally merging with a data provided. If the property doesn't exists, one will be created using the suggested data.
Param | Type | Default | Description |
---|---|---|---|
propertyName | string | Name of the property to get/create. | |
data | QueryablePropertyData | The optional data of the property to create. |
.getSchema() : CarbonLDP.DigestedObjectSchema
getSchema():DigestedObjectSchema
Returns the schema generated with the definitions of the stored properties.
.mergeData() : void
mergeData( propertyName:string, data:QueryablePropertyData ):void
Merge the provided data into the current property.
Param | Type | Default | Description |
---|---|---|---|
propertyName | string | Name of the current property. | |
data | QueryablePropertyData | Data to be merged. |
.setProperty() : void
setProperty( propertyName:string, property:QueryableProperty ):void
Stores the property with the specified name.
Param | Type | Default | Description |
---|---|---|---|
propertyName | string | Name of the property to store. | |
property | QueryableProperty | The property to be stored. |
.setType() : void
setType( type:QueryPropertyType ):void
Sets the type of content of the property.
Param | Type | Default | Description |
---|---|---|---|
type | QueryPropertyType |
Base data to create a CarbonLDP.QueryDocuments.QueryableProperty
.
Properties
.definition : CarbonLDP.DigestedObjectSchemaProperty
.optional : boolean
.pathBuilderFn : (pathBuilder: PathBuilder) => Path
.propertyType : CarbonLDP.QueryDocuments.QueryPropertyType
.values : (IRIToken | LiteralToken)[]
Container of the query data specialized with elements for the custom querying of documents.
Constructor
QueryContainer( context:AbstractContext<any, any, any>, propertyData:{ uri: string; containerPropertyType: QueryContainerPropertyType; } | { uris: string[]; } )
Param | Type | Default | Description |
---|---|---|---|
context | AbstractContext<any, any, any> | ||
propertyData | { uri: string; containerPropertyType: QueryContainerPropertyType; } | { uris: string[]; } |
Properties
._generalSchema : CarbonLDP.DigestedObjectSchema
._prefixesTuples : [string, string][]
._queryProperty : CarbonLDP.QueryDocuments.QueryRootProperty | QueryContainerProperty
._variablesCounter : number
._variablesMap : Map<string, CarbonLDP.QueryDocuments.QueryVariable>
.context : CarbonLDP.AbstractContext<CarbonLDP.RegisteredPointer, any, any>
Methods
.__getCompactedIRI() : string
__getCompactedIRI( iri:string ):string
Param | Type | Default | Description |
---|---|---|---|
iri | string |
.__isUsedPrefix() : boolean
__isUsedPrefix( __0:[string, string] ):boolean
Param | Type | Default | Description |
---|---|---|---|
__0 | [string, string] |
.compactIRI() : IRIToken
compactIRI( iri:string ):IRIToken
Created the minimal form of the specified IRI, and transform into its corresponding token.
Param | Type | Default | Description |
---|---|---|---|
iri | string | The iri to compact into a token. |
.digestProperty() : CarbonLDP.DigestedObjectSchemaProperty
digestProperty( name:string, definition:ObjectSchemaProperty ):DigestedObjectSchemaProperty
Standardizes the provided property definition using the schema associated of the container.
Param | Type | Default | Description |
---|---|---|---|
name | string | The name of the property to process. | |
definition | ObjectSchemaProperty | The definition of the property to process. |
.getGeneralSchema() : CarbonLDP.DigestedObjectSchema
getGeneralSchema():DigestedObjectSchema
Gets a copy of the associated schema of the container.
.getPrologues() : PrefixToken[]
getPrologues():PrefixToken[]
Returns an array with the used prefixes in all the query.
.getVariable() : CarbonLDP.QueryDocuments.QueryVariable
getVariable( name:string ):QueryVariable
Returns a variable from the specified name. If a variable with the same name has already been created, it will be returned.
Param | Type | Default | Description |
---|---|---|---|
name | string | Name of the variable to get. |
.serializeLiteral() : string
serializeLiteral( type:string, value:any ):string
Serializes a value using the specified type and the associated context's serializers.
Param | Type | Default | Description |
---|---|---|---|
type | string | The type of the value to serialize. | |
value | any | The value to serialize. |
Class with the helpers and properties for construct a query document.
Constructor
QueryDocumentBuilder( queryContainer:QueryContainer, queryProperty:QueryProperty )
Param | Type | Default | Description |
---|---|---|---|
queryContainer | QueryContainer | ||
queryProperty | QueryProperty |
Properties
#ALL : Readonly<{}>
#FULL : Readonly<{}>
#INHERIT : Readonly<{}>
._queryContainer : CarbonLDP.QueryDocuments.QueryContainer
._queryProperty : CarbonLDP.QueryDocuments.QueryProperty
.all : Readonly<{}>
Property to describe the fetching of the entire resource properties.
.inherit : Readonly<{}>
Property to make a descriptive inheritance of a query property definition.
Methods
.object() : CarbonLDP.QueryDocuments.QueryObject
object( object:string | Pointer ):QueryObject
Wraps a pointer or URi to be used correctly in the query filters and values.
Param | Type | Default | Description |
---|---|---|---|
object | string | Pointer | Pointer or URI to be converted in a safe to use in query object. |
.properties() : this
properties( propertiesSchema:QuerySchema ):this
Method that allows to specify the property to be retrieved the the target document.
Param | Type | Default | Description |
---|---|---|---|
propertiesSchema | QuerySchema | Similar as a schema object, but this specifies the properties to be retrieved. |
.property() : VariableToken | IRIToken | LiteralToken
property( name?:string ):VariableToken | IRIToken | LiteralToken
Returns the property identifier specified by the name provided.
If no name is provided, the resource where the query belongs to is returned. In case the the main query, it will be the target document(s).
Param | Type | Default | Description |
---|---|---|---|
name | string | Optional ame of the property to to look for. |
.value() : CarbonLDP.QueryDocuments.QueryValue
value( value:string | number | boolean | Date ):QueryValue
Wraps a basic value to be used correctly in the query filters and values.
Param | Type | Default | Description |
---|---|---|---|
value | string | number | boolean | Date | Value to be converted in a safe to use in query object. |
.withType() : this
withType( type:string ):this
Specified a type the target resource has, and also uses its schema (if exits) from where to inherit the properties definition of the query.
Param | Type | Default | Description |
---|---|---|---|
type | string | The type of the target and schema. |
Class with the helpers and properties for construct a query for children or members.
Constructor
QueryDocumentsBuilder( queryContainer:QueryContainer, queryProperty:QueryContainerProperty )
Param | Type | Default | Description |
---|---|---|---|
queryContainer | QueryContainer | ||
queryProperty | QueryContainerProperty |
Properties
._queryProperty : QueryContainerProperty
Methods
.limit() : this
limit( limit:number ):this
Limit the target results to be returned by the number specified.
Param | Type | Default | Description |
---|---|---|---|
limit | number | The maximum number of targeted results. |
.offset() : this
offset( offset:number ):this
Set an offset in the target results to be returned.
Param | Type | Default | Description |
---|---|---|---|
offset | number | The offset number to be applied to the targeted results. |
.orderBy() : this
orderBy( property:string, flow?:"ASC" | "DESC" | "ascending" | "descending" ):this
Makes the target documents of the query to return ordered by the property specified. If no order flow is specified, the default behaviour of SPARQL ordering is used (ascending).
Param | Type | Default | Description |
---|---|---|---|
property | string | The property name from which the results will be ordered. | |
flow | "ASC" | "DESC" | "ascending" | "descending" | The specific order flow of the query. |
CarbonLDP.QueryDocuments.QueryMetadata Interface
Model of the volatile resource expected by the SDK in the partial query request.
Properties
.targets : CarbonLDP.QueryDocuments.QueryablePointer[]
The pointers to the main targeted resources in the partial query.
Factory, decorator and utils for CarbonLDP.QueryDocuments.QueryMetadata
.
Properties
Methods
.is() : value is CarbonLDP.QueryDocuments.QueryMetadata
is( value:any ):value is QueryMetadata
Param | Type | Default | Description |
---|---|---|---|
value | any |
Wrapper for a safe query value to the reference of any resource.
Constructor
QueryObject( queryContainer:QueryContainer, id:string )
Param | Type | Default | Description |
---|---|---|---|
queryContainer | QueryContainer | ||
id | string |
Properties
._queryContainer : CarbonLDP.QueryDocuments.QueryContainer
._resource : IRIToken | BlankNodeToken | PrefixedNameToken
Methods
.getToken() : IRIToken | BlankNodeToken | PrefixedNameToken
getToken():IRIToken | BlankNodeToken | PrefixedNameToken
Returns the SPARQL token of the object.
.toString() : string
toString():string
Returns the SPARQL string representation of the object.
Class that represents a property to be query.
Constructor
QueryProperty( data:QueryPropertyData )
Param | Type | Default | Description |
---|---|---|---|
data | QueryPropertyData |
Properties
._filters : string[]
._searchSchema : CarbonLDP.DigestedObjectSchema | undefined
._types : string[]
.definition : CarbonLDP.DigestedObjectSchemaProperty
.fullName : string
Full path name of the property, including the paths form the parents.
.identifier : VariableToken | LiteralToken | IRIToken
The identifier that represents the property. This value is one used in the final query.
.name : string
Name of the query property.
.optional : boolean
.parent : CarbonLDP.QueryDocuments.QueryProperty
Parent property if the current property is a sub-property.
.pathBuilderFn : (pathBuilder: PathBuilder) => Path
.propertyType : CarbonLDP.QueryDocuments.QueryPropertyType
.queryContainer : CarbonLDP.QueryDocuments.QueryContainer
.subProperties : Map<string, CarbonLDP.QueryDocuments.QueryProperty>
.values : (LiteralToken | IRIToken)[]
.variable : VariableToken
The variable that represents the property.
Methods
.__addPropertyTo() : SubjectToken
__addPropertyTo( subject:SubjectToken<ObjectToken> ):SubjectToken
Param | Type | Default | Description |
---|---|---|---|
subject | SubjectToken<ObjectToken> |
.__addTypesTo() : void
__addTypesTo( pattern:SubjectToken<ObjectToken> ):void
Param | Type | Default | Description |
---|---|---|---|
pattern | SubjectToken<ObjectToken> |
.__createAllPattern() : SubjectToken
__createAllPattern():SubjectToken
.__createCompleteConstructPattern() : SubjectToken
__createCompleteConstructPattern():SubjectToken
.__createGraphSubPattern() : SubjectToken
__createGraphSubPattern():SubjectToken
.__createIRIToken() : IRIToken
__createIRIToken():IRIToken
.__createPartialConstructPattern() : SubjectToken
__createPartialConstructPattern():SubjectToken
.__createPartialSearchPatterns() : PatternToken[]
__createPartialSearchPatterns():PatternToken[]
.__createPathToken() : PathToken | VariableToken
__createPathToken():PathToken | VariableToken
.__createSchema() : CarbonLDP.DigestedObjectSchema
__createSchema():DigestedObjectSchema
.__createSearchAllPattern() : GraphToken
__createSearchAllPattern():GraphToken
.__createSearchGraphPattern() : GraphToken
__createSearchGraphPattern():GraphToken
.__createSearchPatterns() : PatternToken[]
__createSearchPatterns():PatternToken[]
.__createSelfConstructPattern() : SubjectToken | undefined
__createSelfConstructPattern():SubjectToken | undefined
.__createSelfPattern() : PatternToken | undefined
__createSelfPattern():PatternToken | undefined
.__createSelfTypeFilter() : PatternToken | undefined
__createSelfTypeFilter():PatternToken | undefined
.__createSubPropertiesPatterns() : PatternToken[]
__createSubPropertiesPatterns():PatternToken[]
.__createTypesPattern() : SubjectToken
__createTypesPattern():SubjectToken
.__createTypesSearchPatterns() : PatternToken
__createTypesSearchPatterns():PatternToken
.__createTypesTokens() : IRIToken[]
__createTypesTokens():IRIToken[]
.__createValuesPattern() : ValuesToken | undefined
__createValuesPattern():ValuesToken | undefined
.__getDefinition() : CarbonLDP.DigestedObjectSchemaProperty
__getDefinition( propertyName:string, propertyDefinition:SubQueryPropertyDefinition ):DigestedObjectSchemaProperty
Param | Type | Default | Description |
---|---|---|---|
propertyName | string | ||
propertyDefinition | SubQueryPropertyDefinition |
.__getInheritDefinition() : CarbonLDP.DigestedObjectSchemaProperty | undefined
__getInheritDefinition( propertyName:string, propertyURI?:string ):DigestedObjectSchemaProperty | undefined
Param | Type | Default | Description |
---|---|---|---|
propertyName | string | ||
propertyURI | string |
.__getSelfToken() : VariableToken | IRIToken
__getSelfToken():VariableToken | IRIToken
.__getValuedPatterns() : PatternToken[] | undefined
__getValuedPatterns():PatternToken[] | undefined
._addSubProperty() : CarbonLDP.QueryDocuments.QueryProperty
_addSubProperty( propertyName:string, data:QuerySubPropertyData ):QueryProperty
Param | Type | Default | Description |
---|---|---|---|
propertyName | string | ||
data | QuerySubPropertyData |
._getContextGraph() : GraphToken
_getContextGraph():GraphToken
._getContextVariable() : VariableToken | IRIToken
_getContextVariable():VariableToken | IRIToken
._getSearchSchema() : CarbonLDP.DigestedObjectSchema
_getSearchSchema():DigestedObjectSchema
._getVariable() : VariableToken
_getVariable( name:string ):VariableToken
Param | Type | Default | Description |
---|---|---|---|
name | string |
._isComplete() : boolean
_isComplete():boolean
._isEmpty() : boolean
_isEmpty():boolean
._isPartial() : boolean
_isPartial():boolean
.addFilter() : void
addFilter( constraint:string ):void
Param | Type | Default | Description |
---|---|---|---|
constraint | string |
.addProperty() : CarbonLDP.QueryDocuments.QueryProperty
addProperty( propertyName:string, propertyDefinition:SubQueryPropertyDefinition ):QueryProperty
Param | Type | Default | Description |
---|---|---|---|
propertyName | string | ||
propertyDefinition | SubQueryPropertyDefinition |
.addType() : void
addType( type:string ):void
Param | Type | Default | Description |
---|---|---|---|
type | string |
.addValues() : void
addValues( values:(IRIRefToken | PrefixedNameToken | LiteralToken)[] ):void
Param | Type | Default | Description |
---|---|---|---|
values | (IRIRefToken | PrefixedNameToken | LiteralToken)[] |
.getConstructPatterns() : SubjectToken[]
getConstructPatterns():SubjectToken[]
Returns the patterns to be used in the construct patterns that specifies the property with its sub-properties.
.getProperty() : CarbonLDP.QueryDocuments.QueryProperty | undefined
getProperty( path?:string, flags?:{ create: true; inherit?: false; } ):QueryProperty | undefined
Param | Type | Default | Description |
---|---|---|---|
path | string | ||
flags | { create: true; inherit?: false; } |
.getSchemaFor() : CarbonLDP.DigestedObjectSchema
getSchemaFor( object:object ):DigestedObjectSchema
Returns the specific schema for the property, combining with the associated schema of the object provided if isn't a basic partial property.
Param | Type | Default | Description |
---|---|---|---|
object | object | The associated resource of the property. |
.getSearchPatterns() : PatternToken[]
getSearchPatterns():PatternToken[]
Returns the patterns to be used in the query that specifies the property and its sub-properties. If the property is optional the patterns will be wrapped in an optional SPARQL token.
.getSelfPattern() : PatternToken | undefined
getSelfPattern():PatternToken | undefined
.hasProperties() : boolean
hasProperties():boolean
.setObligatory() : void
setObligatory( flags?:{ inheritParents: true; } ):void
Param | Type | Default | Description |
---|---|---|---|
flags | { inheritParents: true; } |
.setType() : void
setType( type:QueryPropertyType ):void
Param | Type | Default | Description |
---|---|---|---|
type | QueryPropertyType |
Base data to create a CarbonLDP.QueryDocuments.QueryProperty
.
Properties
.definition : CarbonLDP.DigestedObjectSchemaProperty
.name : string
.optional : boolean
.parent : CarbonLDP.QueryDocuments.QueryProperty
.pathBuilderFn : (pathBuilder: PathBuilder) => Path
.propertyType : CarbonLDP.QueryDocuments.QueryPropertyType
.queryContainer : CarbonLDP.QueryDocuments.QueryContainer
.values : (IRIToken | LiteralToken)[]
Class for compacting a set of RDF resources by level of relations.
Constructor
QueryResultCompacter( registry:GeneralRegistry<Document>, queryContainer:QueryContainer )
Param | Type | Default | Description |
---|---|---|---|
registry | GeneralRegistry<Document> | ||
queryContainer | QueryContainer |
Properties
.jsonldConverter : CarbonLDP.JSONLD.JSONLDConverter
.queryContainer : CarbonLDP.QueryDocuments.QueryContainer
.registry : CarbonLDP.GeneralRegistry<CarbonLDP.Document>
Methods
.__processNode() : void
__processNode( compactionMap:any, compactionNode:CompactionNode, queryProperty:QueryProperty, metadataProperty:QueryableProperty ):void
Param | Type | Default | Description |
---|---|---|---|
compactionMap | any | ||
compactionNode | CompactionNode | ||
queryProperty | QueryProperty | ||
metadataProperty | QueryableProperty |
.compactDocuments() : (T & CarbonLDP.Document)[]
compactDocuments<T extends object>( rdfDocuments:RDFDocument[], targetDocuments?:string[] ):(T & Document)[]
Returns the resources as documents converted from the JSON-LD data provided.
Param | Type | Default | Description |
---|---|---|---|
rdfDocuments | RDFDocument[] | All the RDF documents returned by the query. | |
targetDocuments | string[] | The main resources that will be set as the roots of the compaction. |
Property that represents the target resource of single fetch query.
Constructor
QueryRootProperty( data:QueryRootPropertyData )
Param | Type | Default | Description |
---|---|---|---|
data | QueryRootPropertyData |
Methods
.__createSelfPattern() : PatternToken | undefined
__createSelfPattern():PatternToken | undefined
CarbonLDP.QueryDocuments.QuerySchema Interface
Interface that describes an object that contains the data to to use in a partial query creation.
Properties
.[ propertyName: string ] : CarbonLDP.QueryDocuments.QuerySchemaProperty | string
An entry that describes a property to retrieve with the name specified and the assigned property schema. If a string is provided this will be interpreted as the URI of the property.
Interface that describes an property to retrieve in a query creation.
Properties
.@container : "@set" | "@list" | "@language"
The container type the property will be interpreted to have.
@set
: An unordered array of element@list
: An ordered array of elements@language
: An object map with the language as key and the string content as the value
.@id : string
The URI that the actual property has in the platform.
.@language : string
The only specific language of a string primitive to be retrieved.
.@type : "@id" | string
The type of the property value.
If @id
is used, it will represent a Pointer.
For an literal it will generally expect the absolute XSD type URI, but a relative one can also be assigned. e.g. string
will be interpreted as http://www.w3.org/2001/XMLSchema#string
.
.path : (pathBuilder: PathBuilder) => Path
Function to build a path to specify an property that may point to data from another document.
.query : (queryBuilder: CarbonLDP.QueryDocuments.SubQueryDocumentsBuilder) => CarbonLDP.QueryDocuments.SubQueryDocumentsBuilder
Function to build a sub-query to specify sub-properties or when retrieving multiple resources to filter the resources.
.required : boolean
Flag that indicates if the property is required or optional.
Base data for create a sub-property with CarbonLDP.QueryDocuments.QueryProperty._addSubProperty
.
Properties
.definition : CarbonLDP.DigestedObjectSchemaProperty
.optional : boolean
.parent : CarbonLDP.QueryDocuments.QueryProperty
.pathBuilderFn : (pathBuilder: PathBuilder) => Path
.propertyType : CarbonLDP.QueryDocuments.QueryPropertyType
.queryContainer : CarbonLDP.QueryDocuments.QueryContainer
Wrapper for a safe query value of any standard JS value.
Constructor
QueryValue( queryContainer:QueryContainer, value:string | number | boolean | Date )
Param | Type | Default | Description |
---|---|---|---|
queryContainer | QueryContainer | ||
value | string | number | boolean | Date |
Properties
._literal : LiteralToken
._queryContainer : CarbonLDP.QueryDocuments.QueryContainer
._value : string | number | boolean | Date
Methods
.getToken() : LiteralToken
getToken():LiteralToken
Returns the SPARQL token of the value.
.toString() : string
toString():string
Returns the SPARQL string representation of the value.
.withLanguage() : this
withLanguage( language:string ):this
Sets an specific language to the query value.
Param | Type | Default | Description |
---|---|---|---|
language | string | The language to be assigned to the string literal value. |
.withType() : this
withType( type:string ):this
Sets an specific type to the query value. If the value is not string, it will be serialized.
Param | Type | Default | Description |
---|---|---|---|
type | string | The type to be assigned to the literal value. |
Class used to represent an property inside the query.
Instances of the the class are create internally by CarbonLDP.QueryDocuments.QueryContainer.getVariable
.
Constructor
QueryVariable( name:string, index:number )
Param | Type | Default | Description |
---|---|---|---|
name | string | ||
index | number |
Properties
Methods
.toString() : string
toString():string
Returns the SPARQL string representation of the variable.
Class with the helpers and properties for construct a query document.
Methods
.filter() : this
filter( constraint:string ):this
Adds an filter that affects all the query, not only possible indicated properties values.
Param | Type | Default | Description |
---|---|---|---|
constraint | string | RAW constrain of the filter to make. |
.values() : this
values( values:(QueryValue | QueryObject)[] ):this
Adds a filter to the specific values of the property where the query is been applied. NOTE: Using this function makes all the properties in the path of the one's applied, will be obligatory to exists.
Param | Type | Default | Description |
---|---|---|---|
values | (QueryValue | QueryObject)[] | Values the property must have so that the document would be returned. |
Internal interface that extends the definition of a query property when creating an internal sub-property.
Properties
.inherit : false
Flag that can avoid the search of a inheritable definition when is ensured that the current definition is complete.
carbonldp/RDF Module
Interfaces
CarbonLDP.RDF.RDFDocument
. CarbonLDP.RDF.RDFList
. CarbonLDP.RDF.RDFLiteral
. CarbonLDP.RDF.RDFNode
. CarbonLDP.RDF.RDFValue
. Type Aliases
CarbonLDP.RDF.RDFNode
can have. Reexports
Properties
#RDFList : CarbonLDP.RDF.RDFListFactory
Constant that implements CarbonLDP.RDF.RDFListFactory
.
#RDFLiteral : CarbonLDP.RDF.RDFLiteralFactory
Constant that implements CarbonLDP.RDF.RDFLiteralFactory
.
#RDFValue : CarbonLDP.RDF.RDFValueFactory
Constant that implements CarbonLDP.RDF.RDFValueFactory
.
#URI : CarbonLDP.RDF.URIFactory
Constant that implements CarbonLDP.RDF.URIFactory
.
CarbonLDP.RDF.RDFDocument Type Alias
Interface that represents an RDF Document.
type RDFDocument = {
"@id": string;
"@graph": RDFNode[];
}
CarbonLDP.RDF.RDFDocumentFactory Interface
Factory and utils for CarbonLDP.RDF.RDFDocument
.
Methods
.create() : CarbonLDP.RDF.RDFDocument
create( resources:RDFNode[], uri?:string ):RDFDocument
Param | Type | Default | Description |
---|---|---|---|
resources | RDFNode[] | ||
uri | string |
.getBNodeResources() : CarbonLDP.RDF.RDFNode[]
getBNodeResources( document:RDFDocument ):RDFNode[]
Param | Type | Default | Description |
---|---|---|---|
document | RDFDocument |
.getDocumentResources() : CarbonLDP.RDF.RDFNode[]
getDocumentResources( document:RDFNode[] | RDFDocument ):RDFNode[]
Param | Type | Default | Description |
---|---|---|---|
document | RDFNode[] | RDFDocument |
.getDocuments() : CarbonLDP.RDF.RDFDocument[]
getDocuments( objects:object | object[] ):RDFDocument[]
Param | Type | Default | Description |
---|---|---|---|
objects | object | object[] |
.getFreeNodes() : CarbonLDP.RDF.RDFNode[]
getFreeNodes( objects:object | object[] ):RDFNode[]
Param | Type | Default | Description |
---|---|---|---|
objects | object | object[] |
.getNamedFragmentResources() : CarbonLDP.RDF.RDFNode[]
getNamedFragmentResources( document:RDFNode[] | RDFDocument, documentResource?:string | RDFNode ):RDFNode[]
Param | Type | Default | Description |
---|---|---|---|
document | RDFNode[] | RDFDocument | ||
documentResource | string | RDFNode |
.getNodes() : [RDFNode[], CarbonLDP.RDF.RDFNode[]]
getNodes( rdfDocument:RDFDocument ):[RDFNode[], RDFNode[]]
Param | Type | Default | Description |
---|---|---|---|
rdfDocument | RDFDocument |
.getResources() : CarbonLDP.RDF.RDFNode[]
getResources( objects:object | object[] ):RDFNode[]
Param | Type | Default | Description |
---|---|---|---|
objects | object | object[] |
.is() : value is CarbonLDP.RDF.RDFDocument
is( value:any ):value is RDFDocument
Param | Type | Default | Description |
---|---|---|---|
value | any |
CarbonLDP.RDF.RDFList Interface
Interface that represents an RDF List.
Properties
.@list : CarbonLDP.RDF.RDFValue[]
Array of the elements in the list.
CarbonLDP.RDF.RDFListFactory Interface
Factory and utils for CarbonLDP.RDF.RDFList
.
Methods
.is() : value is CarbonLDP.RDF.RDFList
is( value:any ):value is RDFList
Returns true if the object provided is considered a CarbonLDP.RDF.RDFList
object.
Param | Type | Default | Description |
---|---|---|---|
value | any |
CarbonLDP.RDF.RDFLiteral Interface
Interface that represents an RDF Literal Value.
Properties
.@language : string
The specific language of the string value.
.@type : string
The URI of the XSD type of the literal.
.@value : string
The actual string value if the literal.
CarbonLDP.RDF.RDFLiteralFactory Interface
Factory and utils for CarbonLDP.RDF.RDFLiteral
.
Methods
.from() : CarbonLDP.RDF.RDFLiteral
from( value:any ):RDFLiteral
Convert the value provided to a CarbonLDP.RDF.RDFLiteral
object.
Param | Type | Default | Description |
---|---|---|---|
value | any |
.hasType() : boolean
hasType( value:RDFLiteral, type:string ):boolean
Returns true if the CarbonLDP.RDF.RDFLiteral
has the type specified.
Param | Type | Default | Description |
---|---|---|---|
value | RDFLiteral | ||
type | string |
.is() : value is CarbonLDP.RDF.RDFLiteral
is( value:any ):value is RDFLiteral
Returns true if the object provided is considered a CarbonLDP.RDF.RDFLiteral
object.
Param | Type | Default | Description |
---|---|---|---|
value | any |
.parse() : any
parse( value:string, type?:string ):any
Parses the value string into the respective type specified. If no type provided, the same string will be returned.
Param | Type | Default | Description |
---|---|---|---|
value | string | ||
type | string |
parse( literal:RDFLiteral ):any
Parses the CarbonLDP.RDF.RDFLiteral
object to the respective JavaScript type. Returns null
if the Literal can't be parsed.
Param | Type | Default | Description |
---|---|---|---|
literal | RDFLiteral |
CarbonLDP.RDF.RDFNode Type Alias
Model represents an RDF Node.
type RDFNode = {
"@id": string;
"@type"?: string[];
[propertyURI: string]: string | RDFNodePropertyValue[] | undefined;
}
CarbonLDP.RDF.RDFNodeFactory Interface
Factory and utils for CarbonLDP.RDF.RDFNode
.
Methods
.areEqual() : boolean
areEqual( node1:RDFNode, node2:RDFNode ):boolean
Returns true if the objects represent the same resource.
Param | Type | Default | Description |
---|---|---|---|
node1 | RDFNode | ||
node2 | RDFNode |
.create() : CarbonLDP.RDF.RDFNode
create( uri:string ):RDFNode
Creates a CarbonLDP.RDF.RDFNode
object with the URI provided.
Param | Type | Default | Description |
---|---|---|---|
uri | string |
.getID() : string
getID( node:RDFNode ):string
Returns the @id
of the node.
Param | Type | Default | Description |
---|---|---|---|
node | RDFNode |
.getList() : CarbonLDP.RDF.RDFList | undefined
getList( propertyValues:RDFNodePropertyValue[] ):RDFList | undefined
Returns the CarbonLDP.RDF.RDFList
object from the provided property of an expanded JSON-LD object. Returns undefined
if no CarbonLDP.RDF.RDFList
object is found.
Param | Type | Default | Description |
---|---|---|---|
propertyValues | RDFNodePropertyValue[] |
.getPropertyLanguageMap() : object | undefined
getPropertyLanguageMap( propertyValues:RDFNodePropertyValue[] ):object | undefined
Returns an object associating the language with the parsed string literal. Returns an empty object if it is not a property with language.
Param | Type | Default | Description |
---|---|---|---|
propertyValues | RDFNodePropertyValue[] |
.getPropertyLiterals() : any[] | undefined
getPropertyLiterals( propertyValues:RDFNodePropertyValue[], literalType:string ):any[] | undefined
Returns the property array with the parsed CarbonLDP.RDF.RDFLiteral
s. Returns undefined
if it cannot be parsed.
Param | Type | Default | Description |
---|---|---|---|
propertyValues | RDFNodePropertyValue[] | ||
literalType | string |
.getRelativeID() : string
getRelativeID( node:RDFNode ):string
Returns the relative @id
of the node when it is a fragment node.
Param | Type | Default | Description |
---|---|---|---|
node | RDFNode |
.getTypes() : string[]
getTypes( node:RDFNode ):string[]
Returns an array with the types of the CarbonLDP.RDF.RDFNode
provided.
Param | Type | Default | Description |
---|---|---|---|
node | RDFNode | The node to evaluate. |
.hasType() : boolean
hasType( node:RDFNode, type:string ):boolean
Returns true if the CarbonLDP.RDF.RDFNode
provided has the specified type.
Param | Type | Default | Description |
---|---|---|---|
node | RDFNode | The node to evaluate. | |
type | string | The type to look for it existence. |
.is() : value is CarbonLDP.RDF.RDFNode
is( value:any ):value is RDFNode
Returns true if the object provided is considered a CarbonLDP.RDF.RDFNode
object.
Param | Type | Default | Description |
---|---|---|---|
value | any |
.isFragment() : boolean
isFragment( node:RDFNode ):boolean
Returns true if the node has a fragment @id
, i.e. a named fragment or a blank node label.
Param | Type | Default | Description |
---|---|---|---|
node | RDFNode |
CarbonLDP.RDF.RDFNodePropertyValue Type Alias
Type for any possible value an CarbonLDP.RDF.RDFNode
can have.
type RDFNodePropertyValue = string | RDFNode | RDFList | RDFValue | RDFLiteral
CarbonLDP.RDF.RDFValue Interface
Interface that represents an RDF Value.
Properties
.@id : string
The URI of the current value.
.@language : string
The specific language of the string value.
.@type : string
The URI if the XSD type of the possible value.
.@value : string
The possible string value if the current object value.
CarbonLDP.RDF.RDFValueFactory Interface
Factory and utils for CarbonLDP.RDF.RDFValue
.
Methods
.parse() : any
parse( pointerLibrary:PointerLibrary | $PointerLibrary, value:RDFNodePropertyValue ):any
Returns the parsed object from an Literal, Node, or List. Returns null
if it cannot be parsed.
Param | Type | Default | Description |
---|---|---|---|
pointerLibrary | PointerLibrary | $PointerLibrary | Library from where to obtains pointers when RDFNode provided. | |
value | RDFNodePropertyValue | The RDF value to parse. |
CarbonLDP.RDF.Serializer Interface
Interface with the methods to serialize values.
Methods
.serialize() : string
serialize( value:any ):string
Method that serialize the provided value into a string.
Param | Type | Default | Description |
---|---|---|---|
value | any | Value to be serialized. |
CarbonLDP.RDF.URIFactory Interface
Utils for URI strings.
Methods
.generateBNodeID() : string
generateBNodeID():string
Returns an ID for a BlankNode using a universally unique identifier (UUID).
.getDocumentURI() : string
getDocumentURI( uri:string ):string
Returns the URI that just reference to the document of the URI provided.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to obtains its document URI. |
.getFragment() : string
getFragment( uri:string ):string
Returns the name of the fragment in the URI provided. If no fragment exists in the URI, null will be returned.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to obtains its fragment section. |
.getParameters() : Map<string, string | string[]>
getParameters( uri:string ):Map<string, string | string[]>
Returns the query parameters of the URI provided in form of a Map.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URL to parse is query parameters. |
.getRelativeURI() : string
getRelativeURI( absoluteURI:string, base:string ):string
Returns the relative URI from a base URI provided.
Param | Type | Default | Description |
---|---|---|---|
absoluteURI | string | URI to be converted into a relative URI. | |
base | string | The base URI to remove from the absoluteURI. |
.getSlug() : string
getSlug( uri:string ):string
Returns the slug of the URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to obtain ir slug. |
.hasFragment() : boolean
hasFragment( uri:string ):boolean
Returns true if the URI provided contains a fragment.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to check. |
.hasProtocol() : boolean
hasProtocol( uri:string ):boolean
Returns true if the URI provided has a protocol.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to check. |
.hasQuery() : boolean
hasQuery( uri:string ):boolean
Returns true if the URI provided contains query parameters.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to check. |
.isAbsolute() : boolean
isAbsolute( uri:string ):boolean
Returns true if the URI provided is absolute.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to check. |
.isBNodeID() : boolean
isBNodeID( uri:string ):boolean
Returns true if the URI provided reference to a BlankNode.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to check. |
.isBaseOf() : boolean
isBaseOf( baseURI:string, uri:string ):boolean
Returns true if the first URI is parent of the second URI provided.
Param | Type | Default | Description |
---|---|---|---|
baseURI | string | URI to check its the parent. | |
uri | string | URI to check that is under the baseURI. |
.isFragmentOf() : boolean
isFragmentOf( fragmentURI:string, uri:string ):boolean
Returns true if the first URI is a fragment of the second URI provided.
Param | Type | Default | Description |
---|---|---|---|
fragmentURI | string | URI to check. | |
uri | string | Base URI to be checked against fragmentURI. |
.isPrefixed() : boolean
isPrefixed( uri:string ):boolean
Returns true if the URI provided has a prefix.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to check. |
.isRelative() : boolean
isRelative( uri:string ):boolean
Returns true if the URI provided is relative.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to check. |
.prefix() : string
prefix( uri:string, prefix:string, prefixURI:string ):string
Replace a base of a URI with the prefix provided. If the prefix can not be resolved, the URI provided will be returned.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to be prefixed. | |
prefix | string | Prefix name to use in the compaction. | |
prefixURI | string | Prefix URI to ensure the specified URI can be changed for a prefixed name. |
prefix( uri:string, objectSchema:DigestedObjectSchema ):string
Replace the base of a URI with a prefix in accordance with the ObjectSchema provided. If the prefix can not be resolved, the URI provided will be returned.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to be prefixed. | |
objectSchema | DigestedObjectSchema | Schema to look for a compatible prefix to use. |
.removeProtocol() : string
removeProtocol( uri:string ):string
Removes the protocol of the URI provided.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI to remove its protocol. |
.resolve() : string
resolve( parentURI:string, childURI:string ):string
Returns a URI formed from a parent URI and a relative child URI.
Param | Type | Default | Description |
---|---|---|---|
parentURI | string | The absolute URI to be used as the base for the resolved URI. | |
childURI | string | The relative URI to be appended in the parent URI. |
Classes
YYYY-MM-DD
. HH:mm:ss.sssZ
. Properties
#booleanSerializer : CarbonLDP.RDF.Literal.Serializers.BooleanSerializer
The already exposed instance of the class CarbonLDP.RDF.Literal.Serializers.BooleanSerializer
.
#dateSerializer : CarbonLDP.RDF.Literal.Serializers.DateSerializer
The already exposed instance of the class CarbonLDP.RDF.Literal.Serializers.DateSerializer
.
#dateTimeSerializer : CarbonLDP.RDF.Literal.Serializers.DateTimeSerializer
The already exposed instance of the class CarbonLDP.RDF.Literal.Serializers.DateTimeSerializer
.
#floatSerializer : CarbonLDP.RDF.Literal.Serializers.FloatSerializer
The already exposed instance of the class CarbonLDP.RDF.Literal.Serializers.FloatSerializer
.
#integerSerializer : CarbonLDP.RDF.Literal.Serializers.IntegerSerializer
The already exposed instance of the class CarbonLDP.RDF.Literal.Serializers.IntegerSerializer
.
#longSerializer : CarbonLDP.RDF.Literal.Serializers.LongSerializer
The already exposed instance of the class CarbonLDP.RDF.Literal.Serializers.LongSerializer
.
#stringSerializer : CarbonLDP.RDF.Literal.Serializers.StringSerializer
The already exposed instance of the class CarbonLDP.RDF.Literal.Serializers.StringSerializer
.
#timeSerializer : CarbonLDP.RDF.Literal.Serializers.TimeSerializer
The already exposed instance of the class CarbonLDP.RDF.Literal.Serializers.TimeSerializer
.
#unsignedIntegerSerializer : CarbonLDP.RDF.Literal.Serializers.UnsignedIntegerSerializer
The already exposed instance of the class CarbonLDP.RDF.Literal.Serializers.UnsignedIntegerSerializer
.
#unsignedLongSerializer : CarbonLDP.RDF.Literal.Serializers.UnsignedLongSerializer
The already exposed instance of the class CarbonLDP.RDF.Literal.Serializers.UnsignedLongSerializer
.
Class that can serialize any variable to a string literal representation its truth value.
Instead of instantiating this class, use the already exposed instance carbonldp/RDF/Literal/Serializers#booleanSerializer
.
Methods
.serialize() : string
serialize( value:any ):string
Returns a string representing the truth value from the variable provided.
Param | Type | Default | Description |
---|---|---|---|
value | any |
Class that can serialize a Date object into a string literal with format YYYY-MM-DD
.
Instead of instantiating this class, use the already exposed instance carbonldp/RDF/Literal/Serializers#dateSerializer
.
Methods
.serialize() : string
serialize( value:any ):string
Returns the string with format YYYY-MM-DD
, of the Date object.
Param | Type | Default | Description |
---|---|---|---|
value | any |
Class that can serialize a Date object into a string ISO literal.
Instead of instantiating this class, use the already exposed instance carbonldp/RDF/Literal/Serializers#dateTimeSerializer
.
Methods
.serialize() : string
serialize( value:any ):string
Returns the simplified extended ISO format (ISO 8601) of the Date object.
Param | Type | Default | Description |
---|---|---|---|
value | any |
Class that can serialize any Number value to a string literal of float.
Instead of instantiating this class, use the already exposed instance carbonldp/RDF/Literal/Serializers#floatSerializer
.
Methods
.serialize() : string
serialize( value:any ):string
Returns a string representing a float from the Number provided.
Param | Type | Default | Description |
---|---|---|---|
value | any |
Class that can serialize any Number value to a string literal of an integer.
Instead of instantiating this class, use the already exposed instance carbonldp/RDF/Literal/Serializers#integerSerializer
.
Methods
.serialize() : string
serialize( value:any ):string
Returns a string representing an integer from the Number provided.
Param | Type | Default | Description |
---|---|---|---|
value | any |
Class that can serialize any Number value to a string literal of a long integer.
Instead of instantiating this class, use the already exposed instance carbonldp/RDF/Literal/Serializers#longSerializer
.
Methods
.serialize() : string
serialize( value:any ):string
Returns a string representing a long integer from the Number provided.
Param | Type | Default | Description |
---|---|---|---|
value | any |
Class that can serialize any variable to a string literal representation its truth value.
Instead of instantiating this class, use the already exposed instance carbonldp/RDF/Literal/Serializers#stringSerializer
.
Methods
.serialize() : string
serialize( value:any ):string
Returns a string representing the truth value from the variable provided.
Param | Type | Default | Description |
---|---|---|---|
value | any |
Class that can serialize a Date object into a literal string with format HH:mm:ss.sssZ
.
Instead of instantiating this class, use the already exposed instance carbonldp/RDF/Literal/Serializers#timeSerializer
.
Methods
.serialize() : string
serialize( value:any ):string
Param | Type | Default | Description |
---|---|---|---|
value | any |
Class that can serialize any Number value to a string literal of an unsigned integer.
Instead of instantiating this class, use the already exposed instance carbonldp/RDF/Literal/Serializers#unsignedIntegerSerializer
.
Methods
.serialize() : string
serialize( value:any ):string
Returns a string representing an unsigned integer from the Number provided.
Param | Type | Default | Description |
---|---|---|---|
value | any |
Class that can serialize any Number value to a string literal of an unsigned long integer.
Instead of instantiating this class, use the already exposed instance carbonldp/RDF/Literal/Serializers#unsignedLongSerializer
.
Methods
.serialize() : string
serialize( value:any ):string
Param | Type | Default | Description |
---|---|---|---|
value | any |
carbonldp/Registry Module
Interfaces
CarbonLDP.GlobalRegistry
. CarbonLDP.Registry
/CarbonLDP.$Registry
. Type Aliases
CarbonLDP.GlobalRegistry
. CarbonLDP.RegisteredPointer
. CarbonLDP.Registry
and CarbonLDP.$Registry
. Properties
#GlobalRegistry : CarbonLDP.Model.ModelFactory<any, CarbonLDP.BaseGlobalRegistry>
Constant that implements CarbonLDP.GlobalRegistryFactory
#RegisteredPointer : CarbonLDP.RegisteredPointerFactory
Constant that implements CarbonLDP.RegisteredPointerFactory
#Registry : CarbonLDP.RegistryFactory
Constant that implements for CarbonLDP.RegistryFactory
.
CarbonLDP.$Registry Interface
Interface with the base methods of a model that stores and manages an specific type of resources.
Properties
.$__modelDecorator : CarbonLDP.Model.ModelDecorator<MODEL, BaseRegisteredPointer>
Decorator object to personalize the pointers of the registry.
.$__resourcesMap : Map<string, MODEL>
Map where the resources of the registry are stored.
.$registry : CarbonLDP.Registry<any> | CarbonLDP.$Registry<any> | undefined
Parent registry of the registry.
Methods
.$_addPointer() : T & MODEL
$_addPointer<T extends object>( pointer:T & Pointer ):T & MODEL
Adds the provided object as a resource of the registry.
Param | Type | Default | Description |
---|---|---|---|
pointer | T & Pointer | The base object to be added as a resource of the registry. |
.$_getLocalID() : string
$_getLocalID( id:string ):string
Returns the local identifier for the ID provided. Throws and error if the ID cannot be converted into a local one.
Param | Type | Default | Description |
---|---|---|---|
id | string | The ID to be converted. |
.$getPointer() : CarbonLDP.RegisteredPointer
$getPointer( id:string ):RegisteredPointer
Returns the resource identified by the provided ID from the first existence in the registry hierarchy. If non exists, a pointer is created in the first register where the ID in scope of.
A error is thrown when no pointer could be returned or created in any registry.
Param | Type | Default | Description |
---|---|---|---|
id | string | ID to return its pointer representation. |
$getPointer( id:string, local:true ):MODEL
Returns the resource identified by the provided ID from the current registry. If non exists, a resource is created from the current registry model.
A error is thrown when no pointer could be returned or created.
Param | Type | Default | Description |
---|---|---|---|
id | string | ID to check its existence. | |
local | true | Flag to ignore hierarchy and only return pointers from the current registry. |
.$getPointers() : CarbonLDP.RegisteredPointer[]
$getPointers():RegisteredPointer[]
Returns all the pointers stored the registry hierarchy.
$getPointers( local:true ):MODEL[]
Returns all the pointers stored in the current registry.
Param | Type | Default | Description |
---|---|---|---|
local | true | Flag to ignore hierarchy and only return pointers from the current registry. |
.$hasPointer() : boolean
$hasPointer( id:string ):boolean
Returns true if a resource identified by the provided ID exists in the registry hierarchy.
Param | Type | Default | Description |
---|---|---|---|
id | string | ID to check its existence. |
$hasPointer( id:string, local:true ):boolean
Returns true if a resource identified by the provided ID exists in the registry hierarchy.
Param | Type | Default | Description |
---|---|---|---|
id | string | ID to check its existence. | |
local | true | Flag to ignore hierarchy and only check in the current registry. |
.$inScope() : boolean
$inScope( idOrPointer:string | Pointer ):boolean
Returns if the provided ID string or pointer can be stored in any of the registry hierarchy.
Param | Type | Default | Description |
---|---|---|---|
idOrPointer | string | Pointer | The id or pointer to be checked. |
$inScope( idOrPointer:string | Pointer, local:true ):boolean
Returns if the provided ID string or pointer can be only stored in the current registry.
Param | Type | Default | Description |
---|---|---|---|
idOrPointer | string | Pointer | The id or pointer to be checked. | |
local | true | Flag to ignore hierarchy and only check in the current registry. |
.$removePointer() : boolean
$removePointer( idOrPointer:string | RegisteredPointer ):boolean
Removes the resource identified by the provided string ID or CarbonLDP.Pointer.$id
, from the first occurrence in the registry hierarchy. Returns true if the resource could be removed, false otherwise.
Param | Type | Default | Description |
---|---|---|---|
idOrPointer | string | RegisteredPointer | ID or Pointer to be removed. |
$removePointer( idOrPointer:string | RegisteredPointer, local:true ):boolean
Removes the resource identified by the provided string ID or CarbonLDP.Pointer.$id
, from the first occurrence in the registry hierarchy. Returns true if the resource could be removed, false otherwise.
Param | Type | Default | Description |
---|---|---|---|
idOrPointer | string | RegisteredPointer | ID or Pointer to be removed. | |
local | true | Flag to ignore hierarchy and only remove from the current registry. |
CarbonLDP.BaseGlobalRegistry Interface
Base properties to create a CarbonLDP.GlobalRegistry
.
Properties
.context : CarbonLDP.GlobalContext
Global context where the registry will belong to.
CarbonLDP.GlobalRegistry Interface
Properties
.context : CarbonLDP.GlobalContext
Global context where the registry belongs to.
.registry : undefined
Been the global registry, it cannot have a parent registry.
CarbonLDP.GlobalRegistryFactory Type Alias
Factory, decorator and utils for CarbonLDP.GlobalRegistry
.
type GlobalRegistryFactory = ModelFactory<GlobalRegistry, BaseGlobalRegistry>
CarbonLDP.RegisteredPointer Interface
Interface that represents the base to any model that can be registered in any CarbonLDP.Registry
/CarbonLDP.$Registry
.
Properties
.$registry : CarbonLDP.Registry<CarbonLDP.RegisteredPointer> | CarbonLDP.$Registry<CarbonLDP.RegisteredPointer> | undefined
Registry the current pointer belongs to.
CarbonLDP.RegisteredPointerFactory Type Alias
Factory, decorator and utils for CarbonLDP.RegisteredPointer
.
type RegisteredPointerFactory = ModelPrototype<RegisteredPointer, Pointer> & ModelDecorator<RegisteredPointer, BaseRegisteredPointer> & ModelFactory<RegisteredPointer, BaseRegisteredPointer> & ModelTypeGuard<RegisteredPointer>
CarbonLDP.Registry Interface
Interface with the base methods of a service that stores and manages an specific type of resources.
Properties
.__modelDecorator : CarbonLDP.Model.ModelDecorator<MODEL, BaseRegisteredPointer>
Decorator object to personalize the pointers of the registry.
.__resourcesMap : Map<string, MODEL>
Map where the resources of the registry are stored.
.registry : CarbonLDP.Registry<any> | CarbonLDP.$Registry<any> | undefined
Parent registry of the registry.
Methods
._addPointer() : T & MODEL
_addPointer<T extends object>( pointer:T & Pointer ):T & MODEL
Adds the provided object as a resource of the registry.
Param | Type | Default | Description |
---|---|---|---|
pointer | T & Pointer | The base object to be added as a resource of the registry. |
._getLocalID() : string
_getLocalID( id:string ):string
Returns the local identifier for the ID provided. Throws and error if the ID cannot be converted into a local one.
Param | Type | Default | Description |
---|---|---|---|
id | string | The ID to be converted. |
.getPointer() : CarbonLDP.RegisteredPointer
getPointer( id:string ):RegisteredPointer
Returns the resource identified by the provided ID from the first existence in the registry hierarchy. If non exists, a pointer is created in the first register where the ID in scope of.
A error is thrown when no pointer could be returned or created in any registry.
Param | Type | Default | Description |
---|---|---|---|
id | string | ID to return its pointer representation. |
getPointer( id:string, local:true ):MODEL
Returns the resource identified by the provided ID from the current registry. If non exists, a resource is created from the current registry model.
A error is thrown when no pointer could be returned or created.
Param | Type | Default | Description |
---|---|---|---|
id | string | ID to check its existence. | |
local | true | Flag to ignore hierarchy and only return pointers from the current registry. |
.getPointers() : CarbonLDP.RegisteredPointer[]
getPointers():RegisteredPointer[]
Returns all the pointers stored the registry hierarchy.
getPointers( local:true ):MODEL[]
Returns all the pointers stored in the current registry.
Param | Type | Default | Description |
---|---|---|---|
local | true | Flag to ignore hierarchy and only return pointers from the current registry. |
.hasPointer() : boolean
hasPointer( id:string ):boolean
Returns true if a resource identified by the provided ID exists in the registry hierarchy.
Param | Type | Default | Description |
---|---|---|---|
id | string | ID to check its existence. |
hasPointer( id:string, local:true ):boolean
Returns true if a resource identified by the provided ID exists in the registry hierarchy.
Param | Type | Default | Description |
---|---|---|---|
id | string | ID to check its existence. | |
local | true | Flag to ignore hierarchy and only check in the current registry. |
.inScope() : boolean
inScope( idOrPointer:string | Pointer ):boolean
Returns if the provided ID string or pointer can be stored in any of the registry hierarchy.
Param | Type | Default | Description |
---|---|---|---|
idOrPointer | string | Pointer | The id or pointer to be checked. |
inScope( idOrPointer:string | Pointer, local:true ):boolean
Returns if the provided ID string or pointer can be only stored in the current registry.
Param | Type | Default | Description |
---|---|---|---|
idOrPointer | string | Pointer | The id or pointer to be checked. | |
local | true | Flag to ignore hierarchy and only check in the current registry. |
.removePointer() : boolean
removePointer( idOrPointer:string | RegisteredPointer ):boolean
Removes the resource identified by the provided string ID or CarbonLDP.Pointer.$id
, from the first occurrence in the registry hierarchy. Returns true if the resource could be removed, false otherwise.
Param | Type | Default | Description |
---|---|---|---|
idOrPointer | string | RegisteredPointer | ID or Pointer to be removed. |
removePointer( idOrPointer:string | RegisteredPointer, local:true ):boolean
Removes the resource identified by the provided string ID or CarbonLDP.Pointer.$id
, from the first occurrence in the registry hierarchy. Returns true if the resource could be removed, false otherwise.
Param | Type | Default | Description |
---|---|---|---|
idOrPointer | string | RegisteredPointer | ID or Pointer to be removed. | |
local | true | Flag to ignore hierarchy and only remove from the current registry. |
CarbonLDP.RegistryFactory Type Alias
Factory, decorator and utils for CarbonLDP.Registry
and CarbonLDP.$Registry
.
type RegistryFactory = ModelPrototype<Registry<any>> & BiModelDecorator<Registry<any>, $Registry<any>, BaseRegistry, $BaseRegistry>
carbonldp/Repository Module
Interfaces
CarbonLDP.$Repository
. CarbonLDP.Repository
. CarbonLDP.Repository
/CarbonLDP.$Repository
. Type Aliases
CarbonLDP.Repository
. CarbonLDP.ResolvablePointer
. Properties
#Repository : CarbonLDP.RepositoryFactory
Constant that implements CarbonLDP.RepositoryFactory
.
#ResolvablePointer : CarbonLDP.ResolvablePointerFactory
Constant that implements CarbonLDP.ResolvablePointerFactory
.
CarbonLDP.$BaseRepository Interface
Base properties to create a CarbonLDP.$Repository
.
CarbonLDP.$Repository Interface
Interface with the base methods of a model that manages request of an specific type of resources.
Methods
.$delete() : Promise<void>
$delete( uri:string, params:any[] ):Promise<void>
Deletes the resource of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the resource to delete. | |
params | any[] | Rest params of the method. |
.$exists() : Promise<boolean>
$exists( uri:string, params:any[] ):Promise<boolean>
Checks if the resource of the specified URI exists.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the resource to check. | |
params | any[] | Rest params of the method. |
.$get() : Promise<MODEL>
$get( uri:string, params:any[] ):Promise<MODEL>
Retrieves the resources of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the resource to retrieve. | |
params | any[] | Rest params of the method. |
.$refresh() : Promise<MODEL>
$refresh( resource:MODEL, params:any[] ):Promise<MODEL>
Refreshes the data of the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | Resource to refresh. | |
params | any[] | Rest params of the method. |
.$resolve() : Promise<MODEL>
$resolve( resource:MODEL, params:any[] ):Promise<MODEL>
Resolve the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | Resource to resolve. | |
params | any[] | Rest params of the method. |
.$save() : Promise<MODEL>
$save( resource:MODEL, params:any[] ):Promise<MODEL>
Saves the changes of the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | Resource to save. | |
params | any[] | Rest params of the method. |
.$saveAndRefresh() : Promise<MODEL>
$saveAndRefresh( resource:MODEL, params:any[] ):Promise<MODEL>
Saves the changes of the specified resource and retrieves its latest changes.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | Resource to save and refresh. | |
params | any[] | Rest params of the method. |
CarbonLDP.BaseRepository Interface
Base properties to create a CarbonLDP.Repository
.
CarbonLDP.Repository Interface
Interface with the base methods of a service that manages request of an specific type of resources.
Methods
.delete() : Promise<void>
delete( uri:string, params:any[] ):Promise<void>
Deletes the resource of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the resource to delete. | |
params | any[] | Rest params of the method. |
.exists() : Promise<boolean>
exists( uri:string, params:any[] ):Promise<boolean>
Checks if the resource of the specified URI exists.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the resource to check. | |
params | any[] | Rest params of the method. |
.get() : Promise<MODEL>
get( uri:string, params:any[] ):Promise<MODEL>
Retrieves the resources of the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the resource to retrieve. | |
params | any[] | Rest params of the method. |
.refresh() : Promise<MODEL>
refresh( resource:MODEL, params:any[] ):Promise<MODEL>
Refreshes the data of the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | Resource to refresh. | |
params | any[] | Rest params of the method. |
.resolve() : Promise<MODEL>
resolve( resource:MODEL, params:any[] ):Promise<MODEL>
Resolve the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | Resource to resolve. | |
params | any[] | Rest params of the method. |
.save() : Promise<MODEL>
save( resource:MODEL, params:any[] ):Promise<MODEL>
Saves the changes of the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | Resource to save. | |
params | any[] | Rest params of the method. |
.saveAndRefresh() : Promise<MODEL>
saveAndRefresh( resource:MODEL, params:any[] ):Promise<MODEL>
Saves the changes of the specified resource and retrieves its latest changes.
Param | Type | Default | Description |
---|---|---|---|
resource | MODEL | Resource to save and refresh. | |
params | any[] | Rest params of the method. |
CarbonLDP.RepositoryFactory Type Alias
Factory, decorator and utils for CarbonLDP.Repository
.
type RepositoryFactory = ModelPrototype<Repository, BaseRepository & ObjectSchemaResolver> & BiModelDecorator<Repository<any>, $Repository<any>, BaseRepository, $BaseRepository>
CarbonLDP.ResolvablePointer Interface
Interface that represents the base to any model that can be fetched by any CarbonLDP.Repository
/CarbonLDP.$Repository
.
Properties
.$_resolved : boolean
.$_snapshot : object
Shallow copy of the pointer, which is used to track its changes.
.$eTag : string | undefined | null
Identifier that describes the state of the last data retrieved.
.$repository : CarbonLDP.Repository | CarbonLDP.$Repository
Repository with request methods associated to the resource.
Methods
.$_syncSnapshot() : void
$_syncSnapshot():void
Updates the snapshot with the current data of the resource.
.$delete() : Promise<void>
$delete( params:any[] ):Promise<void>
Calls the delete
method of the associated repository, except the URI since it will be taken from the current resource.
Param | Type | Default | Description |
---|---|---|---|
params | any[] | Rest params required by the respective repository method. |
$delete( uri:string, params:any[] ):Promise<void>
Calls the delete
method of the associated repository, with the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the specific document. | |
params | any[] | Rest params required by the respective repository method. |
.$exists() : Promise<boolean>
$exists( params:any[] ):Promise<boolean>
Calls the exists
method of the associated repository, except the URI since it will be taken from the current resource.
Param | Type | Default | Description |
---|---|---|---|
params | any[] | Rest params required by the respective repository method. |
$exists( uri:string, params:any[] ):Promise<boolean>
Calls the exists
method of the associated repository, with the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the specific document. | |
params | any[] | Rest params required by the respective repository method. |
.$get() : Promise<CarbonLDP.ResolvablePointer>
$get( params:any[] ):Promise<ResolvablePointer>
Calls the get
method of the associated repository, except the URI since it will be taken from the current resource.
Param | Type | Default | Description |
---|---|---|---|
params | any[] | Rest params required by the respective repository method. |
$get( uri:string, params:any[] ):Promise<ResolvablePointer>
Calls the get
method of the associated repository, with the specified URI.
Param | Type | Default | Description |
---|---|---|---|
uri | string | URI of the specific document. | |
params | any[] | Rest params required by the respective repository method. |
.$isDirty() : boolean
$isDirty():boolean
Returns true if the resource presents differences from its snapshot.
.$isResolved() : boolean
$isResolved():boolean
Returns true when the pointer has been retrieved.
.$refresh() : Promise<CarbonLDP.ResolvablePointer>
$refresh( params:any[] ):Promise<ResolvablePointer>
Calls the refresh
method of the associated repository, except the resource since it will be taken as the current resource.
Param | Type | Default | Description |
---|---|---|---|
params | any[] | Rest params required by the respective repository method. |
$refresh( resource:ResolvablePointer, params:any[] ):Promise<ResolvablePointer>
Calls the refresh
method of the associated repository, with the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | ResolvablePointer | The specific resource. | |
params | any[] | The params required by the respective repository method. |
.$resolve() : Promise<CarbonLDP.ResolvablePointer>
$resolve( params:any[] ):Promise<ResolvablePointer>
Calls the resolve
method of the associated repository, except the resource since it will be taken as the current resource.
Param | Type | Default | Description |
---|---|---|---|
params | any[] | Rest params required by the respective repository method. |
$resolve( resource:ResolvablePointer, params:any[] ):Promise<ResolvablePointer>
Calls the resolve
method of the associated repository, with the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | ResolvablePointer | The specific resource. | |
params | any[] | The params required by the respective repository method. |
.$revert() : void
$revert():void
Reverts the changes made to the resource into the state of the snapshot.
.$save() : Promise<CarbonLDP.ResolvablePointer>
$save( params:any[] ):Promise<ResolvablePointer>
Calls the save
method of the associated repository, except the resource since it will be taken as the current resource.
Param | Type | Default | Description |
---|---|---|---|
params | any[] | Rest params required by the respective repository method. |
$save( resource:ResolvablePointer, params:any[] ):Promise<ResolvablePointer>
Calls the save
method of the associated repository, with the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | ResolvablePointer | The specific resource. | |
params | any[] | The params required by the respective repository method. |
.$saveAndRefresh() : Promise<CarbonLDP.ResolvablePointer>
$saveAndRefresh( params:any[] ):Promise<ResolvablePointer>
Calls the saveAndRefresh
method of the associated repository, except the resource since it will be taken as the current resource.
Param | Type | Default | Description |
---|---|---|---|
params | any[] | Rest params required by the respective repository method. |
$saveAndRefresh( resource:ResolvablePointer, params:any[] ):Promise<ResolvablePointer>
Calls the saveAndRefresh
method of the associated repository, with the specified resource.
Param | Type | Default | Description |
---|---|---|---|
resource | ResolvablePointer | The specific resource. | |
params | any[] | The params required by the respective repository method. |
CarbonLDP.ResolvablePointerFactory Type Alias
Factory, decorator and utils for CarbonLDP.ResolvablePointer
.
type ResolvablePointerFactory = ModelPrototype<ResolvablePointer, Pointer> & ModelDecorator<ResolvablePointer, BaseResolvablePointer> & ModelTypeGuard<ResolvablePointer>
carbonldp/Resource Module
Interfaces
CarbonLDP.Resource
. Type Aliases
CarbonLDP.Resource
. Properties
#Resource : CarbonLDP.ResourceFactory
Constant that implements CarbonLDP.ResourceFactory
.
CarbonLDP.BaseResource Interface
Base properties for a CarbonLDP.Resource
.
Properties
.$registry : CarbonLDP.Registry | CarbonLDP.$Registry
Optional associated registry of the resource.
.types : string[]
Types the resource will have.
CarbonLDP.Resource Interface
Interface that represents any resource in the SDK.
Properties
.$registry : CarbonLDP.Registry<CarbonLDP.RegisteredPointer> | CarbonLDP.$Registry<CarbonLDP.RegisteredPointer> | undefined
Optional associated registry of the resource.
.$slug : string
Slug of the URI of the resource. Depending of the URI, the value returned would be:
- For blank nodes the same $id of the resource would be returned
- For named fragments, the content after the
#
symbol would be returned - For documents, it's the last part URI e.g.
https://example.com/resource-1/
=>resource-1
.types : string[]
Types of the resource.
Methods
.$addType() : void
$addType( type:string ):void
Adds a type to the current resource.
Param | Type | Default | Description |
---|---|---|---|
type | string | The type to be added. |
.$hasType() : boolean
$hasType( type:string ):boolean
Returns true if the current resource contains the type specified.
Param | Type | Default | Description |
---|---|---|---|
type | string | The type to look for. |
.$removeType() : void
$removeType( type:string ):void
Remove the type specified from the current resource.
Param | Type | Default | Description |
---|---|---|---|
type | string | The type to be removed. |
.toJSON() : CarbonLDP.RDF.RDFNode
toJSON( contextOrKey?:string | Context<RegisteredPointer, ResolvablePointer> ):RDFNode
Returns the JSON-LD Node representation of the current resource.
Param | Type | Default | Description |
---|---|---|---|
contextOrKey | string | Context<RegisteredPointer, ResolvablePointer> | A specific context to use for expand the data into JSON-LD Node instead of the internal one. |
CarbonLDP.ResourceFactory Type Alias
Factory, decorator and utils for CarbonLDP.Resource
.
type ResourceFactory = ModelPrototype<Resource, RegisteredPointer> & ModelDecorator<Resource, BaseResource> & ModelFactoryOptional<Resource> & ModelTypeGuard<Resource>
carbonldp/SHACL Module
Interfaces
shacl:ValidationReport
. CarbonLDP.SHACL.ValidationReport
. shacl:ValidationResource
. CarbonLDP.SHACL.ValidationResult
. Properties
#ValidationReport : CarbonLDP.SHACL.ValidationReportFactory
Constant that implements CarbonLDP.SHACL.ValidationReport
.
#ValidationResult : CarbonLDP.SHACL.ValidationResultFactory
Constant that implements CarbonLDP.SHACL.ValidationResultFactory
.
CarbonLDP.SHACL.ValidationReport Interface
Model that represents a shacl:ValidationReport
. This model contains the results of a validation process.
Properties
.conforms : boolean
Indicates if the validation conforms the given shape. If that's the case, no results data will be returned.
.results : CarbonLDP.SHACL.ValidationResult[]
The results of a failure validation process.
.shapesGraphWellFormed : boolean
The shapesGraphWellFormed
of a failure validation process.
CarbonLDP.SHACL.ValidationReportFactory Interface
CarbonLDP.SHACL.ValidationResult Interface
Model that represents a shacl:ValidationResource
. This model contains the report of an individual SHACL validation failure.
Properties
.detail : CarbonLDP.Pointer
Pointer to the possible parent wih one or more SHACL results.
.focusNode : CarbonLDP.Pointer
The focus node that has caused the result.
.resultMessage : string
The message string taken from the SHACL shape message property.
.resultPath : CarbonLDP.Pointer
The SHACL shape property path that where tested.
.resultSeverity : CarbonLDP.Pointer
The severity described by the SHACL shape severity property.
.sourceConstraintComponent : CarbonLDP.Pointer
Pointer to the constraint that caused the resource.
.sourceShape : CarbonLDP.Pointer
Pointer to the source SHACL shape used in the validation.
.value : any
The value of the previous SHACL property path that raised the validation violation.
CarbonLDP.SHACL.ValidationResultFactory Interface
carbonldp/SPARQL Module
Classes
CarbonLDP.SPARQL.SPARQLRawResults
object. Interfaces
CarbonLDP.SPARQL.SPARQLRawBindingObject
. CarbonLDP.SPARQL.FinishSPARQLAsk Interface
Clause that extends the query builder allowing to execute the request for the ASK built query.
Methods
.execute() : Promise<boolean>
execute():Promise<boolean>
Executes the SPARQL query.
CarbonLDP.SPARQL.FinishSPARQLSelect Interface
Clause that extends the query builder allowing to execute the request for the SELECT built query.
Methods
.execute() : Promise<CarbonLDP.SPARQL.SPARQLSelectResults<T>>
execute<T extends object>():Promise<SPARQLSelectResults<T>>
Executes the SPARQL query.
CarbonLDP.SPARQL.SPARQLBindingObject Interface
Entry of a element asked in the SELECT query.
Properties
.[ binding: string ] : string | number | boolean | Date | CarbonLDP.Pointer
An entry per every var selected, which contains a parsed value requested. This element can be from every literal type (String
, Number
, Date
, etc.), to a CarbonLDP.Pointer
if it's an URI.
Customized SPARQLER class to be used by the SDK.
Constructor
SPARQLBuilder( repository:SPARQLDocumentsRepositoryTrait, entryPoint:string )
Param | Type | Default | Description |
---|---|---|---|
repository | SPARQLDocumentsRepositoryTrait | The repository where the builder is been constructed from. | |
entryPoint | string | The entry point URI where the query can be executed from. |
CarbonLDP.SPARQL.SPARQLRawBindingObject Interface
Interface that represents the raw response of a SPARQL query.
Properties
.[ name: string ] : CarbonLDP.SPARQL.SPARQLRawBindingProperty
An entry of every vars
requested as the name
variable, containing the binding property with its value.
Interface that represents every entry of a CarbonLDP.SPARQL.SPARQLRawBindingObject
.
Properties
.datatype : string
The URI of the type of the binding property. This is only present when the property is of type literal
.
.type : string
The type of binding property, it could be uri
, literal
or bnode
.
.value : string
The string value of binding property.
.xml:lang : string
If the property is a literal
and of data type xsd:string
, this property indicates if it has an specific language.
CarbonLDP.SPARQL.SPARQLRawResults Interface
Interface that represents the raw response of a SPARQL query.
Properties
.boolean : boolean
The result of an ASK
query.
.head : { "vars"?: string[]; "links"?: string[]; }
Contains an array vars
with the possible elements inside the results bindings properties. This can also contains an array link
, that contains URI to further information about the results.
.results : { "bindings": CarbonLDP.SPARQL.SPARQLRawBindingObject[]; }
The bound results of a SELECT
query.
Class to parse SPARQL Query result to a CarbonLDP.SPARQL.SPARQLRawResults
object.
Methods
.parse() : Promise<CarbonLDP.SPARQL.SPARQLRawResults>
parse( input:string ):Promise<SPARQLRawResults>
Parse the SPARQL Query string result to a CarbonLDP.SPARQL.SPARQLRawResults
object.
Param | Type | Default | Description |
---|---|---|---|
input | string | The string to parse. |
CarbonLDP.SPARQL.SPARQLSelectResults Interface
Service with methods to execute SPARQL queries and updates.
Properties
#DEFAULT_OPTIONS : CarbonLDP.HTTP.RequestOptions
#RESULTS_PARSER : CarbonLDP.SPARQL.SPARQLRawResultsParser
#STRING_PARSER : CarbonLDP.HTTP.StringParser
Methods
#__parseRawBindingProperty() : any
__parseRawBindingProperty( rawBindingProperty:SPARQLRawBindingProperty, pointerLibrary:PointerLibrary | $PointerLibrary ):any
Param | Type | Default | Description |
---|---|---|---|
rawBindingProperty | SPARQLRawBindingProperty | ||
pointerLibrary | PointerLibrary | $PointerLibrary |
#executeASKQuery() : Promise<[boolean, CarbonLDP.HTTP.Response]>
executeASKQuery( url:string, askQuery:string, options:RequestOptions ):Promise<[boolean, Response]>
Executes an ASK Query and returns a boolean.
Param | Type | Default | Description |
---|---|---|---|
url | string | ||
askQuery | string | ||
options | RequestOptions |
#executeRawASKQuery() : Promise<[SPARQLRawResults, CarbonLDP.HTTP.Response]>
executeRawASKQuery( url:string, askQuery:string, options:RequestOptions ):Promise<[SPARQLRawResults, Response]>
Executes an ASK Query and returns a raw application/sparql-results+json object.
Param | Type | Default | Description |
---|---|---|---|
url | string | ||
askQuery | string | ||
options | RequestOptions |
#executeRawCONSTRUCTQuery() : Promise<[string, CarbonLDP.HTTP.Response]>
executeRawCONSTRUCTQuery( url:string, constructQuery:string, options:RequestOptions ):Promise<[string, Response]>
Executes a CONSTRUCT Query and returns a string with the resulting model.
Param | Type | Default | Description |
---|---|---|---|
url | string | ||
constructQuery | string | ||
options | RequestOptions |
#executeRawDESCRIBEQuery() : Promise<[string, CarbonLDP.HTTP.Response]>
executeRawDESCRIBEQuery( url:string, describeQuery:string, options:RequestOptions ):Promise<[string, Response]>
Executes a DESCRIBE Query and returns a string with the resulting model.
Param | Type | Default | Description |
---|---|---|---|
url | string | ||
describeQuery | string | ||
options | RequestOptions |
#executeRawSELECTQuery() : Promise<[SPARQLRawResults, CarbonLDP.HTTP.Response]>
executeRawSELECTQuery( url:string, selectQuery:string, options:RequestOptions ):Promise<[SPARQLRawResults, Response]>
Executes a SELECT Query and returns a raw application/sparql-results+json object.
Param | Type | Default | Description |
---|---|---|---|
url | string | ||
selectQuery | string | ||
options | RequestOptions |
#executeSELECTQuery() : Promise<[SPARQLSelectResults<T>, CarbonLDP.HTTP.Response]>
executeSELECTQuery<T>( url:string, selectQuery:string, pointerLibrary:PointerLibrary, options:RequestOptions ):Promise<[SPARQLSelectResults<T>, Response]>
Executes a SELECT Query and parses the results.
Param | Type | Default | Description |
---|---|---|---|
url | string | ||
selectQuery | string | ||
pointerLibrary | PointerLibrary | ||
options | RequestOptions |
#executeUPDATE() : Promise<CarbonLDP.HTTP.Response>
executeUPDATE( url:string, updateQuery:string, options:RequestOptions ):Promise<Response>
Executes an UPDATE query.
Param | Type | Default | Description |
---|---|---|---|
url | string | ||
updateQuery | string | ||
options | RequestOptions |
carbonldp/System Module
Interfaces
c:PlatformInstance
. CarbonLDP.System.PlatformInstance
. c:Platform
. CarbonLDP.System.PlatformInstance
. Properties
#PlatformInstance : CarbonLDP.System.PlatformInstanceFactory
Constant that implements CarbonLDP.System.PlatformInstanceFactory
.
#PlatformMetadata : CarbonLDP.System.PlatformMetadataFactory
Constant that implements CarbonLDP.System.PlatformMetadata
.
CarbonLDP.System.PlatformInstance Interface
Model that represents a c:PlatformInstance
. The model contains the actual data of a platform instance.
Properties
.buildDate : Date
The datetime when the platform was built.
.version : string
The version the platform instance.
CarbonLDP.System.PlatformInstanceFactory Interface
CarbonLDP.System.PlatformMetadata Interface
Model that represents a c:Platform
. The model contains the reference of the metadata of a platform instance.
Properties
.instance : CarbonLDP.System.PlatformInstance
Volatile fragment where the actual data of the instance lives on.
CarbonLDP.System.PlatformMetadataFactory Interface
carbonldp/Vocabularies Module
Interfaces
Properties
#C : any
Constant that implements the used vocabulary of the Carbon LDP Platform.
#LDP : any
Constant that implements the used vocabulary defined for the W3C Linked Data Platform (LDP)
#RDF : any
Constant that implements the used vocabulary defined in the RDF Syntax Specification.
#SHACL : any
Constant that implements the used vocabulary of the Shapes Constraint Language (SHACL) specification.
#XSD : any
Constant the implements the vocabulary of the data-types defined in the XML Schema Definition Language (XSD).
CarbonLDP.Vocabularies.C Interface
Interface that describes the used vocabulary of the Carbon LDP Platform.
Properties
.AccessPoint : "https://carbonldp.com/ns/v1/platform#AccessPoint"
.AddMemberAction : "https://carbonldp.com/ns/v1/platform#AddMemberAction"
.ChildCreatedEvent : "https://carbonldp.com/ns/v1/platform#ChildCreatedEvent"
.Document : "https://carbonldp.com/ns/v1/platform#Document"
.DocumentCreatedEventDetails : "https://carbonldp.com/ns/v1/platform#DocumentCreatedEventDetails"
.DocumentDeletedEvent : "https://carbonldp.com/ns/v1/platform#DocumentDeletedEvent"
.DocumentMetadata : "https://carbonldp.com/ns/v1/platform#DocumentMetadata"
.DocumentModifiedEvent : "https://carbonldp.com/ns/v1/platform#DocumentModifiedEvent"
.Error : "https://carbonldp.com/ns/v1/platform#Error"
.ErrorResponse : "https://carbonldp.com/ns/v1/platform#ErrorResponse"
.Instance : "https://carbonldp.com/ns/v1/platform#Instance"
.Map : "https://carbonldp.com/ns/v1/platform#Map"
.MemberAddedEvent : "https://carbonldp.com/ns/v1/platform#MemberAddedEvent"
.MemberAddedEventDetails : "https://carbonldp.com/ns/v1/platform#MemberAddedEventDetails"
.MemberRemovedEvent : "https://carbonldp.com/ns/v1/platform#MemberRemovedEvent"
.MemberRemovedEventDetails : "https://carbonldp.com/ns/v1/platform#MemberRemovedEventDetails"
.NonReadableMembershipResourceTriples : "https://carbonldp.com/ns/v1/platform#NonReadableMembershipResourceTriples"
.Platform : "https://carbonldp.com/ns/v1/platform#Platform"
.PlatformInstance : "https://carbonldp.com/ns/v1/platform#PlatformInstance"
.PreferContainer : "https://carbonldp.com/ns/v1/platform#PreferContainer"
.PreferContainmentResources : "https://carbonldp.com/ns/v1/platform#PreferContainmentResources"
.PreferContainmentTriples : "https://carbonldp.com/ns/v1/platform#PreferContainmentTriples"
.PreferDocumentChecksums : "https://carbonldp.com/ns/v1/platform#PreferDocumentChecksums"
.PreferMembershipResources : "https://carbonldp.com/ns/v1/platform#PreferMembershipResources"
.PreferMembershipTriples : "https://carbonldp.com/ns/v1/platform#PreferMembershipTriples"
.PreferResultsContexts : "https://carbonldp.com/ns/v1/platform#PreferResultsContexts"
.PreferSelectedMembershipTriples : "https://carbonldp.com/ns/v1/platform#PreferSelectedMembershipTriples"
.QueryMetadata : "https://carbonldp.com/ns/v1/platform#QueryMetadata"
.RemoveMemberAction : "https://carbonldp.com/ns/v1/platform#RemoveMemberAction"
.ResponseMetadata : "https://carbonldp.com/ns/v1/platform#ResponseMetadata"
.ValidationError : "https://carbonldp.com/ns/v1/platform#ValidationError"
.VolatileResource : "https://carbonldp.com/ns/v1/platform#VolatileResource"
.accessPoint : "https://carbonldp.com/ns/v1/platform#accessPoint"
.bNodesMap : "https://carbonldp.com/ns/v1/platform#bNodesMap"
.buildDate : "https://carbonldp.com/ns/v1/platform#buildDate"
.checksum : "https://carbonldp.com/ns/v1/platform#checksum"
.created : "https://carbonldp.com/ns/v1/platform#created"
.createdDocument : "https://carbonldp.com/ns/v1/platform#createdDocument"
.defaultInteractionModel : "https://carbonldp.com/ns/v1/platform#defaultInteractionModel"
.details : "https://carbonldp.com/ns/v1/platform#details"
.document : "https://carbonldp.com/ns/v1/platform#document"
.documentMetadata : "https://carbonldp.com/ns/v1/platform#documentMetadata"
.entry : "https://carbonldp.com/ns/v1/platform#entry"
.entryKey : "https://carbonldp.com/ns/v1/platform#entryKey"
.entryValue : "https://carbonldp.com/ns/v1/platform#entryValue"
.error : "https://carbonldp.com/ns/v1/platform#error"
.errorCode : "https://carbonldp.com/ns/v1/platform#errorCode"
.errorDetails : "https://carbonldp.com/ns/v1/platform#errorDetails"
.errorMessage : "https://carbonldp.com/ns/v1/platform#errorMessage"
.errorParameters : "https://carbonldp.com/ns/v1/platform#errorParameters"
.httpStatusCode : "https://carbonldp.com/ns/v1/platform#httpStatusCode"
.instance : "https://carbonldp.com/ns/v1/platform#instance"
.mediaType : "https://carbonldp.com/ns/v1/platform#mediaType"
.member : "https://carbonldp.com/ns/v1/platform#member"
.modified : "https://carbonldp.com/ns/v1/platform#modified"
.namespace : "https://carbonldp.com/ns/v1/platform#"
.relatedDocument : "https://carbonldp.com/ns/v1/platform#relatedDocument"
.requestID : "https://carbonldp.com/ns/v1/platform#requestID"
.size : "https://carbonldp.com/ns/v1/platform#size"
.target : "https://carbonldp.com/ns/v1/platform#target"
.targetMember : "https://carbonldp.com/ns/v1/platform#targetMember"
.version : "https://carbonldp.com/ns/v1/platform#version"
CarbonLDP.Vocabularies.LDP Interface
Interface that describes the used vocabulary defined for the W3C Linked Data Platform (LDP)
Properties
.Ascending : "http://www.w3.org/ns/ldp#Ascending"
.BasicContainer : "http://www.w3.org/ns/ldp#BasicContainer"
.Container : "http://www.w3.org/ns/ldp#Container"
.Descending : "http://www.w3.org/ns/ldp#Descending"
.DirectContainer : "http://www.w3.org/ns/ldp#DirectContainer"
.IndirectContainer : "http://www.w3.org/ns/ldp#IndirectContainer"
.MemberSubject : "http://www.w3.org/ns/ldp#MemberSubject"
.NonRDFSource : "http://www.w3.org/ns/ldp#NonRDFSource"
.Page : "http://www.w3.org/ns/ldp#Page"
.PageSortCriterion : "http://www.w3.org/ns/ldp#PageSortCriterion"
.PreferContainment : "http://www.w3.org/ns/ldp#PreferContainment"
.PreferEmptyContainer : "http://www.w3.org/ns/ldp#PreferEmptyContainer"
.PreferMembership : "http://www.w3.org/ns/ldp#PreferMembership"
.PreferMinimalContainer : "http://www.w3.org/ns/ldp#PreferMinimalContainer"
.RDFSource : "http://www.w3.org/ns/ldp#RDFSource"
.Resource : "http://www.w3.org/ns/ldp#Resource"
.constrainedBy : "http://www.w3.org/ns/ldp#constrainedBy"
.contains : "http://www.w3.org/ns/ldp#contains"
.hasMemberRelation : "http://www.w3.org/ns/ldp#hasMemberRelation"
.insertedContentRelation : "http://www.w3.org/ns/ldp#insertedContentRelation"
.isMemberOfRelation : "http://www.w3.org/ns/ldp#isMemberOfRelation"
.member : "http://www.w3.org/ns/ldp#member"
.membershipResource : "http://www.w3.org/ns/ldp#membershipResource"
.namespace : "http://www.w3.org/ns/ldp#"
.pageSequence : "http://www.w3.org/ns/ldp#pageSequence"
.pageSortCollation : "http://www.w3.org/ns/ldp#pageSortCollation"
.pageSortCriteria : "http://www.w3.org/ns/ldp#pageSortCriteria"
.pageSortOrder : "http://www.w3.org/ns/ldp#pageSortOrder"
CarbonLDP.Vocabularies.RDF Interface
CarbonLDP.Vocabularies.SHACL Interface
Interface that describes the used vocabulary of the Shapes Constraint Language (SHACL) specification.
Properties
.ValidationReport : "http://www.w3.org/ns/shacl#ValidationReport"
.ValidationResult : "http://www.w3.org/ns/shacl#ValidationResult"
.conforms : "http://www.w3.org/ns/shacl#conforms"
.detail : "http://www.w3.org/ns/shacl#detail"
.focusNode : "http://www.w3.org/ns/shacl#focusNode"
.namespace : "http://www.w3.org/ns/shacl#"
.result : "http://www.w3.org/ns/shacl#result"
.resultMessage : "http://www.w3.org/ns/shacl#resultMessage"
.resultPath : "http://www.w3.org/ns/shacl#resultPath"
.resultSeverity : "http://www.w3.org/ns/shacl#resultSeverity"
.shapesGraphWellFormed : "http://www.w3.org/ns/shacl#shapesGraphWellFormed"
.sourceConstraintComponent : "http://www.w3.org/ns/shacl#sourceConstraintComponent"
.sourceShape : "http://www.w3.org/ns/shacl#sourceShape"
.value : "http://www.w3.org/ns/shacl#value"
CarbonLDP.Vocabularies.XSD Interface
Interface that defines the vocabulary of the data-types defined in the XML Schema Definition Language (XSD).