forked from friendica/php-json-ld
Do not compact to relative IRIs if vocab relative flag is true.
This commit is contained in:
parent
e5f1e28ada
commit
fbfb6c9fcb
1 changed files with 16 additions and 11 deletions
11
jsonld.php
11
jsonld.php
|
@ -3944,8 +3944,8 @@ class JsonLdProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// no matching terms or curies, use @vocab if available
|
// no matching terms or curies, use @vocab if available
|
||||||
if(isset($relative_to['vocab']) && $relative_to['vocab'] &&
|
if(isset($relative_to['vocab']) && $relative_to['vocab']) {
|
||||||
property_exists($active_ctx, '@vocab')) {
|
if(property_exists($active_ctx, '@vocab')) {
|
||||||
// determine if vocab is a prefix of the iri
|
// determine if vocab is a prefix of the iri
|
||||||
$vocab = $active_ctx->{'@vocab'};
|
$vocab = $active_ctx->{'@vocab'};
|
||||||
if(strpos($iri, $vocab) === 0 && $iri !== $vocab) {
|
if(strpos($iri, $vocab) === 0 && $iri !== $vocab) {
|
||||||
|
@ -3956,11 +3956,16 @@ class JsonLdProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// compact IRI relative to base
|
// compact IRI relative to base
|
||||||
|
else {
|
||||||
return jsonld_remove_base($active_ctx->{'@base'}, $iri);
|
return jsonld_remove_base($active_ctx->{'@base'}, $iri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return IRI as is
|
||||||
|
return $iri;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs value compaction on an object with '@value' or '@id' as the only
|
* Performs value compaction on an object with '@value' or '@id' as the only
|
||||||
* property.
|
* property.
|
||||||
|
|
Loading…
Reference in a new issue