aboutsummaryrefslogtreecommitdiffstats
path: root/include/serd
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-08-12 13:23:59 -0400
committerDavid Robillard <d@drobilla.net>2022-01-28 21:57:07 -0500
commitda7940afb82d8d1dd5321b311f27340f5702aea2 (patch)
tree43f4caf75a0e49a59db03d129ec837ea4972cf25 /include/serd
parent4339b6f9cb0da8a9d6519077f4a0ecc385cc382c (diff)
downloadserd-da7940afb82d8d1dd5321b311f27340f5702aea2.tar.gz
serd-da7940afb82d8d1dd5321b311f27340f5702aea2.tar.bz2
serd-da7940afb82d8d1dd5321b311f27340f5702aea2.zip
Split SERD_READ_VERBATIM into two more precise flags
Although the "verbatim" idea is nice and simple, more fine-grained control is necessary since these features (relative URI preservation and blank node label clash avoidance) are useful in different situations.
Diffstat (limited to 'include/serd')
-rw-r--r--include/serd/serd.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index 3f59ded6..c30c656b 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -2287,18 +2287,27 @@ typedef enum {
SERD_READ_VARIABLES = 1u << 1u,
/**
- Read URIs and blank node labels exactly.
+ Read relative URI references exactly without resolving them.
- Normally, the reader expands all relative URIs, and may adjust blank node
- labels to avoid clashing with generated ones. This flag disables all of
- this processing, so that URI references and blank nodes are passed to the
- sink exactly as they are in the input.
+ Normally, the reader expands all relative URIs against the base URI. This
+ flag disables that, so that URI references are passed to the sink exactly
+ as they are in the input.
+ */
+ SERD_READ_RELATIVE = 1u << 2u,
+
+ /**
+ Read blank node labels without adding a prefix unique to the document.
- Note that this does not apply to CURIEs, since serd deliberately does not
- have a way to represent CURIE nodes. A bad namespace prefix is considered
- a syntax error.
+ Normally, the reader adds a prefix like "f1", "f2", and so on, to blank
+ node labels, to separate the namespaces from separate input documents.
+ This flag disables that, so that blank node labels will be read without
+ any prefix added.
+
+ Note that this flag should be used carefully, since it can result in data
+ corruption. Specifically, if data from separate documents parsed with
+ this flag is combined, the IDs from each document may clash.
*/
- SERD_READ_VERBATIM = 1u << 2u,
+ SERD_READ_GLOBAL = 1u << 3u,
/**
Read generated blank node labels exactly without adjusting them.
@@ -2313,7 +2322,7 @@ typedef enum {
anonymous nodes, the generated IDs for those nodes may clash with IDs from
the input document.
*/
- SERD_READ_GENERATED = 1u << 3u,
+ SERD_READ_GENERATED = 1u << 4u,
} SerdReaderFlag;
/// Bitwise OR of SerdReaderFlag values
@@ -2507,7 +2516,7 @@ typedef enum {
potentially writem them as relative URI references. This flag disables
that, so URI nodes are written exactly as they are received.
- When fed by a reader with #SERD_READ_VERBATIM enabled, this will write URI
+ When fed by a reader with #SERD_READ_RELATIVE enabled, this will write URI
references exactly as they are in the input.
*/
SERD_WRITE_VERBATIM = 1u << 2u,