aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/env.c1
-rw-r--r--src/node.c22
-rw-r--r--src/node.h1
3 files changed, 15 insertions, 9 deletions
diff --git a/src/env.c b/src/env.c
index 36d05d77..f7b1b452 100644
--- a/src/env.c
+++ b/src/env.c
@@ -302,6 +302,7 @@ expand_literal(const SerdEnv* env, const SerdNode* node)
return serd_new_typed_literal_expanded(serd_node_string(node),
serd_node_length(node),
serd_node_flags(node),
+ SERD_URI,
prefix,
suffix);
}
diff --git a/src/node.c b/src/node.c
index 8163f7ae..b33a03e9 100644
--- a/src/node.c
+++ b/src/node.c
@@ -233,6 +233,7 @@ SerdNode*
serd_new_typed_literal_expanded(const char* str,
const size_t str_len,
const SerdNodeFlags flags,
+ const SerdNodeType datatype_type,
const SerdStringView datatype_prefix,
const SerdStringView datatype_suffix)
{
@@ -250,7 +251,7 @@ serd_new_typed_literal_expanded(const char* str,
char* const datatype_buf = serd_node_buffer(datatype_node);
datatype_node->n_bytes = datatype_uri_len;
- datatype_node->type = SERD_URI;
+ datatype_node->type = datatype_type;
memcpy(datatype_buf, datatype_prefix.buf, datatype_prefix.len);
memcpy(datatype_buf + datatype_prefix.len,
datatype_suffix.buf,
@@ -297,18 +298,19 @@ static SerdNode*
serd_new_typed_literal_i(const char* str,
const size_t str_len,
SerdNodeFlags flags,
- const char* datatype_uri,
- const size_t datatype_uri_len)
+ SerdNodeType datatype_type,
+ const char* datatype,
+ const size_t datatype_len)
{
assert(str);
- assert(datatype_uri);
- assert(strcmp(datatype_uri, NS_RDF "langString"));
+ assert(datatype);
+ assert(strcmp(datatype, NS_RDF "langString"));
- const SerdStringView datatype_prefix = {datatype_uri, datatype_uri_len};
+ const SerdStringView datatype_prefix = {datatype, datatype_len};
const SerdStringView datatype_suffix = {"", 0};
return serd_new_typed_literal_expanded(
- str, str_len, flags, datatype_prefix, datatype_suffix);
+ str, str_len, flags, datatype_type, datatype_prefix, datatype_suffix);
}
SerdNode*
@@ -331,7 +333,7 @@ serd_new_literal(const char* str,
return serd_new_plain_literal_i(str, str_len, flags, lang, lang_len);
} else if (datatype_uri) {
return serd_new_typed_literal_i(
- str, str_len, flags, datatype_uri, datatype_uri_len);
+ str, str_len, flags, SERD_URI, datatype_uri, datatype_uri_len);
} else {
return serd_new_substring(str, str_len);
}
@@ -361,7 +363,8 @@ serd_new_typed_literal(const char* str, const SerdNode* datatype)
} else if (!datatype) {
return serd_new_string(str);
} else if (!strcmp(serd_node_buffer_c(datatype), NS_RDF "langString") ||
- serd_node_type(datatype) != SERD_URI) {
+ (serd_node_type(datatype) != SERD_URI &&
+ serd_node_type(datatype) != SERD_CURIE)) {
return NULL;
}
@@ -371,6 +374,7 @@ serd_new_typed_literal(const char* str, const SerdNode* datatype)
return serd_new_typed_literal_i(str,
str_len,
flags,
+ serd_node_type(datatype),
serd_node_string(datatype),
serd_node_length(datatype));
}
diff --git a/src/node.h b/src/node.h
index 7df2c54d..3ec29196 100644
--- a/src/node.h
+++ b/src/node.h
@@ -72,6 +72,7 @@ SerdNode*
serd_new_typed_literal_expanded(const char* str,
size_t str_len,
SerdNodeFlags flags,
+ SerdNodeType datatype_type,
SerdStringView datatype_prefix,
SerdStringView datatype_suffix);