Use keyword alias in compact output.
This commit is contained in:
parent
c091c4cc7b
commit
eb7a99a45e
14
jsonld.php
14
jsonld.php
|
@ -538,10 +538,18 @@ function _compactIri($ctx, $iri, $usedCtx)
|
|||
}
|
||||
}
|
||||
|
||||
// term not found, if term is @type, use keyword
|
||||
if($rval === null and $iri === '@type')
|
||||
// term not found, if term is keyword, use alias
|
||||
if($rval === null)
|
||||
{
|
||||
$rval = _getKeywords($ctx)->{'@type'};
|
||||
$keywords = _getKeywords($ctx);
|
||||
if(property_exists($keywords, $iri))
|
||||
{
|
||||
$rval = $keywords->{$iri};
|
||||
if($rval !== $iri and $usedCtx !== null)
|
||||
{
|
||||
$usedCtx->$rval = $iri;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// term not found, check the context for a prefix
|
||||
|
|
Loading…
Reference in a new issue