Update to latest jsonld.js.
--- a/playground/jsonld.js Fri Apr 20 16:46:22 2012 -0700
+++ b/playground/jsonld.js Sat Apr 21 00:14:02 2012 -0400
@@ -791,13 +791,13 @@
* @return the value.
*/
jsonld.getContextValue = function(ctx, key, type) {
+ var rval = null;
+
// return null for invalid key
if(key === null) {
- return null;
+ return rval;
}
- var rval = null;
-
// get default language
if(type === '@language' && (type in ctx)) {
rval = ctx[type];
@@ -812,7 +812,7 @@
rval = entry;
}
// return entry value for type
- if(type in entry) {
+ else if(type in entry) {
rval = entry[type];
}
}
@@ -2927,12 +2927,10 @@
}
// split value into prefix:suffix
- var prefix = value;
- var suffix = '';
var colon = value.indexOf(':');
if(colon !== -1) {
- prefix = value.substr(0, colon);
- suffix = value.substr(colon + 1);
+ var prefix = value.substr(0, colon);
+ var suffix = value.substr(colon + 1);
// a prefix of '_' indicates a blank node
if(prefix === '_') {
@@ -3001,12 +2999,10 @@
}
// split term into prefix:suffix
- var prefix = term;
- var suffix = '';
var colon = term.indexOf(':');
if(colon !== -1) {
- prefix = term.substr(0, colon);
- suffix = term.substr(colon + 1);
+ var prefix = term.substr(0, colon);
+ var suffix = term.substr(colon + 1);
// a prefix of '_' indicates a blank node
if(prefix === '_') {