summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Beckett <dave@dajobe.org>2014-10-20 19:35:29 -0700
committerDave Beckett <dave@dajobe.org>2014-10-20 19:35:29 -0700
commit899a7137c650b6db9ff8692d00429479ec4c9fdd (patch)
tree885cbdd0292fb1cc0fb72d0e8e64ccf1c85874bb
parent0e4bc1be2332e9e4dd67334f603df6f88e8c37d4 (diff)
parent53bb1c06725f256bc68c12c170ad79c0db94ab98 (diff)
downloadraptor-899a7137c650b6db9ff8692d00429479ec4c9fdd.tar.gz
Merge pull request #16 from rhmccullough/rdf-nil
do not change "( )" to "rdf:nil"
-rw-r--r--src/raptor_serialize_turtle.c5
-rw-r--r--tests/turtle/Makefile.am6
-rw-r--r--tests/turtle/test-39-out.ttl6
-rw-r--r--tests/turtle/test-39.ttl3
4 files changed, 17 insertions, 3 deletions
diff --git a/src/raptor_serialize_turtle.c b/src/raptor_serialize_turtle.c
index bc8a29ba..bb4f4373 100644
--- a/src/raptor_serialize_turtle.c
+++ b/src/raptor_serialize_turtle.c
@@ -176,6 +176,11 @@ raptor_turtle_emit_resource(raptor_serializer *serializer,
if(node->term->type != RAPTOR_TERM_TYPE_URI)
return 1;
+ if(raptor_uri_equals(node->term->value.uri, context->rdf_nil_uri)) {
+ raptor_turtle_writer_raw_counted(turtle_writer,(const unsigned char *)"( )", 3);
+ return 0;
+ }
+
qname = raptor_new_qname_from_namespace_uri(context->nstack,
node->term->value.uri, 10);
diff --git a/tests/turtle/Makefile.am b/tests/turtle/Makefile.am
index 81c45259..daf041d9 100644
--- a/tests/turtle/Makefile.am
+++ b/tests/turtle/Makefile.am
@@ -55,10 +55,10 @@ rdfs-namespace.out \
rdfq-results.out
TEST_SERIALIZE_FILES= \
-test-28.ttl test-31.ttl test-32.ttl test-34.ttl
+test-28.ttl test-31.ttl test-32.ttl test-34.ttl test-39.ttl
TEST_SERIALIZE_OUT_FILES= \
-test-28-out.ttl test-31-out.ttl test-32-out.ttl test-34-out.ttl
+test-28-out.ttl test-31-out.ttl test-32-out.ttl test-34-out.ttl test-39-out.ttl
TURTLE_HACK_OUT_FILES= \
ex-38-turtle.out
@@ -212,7 +212,7 @@ check-turtle-serialize-syntax: build-rapper $(check_turtle_serialize_syntax_deps
baseuri=$(RDF_NS_URI); \
elif test $$name = rdfs-namespace; then \
baseuri=$(RDFS_NS_URI); \
- elif test $$name = test-31 -o $$name = test-32; then \
+ elif test $$name = test-31 -o $$name = test-32 -o $$name = test-39; then \
baseuri=-; \
else \
baseuri=$(BASE_URI)$$test; \
diff --git a/tests/turtle/test-39-out.ttl b/tests/turtle/test-39-out.ttl
new file mode 100644
index 00000000..3810b8a3
--- /dev/null
+++ b/tests/turtle/test-39-out.ttl
@@ -0,0 +1,6 @@
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix : <http://example.org/stuff/1.0/> .
+
+:a
+ :b ( ) .
+
diff --git a/tests/turtle/test-39.ttl b/tests/turtle/test-39.ttl
new file mode 100644
index 00000000..adce0a20
--- /dev/null
+++ b/tests/turtle/test-39.ttl
@@ -0,0 +1,3 @@
+@prefix : <http://example.org/stuff/1.0/> .
+:a :b ( ) .
+