Update to latest jsonld.js, fixes to example contexts.
authorDave Longley <dlongley@digitalbazaar.com>
Fri, 28 Oct 2011 16:53:18 -0400
changeset 248 88ecc6b3174f
parent 247 276f39cf4b17
child 249 fd0268563475
Update to latest jsonld.js, fixes to example contexts.
contexts/person
contexts/place
playground/jsonld.js
--- a/contexts/person	Fri Oct 28 00:32:15 2011 -0400
+++ b/contexts/person	Fri Oct 28 16:53:18 2011 -0400
@@ -15,6 +15,7 @@
       "familyName": "http://xmlns.com/foaf/0.1/familyName",
       "givenName": "http://xmlns.com/foaf/0.1/givenName",
       "gender": "http://schema.org/gender",
+      "homepage": "http://xmlns.com/foaf/0.1/homepage",
       "honorificPrefix": "http://schema.org/honorificPrefix",
       "honorificSuffix": "http://schema.org/honorificSuffix",
       "jobTitle": "http://xmlns.com/foaf/0.1/title",
@@ -38,6 +39,7 @@
          "knows": "@iri",
          "died": "xsd:dateTime",
          "email": "@iri",
+         "homepage": "@iri",
          "parent": "@iri",
          "child": "@iri",
          "colleague": "@iri",
--- a/contexts/place	Fri Oct 28 00:32:15 2011 -0400
+++ b/contexts/place	Fri Oct 28 16:53:18 2011 -0400
@@ -27,7 +27,7 @@
       "@coerce":
       {
          "latitude": "xsd:decimal",
-         "longitude": "xsd:decimal",
+         "longitude": "xsd:decimal"
       }
    }
 }
--- a/playground/jsonld.js	Fri Oct 28 00:32:15 2011 -0400
+++ b/playground/jsonld.js	Fri Oct 28 16:53:18 2011 -0400
@@ -696,11 +696,18 @@
                errors = errors || [];
                errors.push({ url: url, error: error });
             }
-            else if(result.constructor === String)
+            else
             {
                try
                {
-                  urls[url] = JSON.parse(result);
+                  if(result.constructor === String)
+                  {
+                     urls[url] = JSON.parse(result)['@context'];
+                  }
+                  else
+                  {
+                     urls[url] = result['@context'];
+                  }
                }
                catch(ex)
                {
@@ -708,10 +715,6 @@
                   errors.push({ url: url, error: ex });
                }
             }
-            else
-            {
-               urls[url] = result;
-            }
             
             if(count === 0)
             {