protected function generateValues($source, $f, $predicate, &$dest)
    {
        $values = [];
        if (isset($source[$predicate][VALUE_URI]) && !empty($source[$predicate][VALUE_URI]))
        {
            $values[] = $source[$predicate][VALUE_URI];
        }
        else if (isset($source[$predicate][VALUE_LITERAL]) && !empty($source[$predicate][VALUE_LITERAL]))
        {
            $values[] = $source[$predicate][VALUE_LITERAL];
        }
        else if (isset($source[$predicate][_ID_RESOURCE])) // field being joined is the _id, will have _id{r:'',c:''}
        {
            $values[] = $source[$predicate][_ID_RESOURCE];
        }
        else
        {
            foreach ($source[$predicate] as $v)
            {
                if (isset($v[VALUE_LITERAL]) && !empty($v[VALUE_LITERAL]))
                {
                    $values[] = $v[VALUE_LITERAL];
                }
                else if (isset($v[VALUE_URI]) && !empty($v[VALUE_URI]))
                {
                    $values[] = $v[VALUE_URI];
                }
                // _id's shouldn't appear in value arrays, so no need for third condition here
            }
        }

        // now add all the values
        foreach ($values as $v)
        {
            if (!isset($dest[$f['fieldName']]))
            {
                // single value
                $dest[$f['fieldName']] = $v;
            }
            else if (is_array($dest[$f['fieldName']]))
            {
                // add to existing array of values
                $dest[$f['fieldName']][] = $v;
            }
            else
            {
                // convert from single value to array of values
                $existingVal = $dest[$f['fieldName']];
                $dest[$f['fieldName']] = [];
                $dest[$f['fieldName']][] = $existingVal;
                $dest[$f['fieldName']][] = $v;
            }
        }
    }
protected function generateValues($source, $f, $predicate, &$dest)
    {
        $values = [];
        if (isset($source[$predicate][VALUE_URI]) && !empty($source[$predicate][VALUE_URI]))
        {
            $values[] = $source[$predicate][VALUE_URI];
        }
        else if (isset($source[$predicate][VALUE_LITERAL]) && !empty($source[$predicate][VALUE_LITERAL]))
        {
            $values[] = $source[$predicate][VALUE_LITERAL];
        }
        else if (isset($source[$predicate][_ID_RESOURCE])) // field being joined is the _id, will have _id{r:'',c:''}
        {
            $values[] = $source[$predicate][_ID_RESOURCE];
        }
        else
        {
            foreach ($source[$predicate] as $v)
            {
                if (isset($v[VALUE_LITERAL]) && !empty($v[VALUE_LITERAL]))
                {
                    $values[] = $v[VALUE_LITERAL];
                }
                else if (isset($v[VALUE_URI]) && !empty($v[VALUE_URI]))
                {
                    $values[] = $v[VALUE_URI];
                }
                // _id's shouldn't appear in value arrays, so no need for third condition here
            }
        }

        // now add all the values
        foreach ($values as $v)
        {
            if (!isset($dest[$f['fieldName']]))
            {
                // single value
                $dest[$f['fieldName']] = $v;
            }
            else if (is_array($dest[$f['fieldName']]))
            {
                // add to existing array of values
                $dest[$f['fieldName']][] = $v;
            }
            else
            {
                // convert from single value to array of values
                $existingVal = $dest[$f['fieldName']];
                $dest[$f['fieldName']] = [];
                $dest[$f['fieldName']][] = $existingVal;
                $dest[$f['fieldName']][] = $v;
            }
        }
    }
protected function generateValues ( $ source , $ f , $ predicate , & $ dest ) { $ values = [ ] ; if ( isset ( $ source [ $ predicate ] [ VALUE_URI ] ) && ! empty ( $ source [ $ predicate ] [ VALUE_URI ] ) ) { $ values [ ] = $ source [ $ predicate ] [ VALUE_URI ] ; } else if ( isset ( $ source [ $ predicate ] [ VALUE_LITERAL ] ) && ! empty ( $ source [ $ predicate ] [ VALUE_LITERAL ] ) ) { $ values [ ] = $ source [ $ predicate ] [ VALUE_LITERAL ] ; } else if ( isset ( $ source [ $ predicate ] [ _ID_RESOURCE ] ) ) // field being joined is the _id, will have _id{r:'',c:''} { $ values [ ] = $ source [ $ predicate ] [ _ID_RESOURCE ] ; } else { foreach ( $ source [ $ predicate ] as $ v ) { if ( isset ( $ v [ VALUE_LITERAL ] ) && ! empty ( $ v [ VALUE_LITERAL ] ) ) { $ values [ ] = $ v [ VALUE_LITERAL ] ; } else if ( isset ( $ v [ VALUE_URI ] ) && ! empty ( $ v [ VALUE_URI ] ) ) { $ values [ ] = $ v [ VALUE_URI ] ; } // _id's shouldn't appear in value arrays, so no need for third condition here } } // now add all the values foreach ( $ values as $ v ) { if ( ! isset ( $ dest [ $ f [ 'fieldName' ] ] ) ) { // single value $ dest [ $ f [ 'fieldName' ] ] = $ v ; } else if ( is_array ( $ dest [ $ f [ 'fieldName' ] ] ) ) { // add to existing array of values $ dest [ $ f [ 'fieldName' ] ] [ ] = $ v ; } else { // convert from single value to array of values $ existingVal = $ dest [ $ f [ 'fieldName' ] ] ; $ dest [ $ f [ 'fieldName' ] ] = [ ] ; $ dest [ $ f [ 'fieldName' ] ] [ ] = $ existingVal ; $ dest [ $ f [ 'fieldName' ] ] [ ] = $ v ; } } }
Generate values for a given predicate
@param array $source
@param array $f
@param string $predicate
@param array $dest
@access protected
@return void
Generate values for a given predicate