aboutsummaryrefslogtreecommitdiffstats
path: root/include/serd/serd.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-08-12 22:33:47 -0400
committerDavid Robillard <d@drobilla.net>2022-01-28 21:57:07 -0500
commit196db2ef0cd44c3fb542b86be7929bd01d83e138 (patch)
tree97ad345394e394c0d42b43fcf3d464794f719ccb /include/serd/serd.h
parentfdf837b4b3baffc65e429c2e6ecc2e764bfed0ac (diff)
downloadserd-196db2ef0cd44c3fb542b86be7929bd01d83e138.tar.gz
serd-196db2ef0cd44c3fb542b86be7929bd01d83e138.tar.bz2
serd-196db2ef0cd44c3fb542b86be7929bd01d83e138.zip
Put rdf:type properties first when pretty-printing
This is a common convention in Turtle and TriG because the special "a" syntax for rdf type as the first property looks nice, makes things easier to read, and can be useful for streaming implementations because the type of the instance is known before reading its properties. Also significantly clean up the pretty-printing implementation in the process.
Diffstat (limited to 'include/serd/serd.h')
-rw-r--r--include/serd/serd.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index 1f46e092..07f6b9f5 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -2523,7 +2523,14 @@ typedef enum {
particular invalid UTF-8 text. Note that this flag should be used
carefully, since it can result in data loss.
*/
- SERD_WRITE_LAX = 1u << 4u
+ SERD_WRITE_LAX = 1u << 4u,
+
+ /**
+ Write rdf:type as a normal predicate.
+
+ This disables the special "a" syntax in Turtle and TriG.
+ */
+ SERD_WRITE_RDF_TYPE = 1u << 5u
} SerdWriterFlag;
/// Bitwise OR of SerdWriterFlag values
@@ -2629,7 +2636,7 @@ serd_cursor_copy(const SerdCursor* SERD_NULLABLE cursor);
/// Return the statement pointed to by `cursor`
SERD_API
const SerdStatement* SERD_NULLABLE
-serd_cursor_get(const SerdCursor* SERD_NONNULL cursor);
+serd_cursor_get(const SerdCursor* SERD_NULLABLE cursor);
/**
Increment cursor to point to the next statement.
@@ -2671,7 +2678,8 @@ serd_cursor_free(SerdCursor* SERD_NULLABLE cursor);
/// Flags that control the style of a model serialisation
typedef enum {
- SERD_NO_INLINE_OBJECTS = 1u << 0u ///< Disable object inlining
+ SERD_NO_INLINE_OBJECTS = 1u << 0u, ///< Disable object inlining
+ SERD_NO_TYPE_FIRST = 1u << 1u ///< Disable writing rdf:type ("a") first
} SerdDescribeFlag;
/// Bitwise OR of SerdDescribeFlag values