aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2022-01-28Simplify input stream APIDavid Robillard6-164/+220
More or less the same rationale as the previous commit, but for reading. This makes for nice symmetry with writing, at the cost of a slightly more annoying reader interface since the source doesn't know its block size or name.
2022-01-28Simplify output stream APIDavid Robillard7-207/+264
This makes the paging mechanism an internal detail once again. While it's conceptually elegant to simply have a single write interface and have the block dumper just be another implementation of that, unfortunately it is not practical. The inlining of serd_block_dumper_write() is a significant performance boost, because it avoids a non-inlinable function call of overhead per character. Compared to the SerdByteSink approach, this removes the burden and overhead of needing to dynamically allocate the structure itself.
2022-01-28Provide a full output stream implementation for SerdBufferDavid Robillard4-41/+58
Essentially replaces serd_buffer_sink_finish() with serd_buffer_close(), which makes writing to a buffer consistent with writing to a file or anything else.
2022-01-28Remove SERD_NO_INLINE_OBJECTSDavid Robillard1-19/+8
This seems like pointless complexity now, since it's easy to just write simply ordered statements yourself.
2022-01-28Put rdf:type properties first when pretty-printingDavid Robillard3-72/+119
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.
2022-01-28Fix TriG graph indentationDavid Robillard1-5/+10
2022-01-28Ensure that indentation is always reset with the writer contextDavid Robillard1-3/+1
2022-01-28Fix pretty-printing nested empty lists and add test suiteDavid Robillard3-7/+15
The earlier "test" was just hitting the code without actually checking the output. This new suite is a set of pretty-printed documents which serd must reproduce from a model exactly to pass. This should make it easy to add cases in the future, since each case is just a document, as it should look.
2022-01-28Replace serdi with more fine-grained toolsDavid Robillard1-2/+0
Especially with the new functionality, the complexity of the command-line interface alone was really becoming unmanageable. The serdi implementation also had the highest cyclomatic complexity of the entire codebase by a huge margin. So, take a page from the Unix philosophy and split serdi into several more finely-honed tools that can be freely composed. Though there is still unfortunately quite a bit of option overlap between them due to the common details of reading RDF, I think the resulting tools are a lot easier to understand, both from a user and a developer perspective.
2022-01-28Make blank node prefixing automaticDavid Robillard5-56/+22
Though potentially useful, I don't think the complexity cost of the old interface (both to the implementation and to the user) is worth it. A special tool to transform blank node labels (for example with regular expressions) would be a better approach to this if it's ever needed in the future.
2022-01-28Split SERD_READ_VERBATIM into two more precise flagsDavid Robillard2-2/+2
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.
2022-01-28Add a reader flag to disable generated blank label avoidanceDavid Robillard2-4/+11
2022-01-28Add a close function to SerdByteSinkDavid Robillard3-45/+38
This simplifies everything by replacing special cases with a more general close function. A type is no longer stored in the structure, so the other constructors are now essentially syntactic sugar for the universal serd_byte_sink_new_function().
2022-01-28Expose serd_strncasecmp in public APIDavid Robillard3-15/+16
2022-01-28Preserve anonymous graph syntax in TriGDavid Robillard2-1/+3
2022-01-28Move serdi to tools subdirectoryDavid Robillard3-702/+0
This separates the command-line tool code from the library implementation.
2022-01-28Replace serdi -b and -e options with a block size optionDavid Robillard4-47/+45
This is more powerful, and reduces the number of command line options that almost nobody needs to care about.
2022-01-28Factor out duplicated ByteSource buffer allocation codeDavid Robillard1-14/+14
2022-01-28Factor out setting base URI from a pathDavid Robillard3-11/+23
2022-01-28Factor out opening output filesDavid Robillard3-5/+16
2022-01-28Factor out opening input filesDavid Robillard3-12/+34
2022-01-28Factor out command line version printingDavid Robillard3-17/+23
2022-01-28Factor out Windows UTF-8 console setup codeDavid Robillard3-12/+58
2022-01-28Add version constants to public headerDavid Robillard2-6/+7
2022-01-28Make serd_writer_set_root_uri() take a string viewDavid Robillard2-6/+4
This is generally more convenient, and the node was just being copied anyway.
2022-01-28Simplify reader and writer flagsDavid Robillard5-8/+8
2022-01-28Support writing all escapes in Turtle and TriG prefixed namesDavid Robillard3-87/+107
2022-01-28Factor out and expose prefixed name predicatesDavid Robillard5-55/+90
Towards using these in the writer to escape names more precisely.
2022-01-28Add assertions for all non-null pointers in the public APIDavid Robillard22-2/+223
Clang issues warnings at build time based on the SERD_NONNULL annotations, which is a much better approach in general. However, it does not cover cases where the API is being used with another compiler, or without a compiler that can statically check things at all (such as Python or other dynamic language bindings). In those situations, getting a clear assertion message is a lot less confusing than a random crash somewhere in serd, and it makes it clear that the bug is in the caller, so I think it's worth the tedious verbosity.
2022-01-14Add statement filteringDavid Robillard2-3/+207
2022-01-14Add support for converting literals to canonical formDavid Robillard4-8/+214
2022-01-14Add modelDavid Robillard13-5/+1741
2022-01-14Use Nodes in Env implementationDavid Robillard1-46/+58
2022-01-14Avoid dynamic allocation when fetching interned nodesDavid Robillard7-351/+1247
This is more or less a total rewrite of SerdNodes and the underlying ZixHash to make efficient use of the new node construction API.
2022-01-14Avoid dynamic allocation of world blank nodeDavid Robillard2-8/+16
2022-01-14Expose low-level node construction APIDavid Robillard7-271/+519
2022-01-14Remove serd_new_resolved_uri()David Robillard3-76/+36
2022-01-14Rename serd_new_simple_node() to serd_new_token()David Robillard1-7/+3
Things get confusing without a term for this concept (which is roughly "nodes that are not annoying to construct"), so "token" it is.
2022-01-14Preserve long or short quoting from input documentsDavid Robillard7-158/+88
2022-01-14Factor out serd_write_file_uri()David Robillard2-70/+76
2022-01-14Add serd_statement_matches()David Robillard2-0/+22
2022-01-14Add serd_node_compare()David Robillard2-0/+33
2022-01-14Add serd_node_from_syntax() and serd_node_to_syntax()David Robillard3-0/+150
2022-01-14Leave statement caret at the start of literalsDavid Robillard3-5/+23
This allows a precise location to be reported for errors within literals, by adding the offset of the error in the literal to the caret. This will be used to report nice errors for things like regular expressions and supported XSD datatypes.
2022-01-14Reduce complexity of Turtle and TriG block reading functionsDavid Robillard1-89/+109
2022-01-14Reduce complexity of Turtle object reading functionDavid Robillard1-56/+73
2022-01-14Factor out NQuads readerDavid Robillard7-117/+189
2022-01-14Factor out NTriples readerDavid Robillard6-543/+1116
2022-01-14Factor out UTF-8 reading utilitiesDavid Robillard3-86/+153
2022-01-14Reduce complexity of blank node reading functionsDavid Robillard1-17/+33