aboutsummaryrefslogtreecommitdiffstats
path: root/include/serd
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-07-11 18:44:03 -0400
committerDavid Robillard <d@drobilla.net>2022-01-14 19:36:06 -0500
commit5edfa72b81b46866a87d4f3c118492ee99bc0476 (patch)
tree8e98be947e8ac2d887ed3687d0c7a9948b0d0f82 /include/serd
parent7269c12bbe4532f5f5844aaec16cf1bb75a1c71c (diff)
downloadserd-5edfa72b81b46866a87d4f3c118492ee99bc0476.tar.gz
serd-5edfa72b81b46866a87d4f3c118492ee99bc0476.tar.bz2
serd-5edfa72b81b46866a87d4f3c118492ee99bc0476.zip
Remove SERD_CURIE node datatype entirely
Diffstat (limited to 'include/serd')
-rw-r--r--include/serd/serd.h70
1 files changed, 36 insertions, 34 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index 7be9395c..05c1ed8c 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -570,21 +570,13 @@ typedef enum {
SERD_URI = 2,
/**
- CURIE, a shortened URI.
-
- Value is an unquoted CURIE string relative to the current environment,
- e.g. "rdf:type". @see [CURIE Syntax 1.0](http://www.w3.org/TR/curie)
- */
- SERD_CURIE = 3,
-
- /**
A blank node.
Value is a blank node ID without any syntactic prefix, like "id3", which
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 = 3,
/**
A variable node.
@@ -593,7 +585,7 @@ typedef enum {
which is meaningful only within this serialisation. @see [SPARQL 1.1
Query Language](https://www.w3.org/TR/sparql11-query/#rVar)
*/
- SERD_VARIABLE = 5
+ SERD_VARIABLE = 4
} SerdNodeType;
/**
@@ -639,11 +631,6 @@ SERD_API
SerdNode* SERD_ALLOCATED
serd_new_blank(SerdStringView string);
-/// Create a new CURIE node
-SERD_API
-SerdNode* SERD_ALLOCATED
-serd_new_curie(SerdStringView string);
-
/// Create a new URI node
SERD_API
SerdNode* SERD_ALLOCATED
@@ -1000,15 +987,6 @@ const SerdNode* SERD_ALLOCATED
serd_nodes_uri(SerdNodes* SERD_NONNULL nodes, SerdStringView string);
/**
- Make a CURIE node.
-
- A new node will be added if an equivalent node is not already in the set.
-*/
-SERD_API
-const SerdNode* SERD_ALLOCATED
-serd_nodes_curie(SerdNodes* SERD_NONNULL nodes, SerdStringView string);
-
-/**
Make a blank node.
A new node will be added if an equivalent node is not already in the set.
@@ -1636,25 +1614,50 @@ serd_env_set_prefix(SerdEnv* SERD_NONNULL env,
SerdStringView uri);
/**
- Qualify `uri` into a CURIE if possible.
+ Qualify `uri` into a prefix and suffix (like a CURIE) if possible.
+
+ @param env Environment with prefixes to use.
+
+ @param uri URI to qualify.
+
+ @param prefix On success, pointed to a prefix string slice, which is only
+ valid until the next time `env` is mutated.
- Returns null if `uri` can not be qualified (usually because no corresponding
- prefix is defined).
+ @param suffix On success, pointed to a suffix string slice, which is only
+ valid until the next time `env` is mutated.
+
+ @return #SERD_SUCCESS, or #SERD_FAILURE if `uri` can not be qualified with
+ `env`.
+*/
+SERD_API
+SerdStatus
+serd_env_qualify(const SerdEnv* SERD_NULLABLE env,
+ SerdStringView uri,
+ SerdStringView* SERD_NONNULL prefix,
+ SerdStringView* SERD_NONNULL suffix);
+
+/**
+ Expand `curie` to an absolute URI if possible.
+
+ For example, if `env` has the prefix "rdf" set to
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, then calling this with curie
+ "rdf:type" will produce <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>.
+
+ Returns null if `node` can not be expanded.
*/
SERD_API
SerdNode* SERD_ALLOCATED
-serd_env_qualify(const SerdEnv* SERD_NULLABLE env,
- const SerdNode* SERD_NULLABLE uri);
+serd_env_expand_curie(const SerdEnv* SERD_NULLABLE env, SerdStringView curie);
/**
- Expand `node`, which must be a CURIE or URI, to a full URI.
+ Expand `node` to an absolute URI if possible.
Returns null if `node` can not be expanded.
*/
SERD_API
SerdNode* SERD_ALLOCATED
-serd_env_expand(const SerdEnv* SERD_NULLABLE env,
- const SerdNode* SERD_NULLABLE node);
+serd_env_expand_node(const SerdEnv* SERD_NULLABLE env,
+ const SerdNode* SERD_NULLABLE node);
/// Write all prefixes in `env` to `sink`
SERD_API
@@ -1740,8 +1743,7 @@ typedef enum {
SERD_READ_LAX = 1u << 0u, ///< Tolerate invalid input where possible
SERD_READ_VARIABLES = 1u << 1u, ///< Support variable nodes
SERD_READ_EXACT_BLANKS = 1u << 2u, ///< Allow clashes with generated blanks
- SERD_READ_PREFIXED = 1u << 3u, ///< Do not expand prefixed names
- SERD_READ_RELATIVE = 1u << 4u, ///< Do not expand relative URI references
+ SERD_READ_RELATIVE = 1u << 3u, ///< Do not expand relative URI references
} SerdReaderFlag;
/// Bitwise OR of SerdReaderFlag values