aboutsummaryrefslogtreecommitdiffstats
path: root/include/serd/reader.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-10-10 12:31:29 +0200
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit155f5e2f24c24f5b5ffbf13fcea5cf1a355ec372 (patch)
tree5f5f7009e96379aa0e31cb1db3757f8d6589669f /include/serd/reader.h
parente8f392d57bf6eba9b62509a32e4073e8b34b18e2 (diff)
downloadserd-155f5e2f24c24f5b5ffbf13fcea5cf1a355ec372.tar.gz
serd-155f5e2f24c24f5b5ffbf13fcea5cf1a355ec372.tar.bz2
serd-155f5e2f24c24f5b5ffbf13fcea5cf1a355ec372.zip
[WIP] Simplify reader and writer flags
[WIP] Testing?
Diffstat (limited to 'include/serd/reader.h')
-rw-r--r--include/serd/reader.h41
1 files changed, 37 insertions, 4 deletions
diff --git a/include/serd/reader.h b/include/serd/reader.h
index b6b9cac3..e25565cb 100644
--- a/include/serd/reader.h
+++ b/include/serd/reader.h
@@ -30,10 +30,43 @@ typedef struct SerdReaderImpl SerdReader;
/// Reader options
typedef enum {
- SERD_READ_LAX = 1U << 0U, ///< Tolerate invalid input where possible
- SERD_READ_VARIABLES = 1U << 1U, ///< Support variable nodes
- SERD_READ_PREFIXED = 1U << 2U, ///< Do not expand prefixed names
- SERD_READ_RELATIVE = 1U << 3U, ///< Do not expand relative URI references
+ /**
+ Tolerate invalid input where possible.
+
+ This will attempt to ignore invalid input and continue reading. Invalid
+ Unicode characters will be replaced with the replacement character, and
+ various other syntactic problems will be ignored. If there are more
+ severe problems, the reader will try to skip the statement and continue
+ parsing. This should work reasonably well for line-based syntaxes like
+ NTriples and NQuads, but abbreviated Turtle or TriG may not recover.
+
+ Note that this flag should be used carefully, since it can result in data
+ loss.
+ */
+ SERD_READ_LAX = 1U << 0U,
+
+ /**
+ Support reading variable nodes.
+
+ As an extension, serd supports reading variables nodes with SPARQL-like
+ syntax, for example "?foo" or "$bar". This can be used for storing
+ graph patterns and templates.
+ */
+ SERD_READ_VARIABLES = 1U << 1U,
+
+ /**
+ Read URIs and blank node labels exactly.
+
+ 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.
+
+ 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.
+ */
+ SERD_READ_VERBATIM = 1U << 2U,
} SerdReaderFlag;
/// Bitwise OR of SerdReaderFlag values