diff options
author | David Robillard <d@drobilla.net> | 2021-08-12 13:23:59 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 3ea3143632e3577ac5794faed1141e460a11a9fb (patch) | |
tree | fbcf61902714cc54e99fe5c0acdd90fa46e4967e /include/serd/reader.h | |
parent | fa4c14acdeeabaf7aee0304a57ae7878ecea1776 (diff) | |
download | serd-3ea3143632e3577ac5794faed1141e460a11a9fb.tar.gz serd-3ea3143632e3577ac5794faed1141e460a11a9fb.tar.bz2 serd-3ea3143632e3577ac5794faed1141e460a11a9fb.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/reader.h')
-rw-r--r-- | include/serd/reader.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/include/serd/reader.h b/include/serd/reader.h index d62428cf..34af6d04 100644 --- a/include/serd/reader.h +++ b/include/serd/reader.h @@ -55,18 +55,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. @@ -81,7 +90,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 |