aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
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 /src/writer.c
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 'src/writer.c')
-rw-r--r--src/writer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/writer.c b/src/writer.c
index 30e09a4f..b7814158 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -841,7 +841,7 @@ write_uri_node(SerdWriter* const writer,
const char* node_str = serd_node_string(node);
const bool has_scheme = serd_uri_string_has_scheme(node_str);
if (supports_abbrev(writer)) {
- if (field == SERD_PREDICATE &&
+ if (!(writer->flags & SERD_WRITE_RDF_TYPE) && field == SERD_PREDICATE &&
serd_node_equals(node, writer->world->rdf_type)) {
return esink("a", 1, writer);
}