diff options
Diffstat (limited to 'serd')
-rw-r--r-- | serd/serd.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/serd/serd.h b/serd/serd.h index bac74adc..a43acbca 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -671,6 +671,44 @@ serd_uri_serialise_relative(const SerdURI* uri, */ /** + Create a node from a string representation in `syntax`. + + The string should be a node as if written as an object in the given syntax, + without any extra quoting or punctuation, which is the format returned by + serd_node_to_syntax(). These two functions, when used with #SERD_TURTLE, + can be used to round-trip any node to a string and back. + + @param str String representation of a node. + + @param syntax Syntax to use. Should be either SERD_TURTLE or SERD_NTRIPLES + (the others are redundant). Note that namespaced (CURIE) nodes and relative + URIs can not be expressed in NTriples. + + @return A newly allocated node that must be freed with serd_node_free(). +*/ +SERD_API +SerdNode* +serd_node_from_syntax(const char* str, SerdSyntax syntax); + +/** + Return a string representation of `node` in `syntax`. + + The returned string represents that node as if written as an object in the + given syntax, without any extra quoting or punctuation. + + @param node Node to serialise. + + @param syntax Syntax to use. Should be either SERD_TURTLE or SERD_NTRIPLES + (the others are redundant). Note that namespaced (CURIE) nodes and relative + URIs can not be expressed in NTriples. + + @return A newly allocated string that must be freed with serd_free(). +*/ +SERD_API +char* +serd_node_to_syntax(const SerdNode* node, SerdSyntax syntax); + +/** Create a new "simple" node that is just a string. This can be used to create blank, CURIE, or URI nodes from an already |