Update to latest jsonld.js.
authorDave Longley <dlongley@digitalbazaar.com>
Tue, 08 May 2012 18:08:52 -0400
changeset 638 62b188959ded
parent 637 cfebd1392df0
child 639 08c8d6a72513
child 640 1201e6f278b0
Update to latest jsonld.js.
playground/jsonld.js
--- a/playground/jsonld.js	Tue May 08 16:42:57 2012 -0400
+++ b/playground/jsonld.js	Tue May 08 18:08:52 2012 -0400
@@ -1966,13 +1966,9 @@
     return;
   }
 
-  // element must be an IRI (@values covered above)
+  // element must be an rdf:type IRI (@values covered above)
   if(_isString(element)) {
-    // property can be null for string subject references in @graph
-    if(property === null) {
-      return;
-    }
-    // emit IRI for rdf:type, else plain literal
+    // emit IRI
     var statement = {
       subject: _clone(subject),
       property: _clone(property),
@@ -2836,11 +2832,6 @@
   // Note: Value must be an object that is a @value or subject/reference.
 
   if(_isValue(value)) {
-    // rank non-string value
-    if(!_isString(value['@value'])) {
-      return (!hasType && !hasLanguage) ? 2 : 1;
-    }
-
     // value has a @type
     if('@type' in value) {
       // @types match
@@ -2850,6 +2841,11 @@
       return (!hasType && !hasLanguage) ? 1 : 0;
     }
 
+    // rank non-string value
+    if(!_isString(value['@value'])) {
+      return (!hasType && !hasLanguage) ? 2 : 1;
+    }
+
     // value has no @type or @language
     if(!('@language' in value)) {
       // entry @language is specifically null or no @type, @language, or