diff options
author | David Robillard <d@drobilla.net> | 2019-10-18 21:47:14 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:59 +0100 |
commit | d549a93b91b99dabd073759cd8fd958e6eb5b3de (patch) | |
tree | cdd91df4839d07552604ed5b007e242b2b008b96 | |
parent | 80fb6d0ff7c093466ac70b38be5676b868516c08 (diff) | |
download | serd-d549a93b91b99dabd073759cd8fd958e6eb5b3de.tar.gz serd-d549a93b91b99dabd073759cd8fd958e6eb5b3de.tar.bz2 serd-d549a93b91b99dabd073759cd8fd958e6eb5b3de.zip |
Normalise away rdf:langString datatype
Depending on how you read the specifications, a rdf:langString isn't identical
to an xsd:string, but an rdf:langString must have a non-empty language tag so
having this datatype doesn't really make any sense anyway.
-rw-r--r-- | src/normalise.c | 2 | ||||
-rw-r--r-- | tests/normalise/test-normalise.nt | 1 | ||||
-rw-r--r-- | tests/normalise/test-normalise.ttl | 2 |
3 files changed, 5 insertions, 0 deletions
diff --git a/src/normalise.c b/src/normalise.c index 34f97f71..bdf6d871 100644 --- a/src/normalise.c +++ b/src/normalise.c @@ -217,6 +217,8 @@ serd_node_normalise(const SerdEnv* env, const SerdNode* const node) INTEGER_TYPE_LEN, (int (*)(const void*, const void*))strcmp)) { result = serd_normalise_integer(str, datatype); + } else if (!strcmp(datatype_uri, NS_RDF "langString")) { + result = serd_new_string(serd_node_string(node)); } serd_node_free(datatype); diff --git a/tests/normalise/test-normalise.nt b/tests/normalise/test-normalise.nt index e23989ec..d2eff5a2 100644 --- a/tests/normalise/test-normalise.nt +++ b/tests/normalise/test-normalise.nt @@ -63,6 +63,7 @@ _:b1 <http://example.org/integer> "0"^^<http://www.w3.org/2001/XMLSchema#nonNega _:b1 <http://example.org/integer> "36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#nonNegativeInteger> . _:b1 <http://example.org/integer> "1"^^<http://www.w3.org/2001/XMLSchema#positiveInteger> . _:b1 <http://example.org/integer> "36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#positiveInteger> . +_:b1 <http://example.org/langString> "no language tag" . _:b1 <http://example.org/other> "untyped" . _:b1 <http://example.org/other> <http://example.org/uri> . _:b1 <http://example.org/other> "notxsd"^^<http://example.org/sometype> . diff --git a/tests/normalise/test-normalise.ttl b/tests/normalise/test-normalise.ttl index 3db64f39..85dd2456 100644 --- a/tests/normalise/test-normalise.ttl +++ b/tests/normalise/test-normalise.ttl @@ -1,4 +1,5 @@ @base <http://example.org/> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . [ @@ -67,6 +68,7 @@ " 036893488147419103232 "^^xsd:nonNegativeInteger , " +01 "^^xsd:positiveInteger , " 036893488147419103232 "^^xsd:positiveInteger ; + <langString> "no language tag"^^rdf:langString ; <other> "untyped" , <uri> , "notxsd"^^<sometype> , |