aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-07-11 18:44:03 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit3a4bd5f1b31cb5c1522d9e6c7222414342682467 (patch)
treef4d7f87260cdcdd39ad4051c113cadf149c4fa43 /include
parent8c67f9eba47d30913749e607c440b170a5cbd804 (diff)
downloadserd-3a4bd5f1b31cb5c1522d9e6c7222414342682467.tar.gz
serd-3a4bd5f1b31cb5c1522d9e6c7222414342682467.tar.bz2
serd-3a4bd5f1b31cb5c1522d9e6c7222414342682467.zip
[WIP] Remove SERD_CURIE node datatype entirely
Diffstat (limited to 'include')
-rw-r--r--include/serd/env.h39
-rw-r--r--include/serd/node.h16
2 files changed, 29 insertions, 26 deletions
diff --git a/include/serd/env.h b/include/serd/env.h
index bfbda520..b4f908a9 100644
--- a/include/serd/env.h
+++ b/include/serd/env.h
@@ -61,32 +61,47 @@ serd_env_set_prefix(SerdEnv* ZIX_NONNULL env,
SerdStringView uri);
/**
- Qualify `uri` into a CURIE if possible.
+ Qualify `uri` into a prefix and suffix (like a CURIE) if possible.
- Returns null if `uri` can not be qualified (usually because no corresponding
- prefix is defined).
+ @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.
+
+ @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 SerdNode* ZIX_ALLOCATED
-serd_env_qualify(const SerdEnv* ZIX_NULLABLE env,
- const SerdNode* ZIX_NULLABLE uri);
+SERD_API SerdStatus
+serd_env_qualify(const SerdEnv* ZIX_NULLABLE env,
+ SerdStringView uri,
+ SerdStringView* ZIX_NONNULL prefix,
+ SerdStringView* ZIX_NONNULL suffix);
/**
- Expand `node`, which must be a CURIE or URI, to a full URI.
+ 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* ZIX_ALLOCATED
-serd_env_expand(const SerdEnv* ZIX_NULLABLE env,
- const SerdNode* ZIX_NULLABLE node);
+serd_env_expand_curie(const SerdEnv* ZIX_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* ZIX_ALLOCATED
-serd_env_expand_node(const SerdEnv* ZIX_NULLABLE env,
- const SerdNode* ZIX_NONNULL node);
+serd_env_expand_node(const SerdEnv* ZIX_NULLABLE env,
+ const SerdNode* ZIX_NULLABLE node);
/// Write all prefixes in `env` to `sink`
SERD_API SerdStatus
diff --git a/include/serd/node.h b/include/serd/node.h
index 90ecde71..b0b14a24 100644
--- a/include/serd/node.h
+++ b/include/serd/node.h
@@ -69,14 +69,6 @@ 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.
A blank node is a resource that has no URI. The identifier of a blank
@@ -86,7 +78,7 @@ typedef enum {
@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.
@@ -99,7 +91,7 @@ typedef enum {
@see [SPARQL 1.1 Query
Language](https://www.w3.org/TR/sparql11-query/#rVar)
*/
- SERD_VARIABLE = 5,
+ SERD_VARIABLE = 4,
} SerdNodeType;
/// Node flags, which ORed together make a #SerdNodeFlags
@@ -165,10 +157,6 @@ serd_new_literal(SerdStringView string,
SERD_API SerdNode* ZIX_ALLOCATED
serd_new_blank(SerdStringView string);
-/// Create a new CURIE node
-SERD_API SerdNode* ZIX_ALLOCATED
-serd_new_curie(SerdStringView string);
-
/**
Create a new URI node from a parsed URI.
*/