Allow @id values that match term.

This commit is contained in:
Dave Longley 2013-04-15 10:46:22 -04:00
parent 8d0c224992
commit 3278e369c1

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* PHP implementation of the JSON-LD API. * PHP implementation of the JSON-LD API.
* Version: 0.0.27 * Version: 0.0.28
* *
* @author Dave Longley * @author Dave Longley
* *
@ -4458,12 +4458,15 @@ class JsonLdProcessor {
'Invalid JSON-LD syntax; @context @id value must be a string.', 'Invalid JSON-LD syntax; @context @id value must be a string.',
'jsonld.SyntaxError', array('context' => $local_ctx)); 'jsonld.SyntaxError', array('context' => $local_ctx));
} }
// add @id to mapping if($id !== $term) {
$mapping->{'@id'} = $this->_expandIri( // add @id to mapping
$active_ctx, $id, array('vocab' => true, 'base' => true), $mapping->{'@id'} = $this->_expandIri(
$local_ctx, $defined); $active_ctx, $id, array('vocab' => true, 'base' => true),
$local_ctx, $defined);
}
} }
else {
if(!property_exists($mapping, '@id')) {
// see if the term has a prefix // see if the term has a prefix
$colon = strpos($term, ':'); $colon = strpos($term, ':');
if($colon !== false) { if($colon !== false) {