README
@rdfjs-elements/formats-pretty
Common RDF/JS parsers and serializers, the latter returning a nicely formatted output.
For basic usage see @rdfjs/formats-common
Serializers
| Format | Pretty or not | Implementation | | -- | -- | -- | | application/ld+json | 😀 | @rdfjs/serializer-jsonld-ext | | application/trig | 🤩 | @graphy/content.trig.writer | | text/n3 | 🤩 | @graphy/content.ttl.writer | | text/turtle | 🤩 | @graphy/content.ttl.writer | | application/n-triples | 😶 | @rdfjs/serializer-ntriples | | application/n-quads | 😶 | @rdfjs/serializer-ntriples | | application/rdf+xml | 😶 | @graphy/content.xml.scribe |
Individual serializer skins can also be created by importing from @rdfjs-elements/formats-pretty/serializers
. This
allows for initializing a sink preloaded with a given set of prefixes.
import prefixes from '@zazuko/rdf-vocabularies/prefixes'
import { turtle } from '@rdfjs-elements/formats-pretty/serializers'
const { schema, dcterms, foaf } = prefixes
const sink = await turtle({
prefixes: { schema, dcterms, foaf }
})
Parsers
| Format | Implementation | | -- | -- | | application/ld+json | @rdfjs/parser-jsonld | | application/trig | @rdfjs/parser-n3 | | text/n3 | @rdfjs/parser-n3 | | text/turtle | @rdfjs/parser-n3 | | application/n-triples | @rdfjs/parser-n3 | | application/n-quads | @rdfjs/parser-n3 | | application/rdf+xml | rdfxml-streaming-parser |