private function getValueProfile(JsonObject $value, $inversectx)
    {
        $valueProfile = array(
            '@container' => '@set',
            'typeLang' => '@type',
            'typeLangValue' => '@id'
        );

        if (property_exists($value, '@index')) {
            $valueProfile['@container'] = '@index';
        }

        if (property_exists($value, '@id')) {
            if (isset($inversectx[$value->{'@id'}]['term'])) {
                $valueProfile['typeLangValue'] = '@vocab';
            } else {
                $valueProfile['typeLangValue'] = '@id';
            }

            return $valueProfile;
        }

        if (property_exists($value, '@value')) {
            if (property_exists($value, '@type')) {
                $valueProfile['typeLang'] = '@type';
                $valueProfile['typeLangValue'] = $value->{'@type'};
            } elseif (property_exists($value, '@language')) {
                $valueProfile['typeLang'] = '@language';
                $valueProfile['typeLangValue'] = $value->{'@language'};

                if (false === property_exists($value, '@index')) {
                    $valueProfile['@container'] = '@language';
                }
            } else {
                $valueProfile['typeLang'] = '@language';
                $valueProfile['typeLangValue'] = '@null';
            }

            return $valueProfile;
        }

        if (property_exists($value, '@list')) {
            $len = count($value->{'@list'});

            if ($len > 0) {
                $valueProfile = $this->getValueProfile($value->{'@list'}[0], $inversectx);
            }

            if (false === property_exists($value, '@index')) {
                $valueProfile['@container'] = '@list';
            }


            for ($i = $len - 1; $i > 0; $i--) {
                $profile = $this->getValueProfile($value->{'@list'}[$i], $inversectx);

                if (($valueProfile['typeLang'] !== $profile['typeLang']) ||
                    ($valueProfile['typeLangValue'] !== $profile['typeLangValue'])) {
                    $valueProfile['typeLang'] = null;
                    $valueProfile['typeLangValue'] = null;

                    return $valueProfile;
                }
            }
        }

        return $valueProfile;
    }
private function getValueProfile(JsonObject $value, $inversectx)
    {
        $valueProfile = array(
            '@container' => '@set',
            'typeLang' => '@type',
            'typeLangValue' => '@id'
        );

        if (property_exists($value, '@index')) {
            $valueProfile['@container'] = '@index';
        }

        if (property_exists($value, '@id')) {
            if (isset($inversectx[$value->{'@id'}]['term'])) {
                $valueProfile['typeLangValue'] = '@vocab';
            } else {
                $valueProfile['typeLangValue'] = '@id';
            }

            return $valueProfile;
        }

        if (property_exists($value, '@value')) {
            if (property_exists($value, '@type')) {
                $valueProfile['typeLang'] = '@type';
                $valueProfile['typeLangValue'] = $value->{'@type'};
            } elseif (property_exists($value, '@language')) {
                $valueProfile['typeLang'] = '@language';
                $valueProfile['typeLangValue'] = $value->{'@language'};

                if (false === property_exists($value, '@index')) {
                    $valueProfile['@container'] = '@language';
                }
            } else {
                $valueProfile['typeLang'] = '@language';
                $valueProfile['typeLangValue'] = '@null';
            }

            return $valueProfile;
        }

        if (property_exists($value, '@list')) {
            $len = count($value->{'@list'});

            if ($len > 0) {
                $valueProfile = $this->getValueProfile($value->{'@list'}[0], $inversectx);
            }

            if (false === property_exists($value, '@index')) {
                $valueProfile['@container'] = '@list';
            }


            for ($i = $len - 1; $i > 0; $i--) {
                $profile = $this->getValueProfile($value->{'@list'}[$i], $inversectx);

                if (($valueProfile['typeLang'] !== $profile['typeLang']) ||
                    ($valueProfile['typeLangValue'] !== $profile['typeLangValue'])) {
                    $valueProfile['typeLang'] = null;
                    $valueProfile['typeLangValue'] = null;

                    return $valueProfile;
                }
            }
        }

        return $valueProfile;
    }
private function getValueProfile ( JsonObject $ value , $ inversectx ) { $ valueProfile = array ( '@container' => '@set' , 'typeLang' => '@type' , 'typeLangValue' => '@id' ) ; if ( property_exists ( $ value , '@index' ) ) { $ valueProfile [ '@container' ] = '@index' ; } if ( property_exists ( $ value , '@id' ) ) { if ( isset ( $ inversectx [ $ value -> { '@id' } ] [ 'term' ] ) ) { $ valueProfile [ 'typeLangValue' ] = '@vocab' ; } else { $ valueProfile [ 'typeLangValue' ] = '@id' ; } return $ valueProfile ; } if ( property_exists ( $ value , '@value' ) ) { if ( property_exists ( $ value , '@type' ) ) { $ valueProfile [ 'typeLang' ] = '@type' ; $ valueProfile [ 'typeLangValue' ] = $ value -> { '@type' } ; } elseif ( property_exists ( $ value , '@language' ) ) { $ valueProfile [ 'typeLang' ] = '@language' ; $ valueProfile [ 'typeLangValue' ] = $ value -> { '@language' } ; if ( false === property_exists ( $ value , '@index' ) ) { $ valueProfile [ '@container' ] = '@language' ; } } else { $ valueProfile [ 'typeLang' ] = '@language' ; $ valueProfile [ 'typeLangValue' ] = '@null' ; } return $ valueProfile ; } if ( property_exists ( $ value , '@list' ) ) { $ len = count ( $ value -> { '@list' } ) ; if ( $ len > 0 ) { $ valueProfile = $ this -> getValueProfile ( $ value -> { '@list' } [ 0 ] , $ inversectx ) ; } if ( false === property_exists ( $ value , '@index' ) ) { $ valueProfile [ '@container' ] = '@list' ; } for ( $ i = $ len - 1 ; $ i > 0 ; $ i -- ) { $ profile = $ this -> getValueProfile ( $ value -> { '@list' } [ $ i ] , $ inversectx ) ; if ( ( $ valueProfile [ 'typeLang' ] !== $ profile [ 'typeLang' ] ) || ( $ valueProfile [ 'typeLangValue' ] !== $ profile [ 'typeLangValue' ] ) ) { $ valueProfile [ 'typeLang' ] = null ; $ valueProfile [ 'typeLangValue' ] = null ; return $ valueProfile ; } } } return $ valueProfile ; }
Calculates a value profile

A value profile represent the schema of the value ignoring the
concrete value. It is an associative array containing the following
keys-value pairs:

* `@container`: the container, defaults to `@set`
* `typeLang`: is set to `@type` for typed values or `@language` for
(language-tagged) strings; for all other values it is set to
`null`
* `typeLangValue`: set to the type of a typed value or the language
of a language-tagged string (`@null` for all other strings); for
all other values it is set to `null`

@param JsonObject $value      The value.
@param array      $inversectx The inverse context.

@return array The value profile.
Calculates a value profile