Fixed a bug that caused plain literals in objects to not be converted to TURTLE.
authorManu Sporny <msporny@digitalbazaar.com>
Wed, 18 Jan 2012 15:03:49 -0500
changeset 349 8d2d2fba4f17
parent 348 9eb3491416e2
child 350 0b64476e7a18
Fixed a bug that caused plain literals in objects to not be converted to TURTLE.
playground/jsonld-turtle.js
--- a/playground/jsonld-turtle.js	Wed Jan 18 11:28:48 2012 +0800
+++ b/playground/jsonld-turtle.js	Wed Jan 18 15:03:49 2012 -0500
@@ -104,15 +104,21 @@
    }
    else if(obj instanceof Object)
    {
-      // the object is an IRI, typed literal or language-tagged literal
       if("@value" in obj && "@type" in obj)
       {
+         // object is a typed literal
          rval = "\"" + obj["@value"] + "\"^^<" + obj["@type"] + ">";
       }
       else if("@value" in obj && "@language" in obj)
       {
+         // object is a plain literal with a language
          rval = "\"" + obj["@value"] + "\"@" + obj["@language"];
       }
+      else if("@value" in obj)
+      {
+         // object is a plain literal
+         rval = "\"" + obj["@value"] + "\"";
+      }
       else if("@id" in obj)
       {
          var iri = obj["@id"];