How to use the @rdfjs/serializer-jsonld function in @rdfjs/serializer-jsonld

To help you get started, we’ve selected a few @rdfjs/serializer-jsonld examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikibus / Alcaeus / src / MediaTypeProcessors / RdfProcessor.ts View on Github external
import * as inferences from './inferences'

interface ConverterMap {
    [type: string]: (value: string, type: string) => unknown;

export interface IMediaTypeProcessor {
    canProcess(mediaType: string);
        alcaeus: IHydraClient,
        uri: string,
        response: IResponseWrapper,
        apiDocumentation?: ApiDocumentation): Promise;

const jsonldSerializer = new JsonLdSerializer()

const parserFactory = new ParserFactory()

function isRdfList (resource) {
    let isObject = typeof resource === 'object'
    if (isObject) {
        const isEmpty = resource[Constants.JsonLd.Id] === rdf.nil
        const isListNode = rdf.first in resource && in resource
        return isEmpty || isListNode

    return false

async function parseAndNormalizeGraph (responseText: string, uri: string, mediaType: string): Promise {
    const parsers = parserFactory.create(uri)


JSON-LD serializer that implements the RDF/JS Sink interface

Latest version published 3 months ago

Package Health Score

66 / 100
Full package analysis

Popular @rdfjs/serializer-jsonld functions