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
1 changed files with 9 additions and 6 deletions

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));
} }
if($id !== $term) {
// add @id to mapping // add @id to mapping
$mapping->{'@id'} = $this->_expandIri( $mapping->{'@id'} = $this->_expandIri(
$active_ctx, $id, array('vocab' => true, 'base' => true), $active_ctx, $id, array('vocab' => true, 'base' => true),
$local_ctx, $defined); $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) {