Skip to content

Commit 434054c

Browse files
committed
For type maps, use a context defined for that particular key (expand#m013).
1 parent afaa08b commit 434054c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/expand.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,13 @@ function _expandIndexMap(
704704
const rval = [];
705705
const keys = Object.keys(value).sort();
706706
for(let ki = 0; ki < keys.length; ++ki) {
707-
// If indexKey is @id or @type, expand the key appropriately
707+
// if indexKey is @type, there may be a context defined for it
708+
const ctx = _getContextValue(activeCtx, keys[ki], '@context');
709+
if(ctx) {
710+
activeCtx = _processContext({activeCtx, localCtx: ctx, options});
711+
}
712+
713+
// if indexKey is @id or @type, expand the key appropriately
708714
const key = (indexKey === '@id' || indexKey === '@type') ?
709715
_expandIri(activeCtx, keys[ki], {vocab: (indexKey === '@type'), base: true}) :
710716
keys[ki];

tests/test-common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const TEST_TYPES = {
4141
},
4242
'jld:ExpandTest': {
4343
skip: {
44-
regex: [/#t[n]/, /#tm013/]
44+
regex: [/#tn/]
4545
},
4646
fn: 'expand',
4747
params: [

0 commit comments

Comments
 (0)