function getDistinctTable(DataMatcherLinkOnePart $dataMatcherLinkOnePart)
{
    $pageLength = $_POST['iDisplayLength'];
    $page = $_POST['iDisplayStart'] / $pageLength + 1;
    $searchTerm = $_POST['sSearch'];
    //foreach ($dataMatcherLinkOnePart->transformation as $transformation) {
    $cidSearchTerm[$dataMatcherLinkOnePart->transformation] = $searchTerm;
    //}
    $dataMatcher = new DataMatcher();
    $distinctTable = $dataMatcher->GetDistinctForColumns($dataMatcherLinkOnePart, $pageLength, $page, $cidSearchTerm);
    $tableRows = array();
    if (isset($distinctTable)) {
        if ($distinctTable->rows != null) {
            foreach ($distinctTable->rows as $rowObj) {
                $tableRow = array();
                foreach ($distinctTable->columns as $column) {
                    if (is_object($rowObj)) {
                        //TODO: this need to be fixed. There should only one format of returned data. All should be accociated array
                        $tableRow[] = $rowObj->{$column};
                    } else {
                        $tableRow[] = $rowObj[$column];
                    }
                }
                $tableRows[] = $tableRow;
            }
        } else {
            $tableRows = array();
        }
    }
    $jsonResult['aaData'] = $tableRows;
    $jsonResult['aoColumns'] = $distinctTable->columns;
    // $jsonResult['mData'] = $distinctTable->rows;
    if (is_object($distinctTable->totalRows[0])) {
        // TODO FIXME.
        $jsonResult["iTotalRecords"] = $distinctTable->totalRows[0]->ct;
        $jsonResult["iTotalDisplayRecords"] = $distinctTable->totalRows[0]->ct;
    } else {
        $jsonResult["iTotalRecords"] = $distinctTable->totalRows[0]['ct'];
        $jsonResult["iTotalDisplayRecords"] = $distinctTable->totalRows[0]['ct'];
    }
    echo json_encode($jsonResult);
}
Exemplo n.º 2
0
 /**
  * Adds colfusion relationship between two stories. Also addes neo4j relationship and nodes if needed. And trigres backgroun computatio of datamatching ratios.
  * @param [type] $user_id     id of the user who adds new relationships.
  * @param [type] $name        name of the relationship.
  * @param [type] $description short textual description for new relationship.
  * @param [type] $from        object containing info about From dataset sid and columns of the relationships from From dataset. TODO: create a class for that object.
  * @param [type] $to          object containing info about To dataset sid and columns of the relationships from To dataset. TODO: the class class as for From should be used.
  * @param [type] $confidence  confidence value for the relationship.
  * @param [type] $comment     shor textual comment for the relationship.
  */
 public function AddRelationship($user_id, $name, $description, $from, $to, $confidence, $comment)
 {
     // Add new relationshp in to colfusion
     $relationshipDao = new RelationshipDAO();
     $rel_id = $relationshipDao->addRelationship($user_id, $name, $description, $from, $to, $confidence, $comment);
     // add newly created relationshiop to neo4j.
     $neo4JDAO = new Neo4JDAO();
     $neo4JDAO->addRelationshipByRelId($rel_id);
     // triger background execution of data matching ration calcualtion.
     $dataMatcher = new DataMatcher();
     $dataMatcher->calculateDataMatchingRatios(array($rel_id));
 }