Skip to content

Commit

Permalink
Normalise away rdf:langString datatype
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
drobilla committed Oct 24, 2019
1 parent c0cabbc commit 0212569
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/normalise.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,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_get_string(node));
}

serd_node_free(datatype);
Expand Down
1 change: 1 addition & 0 deletions tests/normalise/test-normalise.nt
Original file line number Diff line number Diff line change
Expand Up @@ -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> .
Expand Down
2 changes: 2 additions & 0 deletions tests/normalise/test-normalise.ttl
Original file line number Diff line number Diff line change
@@ -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#> .

[
Expand Down Expand Up @@ -67,6 +68,7 @@
" 036893488147419103232 "^^xsd:nonNegativeInteger ,
" +01 "^^xsd:positiveInteger ,
" 036893488147419103232 "^^xsd:positiveInteger ;
<langString> "no language tag"^^rdf:langString ;
<other> "untyped" ,
<uri> ,
"notxsd"^^<sometype> ,
Expand Down

0 comments on commit 0212569

Please sign in to comment.