Metadata actors

The current SPARQL solution in Comunica makes use of 2 types of actors for metadata purposes: metadata parsers, to find all metadata triples in a stream of triples, and metadata extractors, to find specific metadata entries in a stream of metadata triples. The first type makes use of @comunica/bus-rdf-metadata, while the second type uses @comunica/bus-rdf-metadata-extract.


The job of these actors is to take a stream of triples as input, and split that stream into a data stream and a metadata stream. For this the actors have to implement the isMetadata function. This is a simple function that takes a triple as input (together with some context), and returns a boolean to indicate whether this is a metadata or data triple. For TPF, this is done by checking the graph of the quad for example.

Metadata extract

The metadata extractors can extract certain controls from a metadata stream. For TPF this is useful to, for example, find the URL of the next page or the total amount of matching triples. These take the stream of metadata generated by the actors mentioned above, and return a metadata "object" which contains the relevant metadata values they generated. Since you usually want to combine different metadata actors to extract different metadata components, a union mediator can be used to combine the results of all the applicable actors, instead of just using the results of a single actor.