From 6dbc5e28881722e3e900bd235ac3317cce94cc5b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 22 May 2012 03:16:11 +0000 Subject: Add API to control whether named resources are read as LV2 objects or URIs. git-svn-id: http://svn.drobilla.net/lad/trunk/sratom@4431 a436a847-0d15-0410-975c-d299462d15a1 --- sratom/sratom.h | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'sratom') diff --git a/sratom/sratom.h b/sratom/sratom.h index 046210a..8183be0 100644 --- a/sratom/sratom.h +++ b/sratom/sratom.h @@ -61,6 +61,31 @@ extern "C" { */ typedef struct SratomImpl Sratom; +/** + Mode for reading resources to LV2 Objects. + + This affects how resources (which are either blank nodes or have URIs) are + read by sratom_read(), since they may be read as simple references (a URI or + blank node ID) or a complete description (an atom "Object"). + + Currently, blank nodes are always read as Objects, but support for reading + blank node IDs may be added in the future. +*/ +typedef enum { + /** + Read blank nodes as Objects, and named resources as URIs. + */ + SRATOM_OBJECT_MODE_BLANK, + + /** + Read blank nodes and the main subject as Objects, and any other named + resources as URIs. The "main subject" is the subject parameter passed + to sratom_read(); if this is a resource it will be read as an Object, + but all other named resources encountered will be read as URIs. + */ + SRATOM_OBJECT_MODE_BLANK_SUBJECT, +} SratomObjectMode; + /** Create a new Atom serialiser. */ @@ -100,6 +125,14 @@ void sratom_set_pretty_numbers(Sratom* sratom, bool pretty_numbers); +/** + Configure how resources will be read to form LV2 Objects. +*/ +SRATOM_API +void +sratom_set_object_mode(Sratom* sratom, + SratomObjectMode object_mode); + /** Write an Atom to RDF. The serialised atom is written to the sink set by sratom_set_sink(). @@ -126,7 +159,7 @@ sratom_read(Sratom* sratom, LV2_Atom_Forge* forge, SordWorld* world, SordModel* model, - const SordNode* node); + const SordNode* subject); /** Serialise an Atom to a Turtle string. -- cgit v1.2.1