Update to latest jsonld.js.
--- a/playground/jsonld.js Mon Apr 15 11:09:49 2013 -0400
+++ b/playground/jsonld.js Mon Apr 15 11:10:18 2013 -0400
@@ -4162,24 +4162,9 @@
return;
}
+ // convert short-hand value to object w/@id
if(_isString(value)) {
- // expand value to a full IRI
- var id = _expandIri(
- activeCtx, value, {vocab: true, base: true}, localCtx, defined);
-
- if(_isKeyword(id)) {
- // disallow aliasing @context and @preserve
- if(id === '@context' || id === '@preserve') {
- throw new JsonLdError(
- 'Invalid JSON-LD syntax; @context and @preserve cannot be aliased.',
- 'jsonld.SyntaxError');
- }
- }
-
- // define term to expanded IRI/keyword
- activeCtx.mappings[term] = {'@id': id, reverse: false};
- defined[term] = true;
- return;
+ value = {'@id': value};
}
if(!_isObject(value)) {
@@ -4314,6 +4299,14 @@
mapping['@language'] = language;
}
+ // disallow aliasing @context and @preserve
+ var id = mapping['@id'];
+ if(id === '@context' || id === '@preserve') {
+ throw new JsonLdError(
+ 'Invalid JSON-LD syntax; @context and @preserve cannot be aliased.',
+ 'jsonld.SyntaxError');
+ }
+
// define term mapping
activeCtx.mappings[term] = mapping;
defined[term] = true;