Class RDFSerializer

Hierarchy

  • DataSerializer
    • RDFSerializer

Constructors

Properties

deserializer: Deserializer
eventEmitter: EventEmitter
knownRDFTypes: Map<`http://${string}` | `https://${string}`, string[]> = ...
knownTypes: Map<string, Serializable<any>>
options: DataSerializerConfig = ...
serializer: Serializer

Methods

  • Clone a serializable object

    Type Parameters

    • T

    • D = T

    Parameters

    • object: T

      Serializable object

    • Optional dataType: Constructor<D>

      Data type to clone to

    Returns D

    Cloned object

  • Deserialize data

    Type Parameters

    • T

    Parameters

    • serializedData: Thing

      Data to deserialze

    • Optional dataType: Serializable<T>

      Optional data type to specify deserialization type

    Returns T

    Deserialized object

  • Deserialize data

    Type Parameters

    • T

    Parameters

    • serializedData: any[]

      Data to deserialze

    • Optional dataType: Serializable<T>

      Optional data type to specify deserialization type

    Returns T | T[]

    Deserialized object

  • Type Parameters

    • T

    Parameters

    • subject: `http://${string}` | `https://${string}`
    • input: string

    Returns T

  • Type Parameters

    • T

    Parameters

    • subject: `http://${string}` | `https://${string}`
    • subjects: Subject[]

    Returns T

  • Find the root TypedJSON metadata

    Parameters

    • proto: any

      Prototype of target

    Returns ObjectMetadata

    Root object metadata

    Deprecated

    use DataSerializerUtils.getRootMetadata

  • Parameters

    • name: string

    Returns Serializable<any>

  • Get the TypedJSON metadata

    Parameters

    • proto: any

      Prototype of target

    Returns ObjectMetadata

    Root object metadata

    Deprecated

    use DataSerializerUtils.getMetadata

    See

    https://gist.github.com/krizka/c83fb1966dd57997a1fc02625719387d

  • Get the root TypedJSON metadata

    Parameters

    • proto: any

      Prototype of target

    Returns ObjectMetadata

    Root object metadata

    Deprecated

    use DataSerializerUtils.getRootMetadata

    See

    https://gist.github.com/krizka/c83fb1966dd57997a1fc02625719387d

  • Type Parameters

    • T

    Parameters

    • dataType: Serializable<T>

    Returns ObjectMemberMetadata

  • Type Parameters

    • T

    Parameters

    • dataType: Serializable<T>
    • identifier: any
    • baseUri: `http://${string}` | `https://${string}`

    Returns `http://${string}` | `https://${string}`

  • Manually register a new type

    Type Parameters

    • T

    Parameters

    • type: Serializable<T>

      Type to register

    • Optional converters: MappedTypeConverters<T>

      Optional converters

    Returns void

  • Type Parameters

    • T

    Parameters

    • data: T
    • Optional baseUri: `http://${string}` | `https://${string}`

    Returns Quad[]

  • Serialize an object to an URI

    Type Parameters

    • T

    Parameters

    • data: T

      Data to serialize to an URI

    • Optional baseUri: `http://${string}` | `https://${string}`

      Base URI

    Returns `http://${string}` | `https://${string}`

    Resource URI

  • Stringify a thing to RDF graph construct

    Parameters

    • thing: any

      Thing to serialize

    • Optional options: WriterOptions = {}

      Writer options

    Returns Promise<string>

    Promise of a stringified graph

  • Unregister a type

    Parameters

    • type: Serializable<any>

      Type to unregister

    Returns void