Ensure property bnodes are relabeled during flattening.

This commit is contained in:
Dave Longley 2013-04-04 02:10:24 -04:00
parent 3aba934eb6
commit 642a789eb4

View file

@ -1,7 +1,7 @@
<?php
/**
* PHP implementation of the JSON-LD API.
* Version: 0.0.22
* Version: 0.0.23
*
* @author Dave Longley
*
@ -3271,8 +3271,15 @@ class JsonLdProcessor {
continue;
}
// iterate over objects (ensure property is added for empty arrays)
// iterate over objects
$objects = $input->{$property};
// if property is a bnode, assign it a new id
if(strpos($property, '_:') === 0) {
$property = $namer->getName($property);
}
// ensure property is added for empty arrays
if(count($objects) === 0) {
self::addValue(
$subject, $property, array(), array('propertyIsArray' => true));