Simplify expand IRI.

This commit is contained in:
Dave Longley 2013-04-04 11:25:46 -04:00
parent c765930a43
commit 7034bb713e
1 changed files with 14 additions and 12 deletions

View File

@ -4625,19 +4625,21 @@ class JsonLdProcessor {
// do not expand blank nodes (prefix of '_') or already-absolute // do not expand blank nodes (prefix of '_') or already-absolute
// IRIs (suffix of '//') // IRIs (suffix of '//')
if($prefix !== '_' && strpos($suffix, '//') !== 0) { if($prefix === '_' || strpos($suffix, '//') === 0) {
// prefix dependency not defined, define it return $value;
if($local_ctx !== null && property_exists($local_ctx, $prefix)) { }
$this->_createTermDefinition(
$active_ctx, $local_ctx, $prefix, $defined);
}
// use mapping if prefix is defined // prefix dependency not defined, define it
if(property_exists($active_ctx->mappings, $prefix)) { if($local_ctx !== null && property_exists($local_ctx, $prefix)) {
$mapping = $active_ctx->mappings->{$prefix}; $this->_createTermDefinition(
if($mapping) { $active_ctx, $local_ctx, $prefix, $defined);
return $mapping->{'@id'} . $suffix; }
}
// use mapping if prefix is defined
if(property_exists($active_ctx->mappings, $prefix)) {
$mapping = $active_ctx->mappings->{$prefix};
if($mapping) {
return $mapping->{'@id'} . $suffix;
} }
} }