Permalink
Browse files

Handle @type blank node IRIs.

  • Loading branch information...
1 parent a91ceef commit 5f9bba309482c58c897cfe5777b01bbff3b6e83c @dlongley dlongley committed May 21, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 js/jsonld.js
View
@@ -2352,8 +2352,8 @@ function _flatten(input, graphs, graph, namer, name, list) {
continue;
}
- // copy keywords
- if(_isKeyword(prop)) {
+ // copy non-@type keywords
+ if(prop !== '@type' && _isKeyword(prop)) {
subject[prop] = input[prop];
continue;
}
@@ -2379,6 +2379,10 @@ function _flatten(input, graphs, graph, namer, name, list) {
_flatten(o['@list'], graphs, graph, namer, name, _list);
o = {'@list': _list};
}
+ // special-handle @type IRIs
+ else if(prop === '@type' && o.indexOf('_:') === 0) {
+ o = namer.getName(o);
+ }
// add non-subject
jsonld.addValue(subject, prop, o, true);

0 comments on commit 5f9bba3

Please sign in to comment.