aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-12-18 19:09:49 -0500
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:06 -0500
commitfc3e5a0a7c9c64d275fec498f0e80dc02444c12d (patch)
tree538ab16491a4726431233fe22b2cd08b001281c6 /include
parentb7948f8c9ad54c30e2579fd5da4626c6f3de325a (diff)
downloadserd-fc3e5a0a7c9c64d275fec498f0e80dc02444c12d.tar.gz
serd-fc3e5a0a7c9c64d275fec498f0e80dc02444c12d.tar.bz2
serd-fc3e5a0a7c9c64d275fec498f0e80dc02444c12d.zip
Add support for parsing variables
This adds a reader flag and serdi option for extending a syntax with support for SPARQL-like variables, for storing things like patterns or simple queries.
Diffstat (limited to 'include')
-rw-r--r--include/serd/serd.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index e36dd24b..b125bb3d 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -151,7 +151,8 @@ typedef uint32_t SerdStatementFlags;
An RDF node, in the abstract sense, can be either a resource, literal, or a
blank. This type is more precise, because syntactically there are two ways
- to refer to a resource (by URI or CURIE).
+ to refer to a resource (by URI or CURIE). Serd also has support for
+ variable nodes to support some features, which are not RDF nodes.
There are also two ways to refer to a blank node in syntax (by ID or
anonymously), but this is handled by statement flags rather than distinct
@@ -190,7 +191,16 @@ typedef enum {
is meaningful only within this serialisation. @see [RDF 1.1
Turtle](http://www.w3.org/TR/turtle/#grammar-production-BLANK_NODE_LABEL)
*/
- SERD_BLANK = 4
+ SERD_BLANK = 4,
+
+ /**
+ A variable node
+
+ Value is a variable name without any syntactic prefix, like "name",
+ which is meaningful only within this serialisation. @see [SPARQL 1.1
+ Query Language](https://www.w3.org/TR/sparql11-query/#rVar)
+ */
+ SERD_VARIABLE = 5
} SerdNodeType;
/// Flags indicating certain string properties relevant to serialisation
@@ -294,7 +304,8 @@ typedef struct {
/// Reader options
typedef enum {
- SERD_READ_LAX = 1u << 0u ///< Tolerate invalid input where possible
+ SERD_READ_LAX = 1u << 0u, ///< Tolerate invalid input where possible
+ SERD_READ_VARIABLES = 1u << 1u ///< Support variable nodes
} SerdReaderFlag;
/// Bitwise OR of SerdReaderFlag values