Nevertheless! Party Metaphorically

    @rdfjs/formats-common
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/rdfjs__formats-common package

    2.2.0 • Public • Published

    @rdfjs/formats-common

    Build Status

    npm version

    This module bundles parsers and serializers for the most common RDF formats. Instances of SinkMap are used to handle different media types.

    Usage

    The formats object has a parsers and serializers property. Each of it is an instance of SinkMap with the most common RDF media types as key.

    Example

    const formats = require('@rdfjs/formats-common')
    const Readable = require('stream').Readable
    
    const input = new Readable({
      read: () => {
        input.push(`
          PREFIX s: <http://schema.org/>
    
          [] a s:Person ;
            s:jobTitle "Professor" ;
            s:name "Jane Doe" ;
            s:telephone "(425) 123-4567" ;
            s:url <http://www.janedoe.com> .
        `)
        input.push(null)
      }
    })
    
    const output = formats.parsers.import('text/turtle', input)
    
    output.on('data', quad => {
      console.log(`quad: ${quad.subject.value} - ${quad.predicate.value} - ${quad.object.value}`)
    })
    
    output.on('prefix', (prefix, ns) => {
      console.log(`prefix: ${prefix} ${ns.value}`)
    })

    Install

    npm i @rdfjs/formats-common

    DownloadsWeekly Downloads

    1,440

    Version

    2.2.0

    License

    MIT

    Unpacked Size

    7.58 kB

    Total Files

    7

    Last publish

    Collaborators

    • bergos
    • l00mi