src/snac/server/ServerExecutor.php
/**
     * Make Assertion about Constellations
     *
     * Processes and adds assertions about the given constellelation IDs (in input).  Requires a type of assertion,
     * and currently supports "not_same" relations.
     *
     * @param string[] $input Input array from the Server object
     * @throws \snac\exceptions\SNACException
     * @return string[] The response to send to the client
     */
Make Assertion about Constellations
Processes and adds assertions about the given constellelation IDs (in input).  Requires a type of assertion,
and currently supports "not_same" relations.

@param string[] $input Input array from the Server object
@throws \snac\exceptions\SNACException
@return string[] The response to send to the client
Make Assertion about Constellations Processes and adds assertions about the given constellelation IDs ( in input ) . Requires a type of assertion and currently supports " not_same " relations . @param string [] $input Input array from the Server object @throws \ snac \ exceptions \ SNACException @return string [] The response to send to the client
public function makeAssertion(&$input) {
        $response = array();
        if (!isset($input["assertion"]) || !isset($input["type"])) {
            throw new \snac\exceptions\SNACInputException("Must specify an assertion to make", 400);
        }
        $response["result"] = "failure";
        if (isset($input["constellationids"]) && is_array($input["constellationids"]) && count($input["constellationids"]) > 1) {
            switch($input["type"]) {
                case "not_same":
                    $this->removeMaybeSameConstellation($input);
                    $success = true;
                    for($i = 0; $i < count($input["constellationids"]) - 1; $i++) {
                        for($j = $i+1; $j < count($input["constellationids"]); $j++) {
                            $constellation1 = new \snac\data\Constellation();
                            $constellation1->setID($input["constellationids"][$i]);
                            $constellation2 = new \snac\data\Constellation();
                            $constellation2->setID($input["constellationids"][$j]);
                            $success = $success && $this->cStore->addNotSameAssertion($constellation1, $constellation2, $this->user, $input["assertion"]);
                        }
                    }
                    if ($success)
                        $response["result"] = "success";
                    else
                        $response["error"] = "Could not make assertions for all Constellation pairs";
                    break;
            }
        }
        $response["debug"] = $input;
        return $response;
    }
public function makeAssertion ( & $ input ) { $ response = array ( ) ; if ( ! isset ( $ input [ " assertion " ] ) || ! isset ( $ input [ " type " ] ) ) { throw new \ snac \ exceptions \ SNACInputException ( " Must specify an assertion to make " , 400 ) ; } $ response [ " result " ] = " failure " ; if ( isset ( $ input [ " constellationids " ] ) && is_array ( $ input [ " constellationids " ] ) && count ( $ input [ " constellationids " ] ) > 1 ) { switch ( $ input [ " type " ] ) { case " not_same " : $ this -> removeMaybeSameConstellation ( $ input ) ; $ success = true ; for ( $ i = 0 ; $ i < count ( $ input [ " constellationids " ] ) - 1 ; $ i ++ ) { for ( $ j = $ i + 1 ; $ j < count ( $ input [ " constellationids " ] ) ; $ j ++ ) { $ constellation1 = new \ snac \ data \ Constellation ( ) ; $ constellation1 -> setID ( $ input [ " constellationids " ] [ $ i ] ) ; $ constellation2 = new \ snac \ data \ Constellation ( ) ; $ constellation2 -> setID ( $ input [ " constellationids " ] [ $ j ] ) ; $ success = $ success && $ this -> cStore -> addNotSameAssertion ( $ constellation1 , $ constellation2 , $ this -> user , $ input [ " assertion " ] ) ; } } if ( $ success ) $ response [ " result " ] = " success " ; else $ response [ " error " ] = " Could not make assertions for all Constellation pairs " ; break ; } } $ response [ " debug " ] = $ input ; return $ response ; }
Make Assertion about Constellations
 Processes and adds assertions about the given constellelation IDs (in input).
Make Assertion about Constellations Processes and adds assertions about the given constellelation IDs ( in input ) .
// Just in case, make sure there are no maybe-same links for these constellations