src/snac/server/database/SQL.php
/**
     * Insert a related identity
     *
     * related identity is also known as table related_identity, aka constellation relation, aka cpf relation,
     * aka ConstellationRelation object. We first insert into related_identity saving the inserted record id.
     *
     * @param string[] $vhInfo associative list with keys: version, ic_id
     *
     * @param integer $targetID The constellation id of the related entity (aka the relation)
     *
     * @param string $targetArkID The ARK of the related entity
     *
     * @param string $targetEntityTypeID The entity type of the target relation (aka the other entity aka the related entity)
     *
     * @param integer $type A foreign key id of entityType, traditionally the xlink:arcrole of the relation
     * (aka relation type, a controlled vocabulary)
     *
     * @param integer $relationType A foreign key id. The CPF relation type of this relationship, originally
     * only used by AnF cpfRelation@cpfRelationType. Probably xlink:arcrole should be used instead of
     * this. The two seem related and/or redundant.
     *
     * @param string $content Content of this relation
     *
     * @param string $note A note, perhaps a descriptive note about the relationship
     *
     * @param integer $id The record (related_identity.id) id
     *
     * @return integer the record (related_identity.id) id
     *
     */
Insert a related identity
related identity is also known as table related_identity, aka constellation relation, aka cpf relation,
aka ConstellationRelation object. We first insert into related_identity saving the inserted record id.

@param string[] $vhInfo associative list with keys: version, ic_id

@param integer $targetID The constellation id of the related entity (aka the relation)

@param string $targetArkID The ARK of the related entity

@param string $targetEntityTypeID The entity type of the target relation (aka the other entity aka the related entity)

@param integer $type A foreign key id of entityType, traditionally the xlink:arcrole of the relation
(aka relation type, a controlled vocabulary)

@param integer $relationType A foreign key id. The CPF relation type of this relationship, originally
only used by AnF cpfRelation@cpfRelationType. Probably xlink:arcrole should be used instead of
this. The two seem related and/or redundant.

@param string $content Content of this relation

@param string $note A note, perhaps a descriptive note about the relationship



@return integer the record (related_identity.id) id
Insert a related identity related identity is also known as table related_identity aka constellation relation aka cpf relation aka ConstellationRelation object . We first insert into related_identity saving the inserted record id . @param string [] $vhInfo associative list with keys : version ic_id @param integer $targetID The constellation id of the related entity ( aka the relation ) @param string $targetArkID The ARK of the related entity @param string $targetEntityTypeID The entity type of the target relation ( aka the other entity aka the related entity ) @param integer $type A foreign key id of entityType traditionally the xlink : arcrole of the relation ( aka relation type a controlled vocabulary ) @param integer $relationType A foreign key id . The CPF relation type of this relationship originally only used by AnF cpfRelation@cpfRelationType . Probably xlink : arcrole should be used instead of this . The two seem related and / or redundant . @param string $content Content of this relation @param string $note A note perhaps a descriptive note about the relationship @return integer the record ( related_identity . id ) id
public function insertRelation($vhInfo,
                                   $targetID,
                                   $targetArkID,
                                   $targetEntityTypeID,
                                   $type,
                                   $relationType,
                                   $content,
                                   $note,
                                   $id)
    {
        if (! $id)
        {
            $id = $this->selectID();
        }
        $qq = 'insert_relation'; 
        $this->sdb->prepare($qq,
                            'insert into related_identity
                            (version, ic_id, related_id, related_ark, role, arcrole,
                            relation_type, relation_entry, descriptive_note, id)
                            values
                            ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)');
        $execList = array($vhInfo['version'],
                          $vhInfo['ic_id'],
                          $targetID,
                          $targetArkID,
                          $targetEntityTypeID,
                          $type,
                          $relationType,
                          $content,
                          $note,
                          $id);
        $result = $this->sdb->execute($qq, $execList);
        $row = $this->sdb->fetchrow($result);
        $this->sdb->deallocate($qq);
        return $id;
    }
public function insertRelation ( $ vhInfo , $ targetID , $ targetArkID , $ targetEntityTypeID , $ type , $ relationType , $ content , $ note , $ id ) { if ( ! $ id ) { $ id = $ this -> selectID ( ) ; } $ qq = 'insert_relation' ; $ this -> sdb -> prepare ( $ qq , 'insert into related_identity
                            (version, ic_id, related_id, related_ark, role, arcrole,
                            relation_type, relation_entry, descriptive_note, id)
                            values
                            ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)' ) ; $ execList = array ( $ vhInfo [ 'version' ] , $ vhInfo [ 'ic_id' ] , $ targetID , $ targetArkID , $ targetEntityTypeID , $ type , $ relationType , $ content , $ note , $ id ) ; $ result = $ this -> sdb -> execute ( $ qq , $ execList ) ; $ row = $ this -> sdb -> fetchrow ( $ result ) ; $ this -> sdb -> deallocate ( $ qq ) ; return $ id ; }
Insert a related identity
 related identity is also known as table related_identity, aka constellation relation, aka cpf relation,
 aka ConstellationRelation object.
Insert a related identity related identity is also known as table related_identity aka constellation relation aka cpf relation aka ConstellationRelation object .
// If this is a new record, get a record id, else use the previously assigned id // aka insert_related_identity // Combine vhInfo and the remaining args into a big array for execute().