Handle scalars before objects.
This commit is contained in:
parent
d1501c7c08
commit
12a9ccc9e8
29
jsonld.php
29
jsonld.php
|
@ -2102,8 +2102,21 @@ class JsonLdProcessor {
|
||||||
return $rval;
|
return $rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// recursively expand object
|
if(!is_object($element)) {
|
||||||
if(is_object($element)) {
|
// drop top-level scalars that are not in lists
|
||||||
|
if(!$inside_list &&
|
||||||
|
($active_property === null ||
|
||||||
|
$this->_expandIri($active_ctx, $active_property,
|
||||||
|
array('vocab' => true)) === '@graph')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// expand element according to value expansion rules
|
||||||
|
return $this->_expandValue($active_ctx, $active_property, $element);
|
||||||
|
}
|
||||||
|
|
||||||
|
// recursively expand object:
|
||||||
|
|
||||||
// if element has a context, process it
|
// if element has a context, process it
|
||||||
if(property_exists($element, '@context')) {
|
if(property_exists($element, '@context')) {
|
||||||
$active_ctx = $this->_processContext(
|
$active_ctx = $this->_processContext(
|
||||||
|
@ -2437,18 +2450,6 @@ class JsonLdProcessor {
|
||||||
return $rval;
|
return $rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop top-level scalars that are not in lists
|
|
||||||
if(!$inside_list &&
|
|
||||||
($active_property === null ||
|
|
||||||
$this->_expandIri($active_ctx, $active_property,
|
|
||||||
array('vocab' => true)) === '@graph')) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// expand element according to value expansion rules
|
|
||||||
return $this->_expandValue($active_ctx, $active_property, $element);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs JSON-LD flattening.
|
* Performs JSON-LD flattening.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue