src/snac/util/EACCPFSerializer.php
/**
     * Create cpfRelation sameAs and remove sameAsRelations sameAs
     *
     * Original ingested cpfRelations that are sameAs are saved in table otherid, PHP object
     * otherRecordIDs. The xlink:href for sameAs is (not surprisingly) the same as the entityType.
     *
     * Serializing back to CPF we need to reverse that process, but only for sameAs.
     *
     * This adds new ConstellationRelation entries, as appropriated. It also creates a replacement
     * otherRecordIDs as necessary that only contains the non-sameAs entries.
     *
     * @param string[] $data String array reference which is the constellation as a PHP array, from Constellation->toArray().
     * Using the reference, changes are made in place.
     */
Create cpfRelation sameAs and remove sameAsRelations sameAs
Original ingested cpfRelations that are sameAs are saved in table otherid, PHP object
otherRecordIDs. The xlink:href for sameAs is (not surprisingly) the same as the entityType.

Serializing back to CPF we need to reverse that process, but only for sameAs.

This adds new ConstellationRelation entries, as appropriated. It also creates a replacement
otherRecordIDs as necessary that only contains the non-sameAs entries.

@param string[] $data String array reference which is the constellation as a PHP array, from Constellation->toArray().
Using the reference, changes are made in place.
Create cpfRelation sameAs and remove sameAsRelations sameAs Original ingested cpfRelations that are sameAs are saved in table otherid PHP object otherRecordIDs . The xlink : href for sameAs is ( not surprisingly ) the same as the entityType . Serializing back to CPF we need to reverse that process but only for sameAs . This adds new ConstellationRelation entries as appropriated . It also creates a replacement otherRecordIDs as necessary that only contains the non - sameAs entries . @param string [] $data String array reference which is the constellation as a PHP array from Constellation - > toArray () . Using the reference changes are made in place .
private static function cpfSameAs(&$data) {
        $fixedOIDs = array();
        if (array_key_exists('sameAsRelations', $data)) {
            if (!isset($data['relations'])) {
                $data['relations'] = array();
            }
            foreach($data['sameAsRelations'] as $oId) {
                if (isset($oId['type']) && $oId['type']['term'] == 'sameAs') {
                    $cpfRel = array();
                    $cpfRel['dataType'] = "ConstellationRelation";
                    $cpfRel['targetArkID'] = $oId['uri']; 
                    $cpfRel['type'] = $oId['type']; 
                    if (array_key_exists('text', $oId)) {
                        $cpfRel['content'] = $oId['text']; 
                    }
                    $cpfRel['targetEntityType']['uri'] = $data['entityType']['uri']; 
                    $cpfRel['targetEntityType']['term'] = $data['entityType']['term']; 
                    array_push($data['relations'], $cpfRel);
                } else {
                    array_push($fixedOIDs, $oId);
                }
            }
            $data['sameAsRelations'] = $fixedOIDs;
        }
    }
private static function cpfSameAs ( & $ data ) { $ fixedOIDs = array ( ) ; if ( array_key_exists ( 'sameAsRelations' , $ data ) ) { if ( ! isset ( $ data [ 'relations' ] ) ) { $ data [ 'relations' ] = array ( ) ; } foreach ( $ data [ 'sameAsRelations' ] as $ oId ) { if ( isset ( $ oId [ 'type' ] ) && $ oId [ 'type' ] [ 'term' ] == 'sameAs' ) { $ cpfRel = array ( ) ; $ cpfRel [ 'dataType' ] = " ConstellationRelation " ; $ cpfRel [ 'targetArkID' ] = $ oId [ 'uri' ] ; $ cpfRel [ 'type' ] = $ oId [ 'type' ] ; if ( array_key_exists ( 'text' , $ oId ) ) { $ cpfRel [ 'content' ] = $ oId [ 'text' ] ; } $ cpfRel [ 'targetEntityType' ] [ 'uri' ] = $ data [ 'entityType' ] [ 'uri' ] ; $ cpfRel [ 'targetEntityType' ] [ 'term' ] = $ data [ 'entityType' ] [ 'term' ] ; array_push ( $ data [ 'relations' ] , $ cpfRel ) ; } else { array_push ( $ fixedOIDs , $ oId ) ; } } $ data [ 'sameAsRelations' ] = $ fixedOIDs ; } }
Create cpfRelation sameAs and remove sameAsRelations sameAs
 Original ingested cpfRelations that are sameAs are saved in table otherid, PHP object
 otherRecordIDs.
Create cpfRelation sameAs and remove sameAsRelations sameAs Original ingested cpfRelations that are sameAs are saved in table otherid PHP object otherRecordIDs .
// xlink:href // .uri is xlink:arcrole // relationEntry // xlink:role // xlink:role