Documentation

JsonLdStreamSerializer
in package
implements SerializerInterface uses TmpStreamSerializerTrait

A steaming JsonLD serializer. Generates output in the flatten JsonLD format and does it in a greedy way (meaning subjects/predicates/values are acumulated within graph/subject/predicate only if adjacent triples share the same graph/subject/predicate). On the brigh side it's fast and has minimal memory footprint.

To use this parser with the \quickRdfIo\Util::serialize() use the special jsonld-stream value as $format.

Tags
author

zozlak

Table of Contents

Interfaces

SerializerInterface

Constants

DEFAULT_GRAPH_ID  = '_:defaultGraph'
MODE_GRAPH  = 2
MODE_TRIPLES  = 1

Properties

$context  : array<string, string>
$contextJson  : string
$firstValue  : bool
$mode  : int
$prevGraph  : TermInterface
$prevPredicate  : TermInterface
$prevSubject  : TermInterface

Methods

__construct()  : mixed
serialize()  : string
serializeStream()  : void
prepareContext()  : void
processGraph()  : void
processObject()  : void
processPredicate()  : void
processSubject()  : void
serializeId()  : string
serializeNode()  : mixed

Constants

Properties

Methods

__construct()

public __construct([int $mode = self::MODE_GRAPH ]) : mixed
Parameters
$mode : int = self::MODE_GRAPH

serializeStream()

public serializeStream(resource|StreamInterface $output, Traversable<string|int, QuadInterface>|array<string|int, QuadInterface$graph[, RdfNamespaceInterface|null $nmsp = null ]) : void
Parameters
$output : resource|StreamInterface

output to serialize to

$graph : Traversable<string|int, QuadInterface>|array<string|int, QuadInterface>

data to serialize

$nmsp : RdfNamespaceInterface|null = null

allows to provide context for predicates. For that, register full predicate URIs as namespaces in the $nmsp object.


        
On this page

Search results