From 5ed2f4ea35da555e73cda7730b17ada54f8e2ac8 Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Tue, 16 Apr 2013 11:11:09 -0400 Subject: [PATCH] Mark term as defined once IRI mapping is set. --- jsonld.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/jsonld.php b/jsonld.php index 45c4bd3..8385837 100644 --- a/jsonld.php +++ b/jsonld.php @@ -1,7 +1,7 @@ mappings->{$term} = new stdClass(); $mapping->reverse = false; if(property_exists($value, '@reverse')) { @@ -4485,6 +4485,9 @@ class JsonLdProcessor { } } + // IRI mapping now defined + $defined->{$term} = true; + if(property_exists($value, '@type')) { $type = $value->{'@type'}; if(!is_string($type)) { @@ -4541,7 +4544,6 @@ class JsonLdProcessor { $mapping->{'@language'} = $language; } - // disallow aliasing @context and @preserve $id = $mapping->{'@id'}; if($id === '@context' || $id === '@preserve') { @@ -4549,10 +4551,6 @@ class JsonLdProcessor { 'Invalid JSON-LD syntax; @context and @preserve cannot be aliased.', 'jsonld.SyntaxError', array('context' => $local_ctx)); } - - // define term mapping - $active_ctx->mappings->{$term} = $mapping; - $defined->{$term} = true; } /**