summaryrefslogtreecommitdiffstats
path: root/sratom
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-22 03:16:11 +0000
committerDavid Robillard <d@drobilla.net>2012-05-22 03:16:11 +0000
commit6dbc5e28881722e3e900bd235ac3317cce94cc5b (patch)
tree6c4015d62284127ba95da9ffc4a0d7ef302a71bd /sratom
parent1627fd1a5a1522e06ad16c89efb24dc630eb4b53 (diff)
downloadsratom-6dbc5e28881722e3e900bd235ac3317cce94cc5b.tar.gz
sratom-6dbc5e28881722e3e900bd235ac3317cce94cc5b.tar.bz2
sratom-6dbc5e28881722e3e900bd235ac3317cce94cc5b.zip
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
Diffstat (limited to 'sratom')
-rw-r--r--sratom/sratom.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/sratom/sratom.h b/sratom/sratom.h
index 046210a..8183be0 100644
--- a/sratom/sratom.h
+++ b/sratom/sratom.h
@@ -62,6 +62,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.
*/
SRATOM_API
@@ -101,6 +126,14 @@ 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().
@return 0 on success, or a non-zero error code otherwise.
@@ -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.