turtle.h
Enough Turtle to read an LV2 bundle.
#include <sonore/turtle.h>- 2types
- 1other declaration
- Guides: Hosting plugins
On this page
Design notes
LV2 describes its plugins in RDF, serialised as Turtle. A host cannot even learn a plugin's NAME without parsing it, which is why hosting LV2 needs this and hosting CLAP or VST3 does not.
This is a SUBSET, and the boundary is stated rather than discovered:
Supported: @prefix and @base, absolute and prefixed names, `a` as rdf:type, predicate lists with `;`, object lists with `,`, blank nodes both anonymous and labelled, single- and triple-quoted strings with escapes, language tags, datatype suffixes, numbers, booleans, comments, and collections.
Not supported: nothing else. In particular there is no attempt at named graphs or TriG, and a document using them is REFUSED rather than half-read. A parser that quietly skips what it does not understand hands its caller a plugin description with a hole in it, and the caller has no way to tell.
The output is triples with blank nodes given generated labels, which is all a bundle reader needs: it looks up subjects by type and follows predicates.
Types 2
One RDF statement as the parser emits it: subject, predicate, object. Names are stored resolved -- prefixed names expanded against the document's prefixes and relative references against the base -- and blank nodes as _: labels, generated for the anonymous ones, so two triples about the same thing compare equal as strings. A literal object is its text, without quotes or language tag.
One document's triples, with the prefixes it declared.
Functions 1
- fn
inline bool parse(const std::string& text, const std::string& baseUri, Document* out)Parse a Turtle document.turtle::parse · turtle.h:565baseUriresolves relative references -- for a bundle, the directory the file lives in.