Remove active_property to item_active_property.

This commit is contained in:
Dave Longley 2013-02-11 16:07:38 -05:00
parent d1d437b9b7
commit 7692f6f087

View file

@ -1517,30 +1517,31 @@ class JsonLdProcessor {
// preserve empty arrays // preserve empty arrays
if(count($expanded_value) === 0) { if(count($expanded_value) === 0) {
$active_property = $this->_compactIri( $item_active_property = $this->_compactIri(
$active_ctx, $expanded_property, null, array('vocab' => true), $active_ctx, $expanded_property, $expanded_value,
$element); array('vocab' => true), $element);
self::addValue( self::addValue(
$rval, $active_property, array(), array('propertyIsArray' => true)); $rval, $item_active_property, array(),
array('propertyIsArray' => true));
} }
// recusively process array values // recusively process array values
foreach($expanded_value as $expanded_item) { foreach($expanded_value as $expanded_item) {
// compact property and get container type // compact property and get container type
$active_property = $this->_compactIri( $item_active_property = $this->_compactIri(
$active_ctx, $expanded_property, $expanded_item, $active_ctx, $expanded_property, $expanded_item,
array('vocab' => true), $element); array('vocab' => true), $element);
$container = self::getContextValue( $container = self::getContextValue(
$active_ctx, $active_property, '@container'); $active_ctx, $item_active_property, '@container');
// remove any duplicates that were (presumably) generated by a // remove any duplicates that were (presumably) generated by a
// property generator // property generator
if(property_exists($active_ctx->mappings, $active_property)) { if(property_exists($active_ctx->mappings, $item_active_property)) {
$mapping = $active_ctx->mappings->{$active_property}; $mapping = $active_ctx->mappings->{$item_active_property};
if($mapping && $mapping->propertyGenerator) { if($mapping && $mapping->propertyGenerator) {
$this->_findPropertyGeneratorDuplicates( $this->_findPropertyGeneratorDuplicates(
$active_ctx, $element, $expanded_property, $expanded_item, $active_ctx, $element, $expanded_property, $expanded_item,
$active_property, true); $item_active_property, true);
} }
} }
@ -1553,8 +1554,8 @@ class JsonLdProcessor {
// recursively compact expanded item // recursively compact expanded item
$compacted_item = $this->_compact( $compacted_item = $this->_compact(
$active_ctx, $active_property, $is_list ? $list : $expanded_item, $active_ctx, $item_active_property,
$options); $is_list ? $list : $expanded_item, $options);
// handle @list // handle @list
if($is_list) { if($is_list) {
@ -1573,7 +1574,7 @@ class JsonLdProcessor {
} }
} }
// can't use @list container for more than 1 list // can't use @list container for more than 1 list
else if(property_exists($rval, $active_property)) { else if(property_exists($rval, $item_active_property)) {
throw new JsonLdException( throw new JsonLdException(
'JSON-LD compact error; property has a "@list" @container ' . 'JSON-LD compact error; property has a "@list" @container ' .
'rule but there is more than a single @list that matches ' . 'rule but there is more than a single @list that matches ' .
@ -1586,11 +1587,11 @@ class JsonLdProcessor {
// handle language and index maps // handle language and index maps
if($container === '@language' || $container === '@index') { if($container === '@language' || $container === '@index') {
// get or create the map object // get or create the map object
if(property_exists($rval, $active_property)) { if(property_exists($rval, $item_active_property)) {
$map_object = $rval->{$active_property}; $map_object = $rval->{$item_active_property};
} }
else { else {
$rval->{$active_property} = $map_object = new stdClass(); $rval->{$item_active_property} = $map_object = new stdClass();
} }
// if container is a language map, simplify compacted value to // if container is a language map, simplify compacted value to
@ -1614,7 +1615,7 @@ class JsonLdProcessor {
// add compact value // add compact value
self::addValue( self::addValue(
$rval, $active_property, $compacted_item, $rval, $item_active_property, $compacted_item,
array('propertyIsArray' => $is_array)); array('propertyIsArray' => $is_array));
} }
} }