public function saveColor()
 {
     try {
         $model = new TypeInstance($this->data->idAnnotationStatus);
         $model->setIdColor($this->data->idColor);
         $model->save();
         $this->renderPrompt('information', 'OK');
     } catch (\Exception $e) {
         $this->renderPrompt('error', $e->getMessage());
     }
 }
 public function setIdAnnotationStatus($value)
 {
     if (substr($value, 0, 3) == 'ast') {
         $as = new TypeInstance();
         $filter = (object) ['entry' => $value];
         $idStatus = $as->listAnnotationStatus($filter)->asQuery()->getResult()[0]['idAnnotationStatus'];
     } else {
         $idStatus = $value;
     }
     parent::setIdAnnotationStatus($idStatus);
 }
 public function setIdInstantiationTypeFromEntry($entry)
 {
     $ti = new TypeInstance();
     $idInstantiationType = $ti->getIdInstantiationTypeByEntry($entry);
     parent::setIdInstantiationType($idInstantiationType);
 }
 public function createFromFrame($idFrame)
 {
     $transaction = $this->beginTransaction();
     try {
         $frame = new Frame($idFrame);
         $this->setEntry('tpl_' . strtolower(str_replace('frm_', '', $frame->getEntry())));
         $this->save();
         Base::createEntityRelation($this->getIdEntity(), 'rel_createdfrom', $frame->getIdEntity());
         $fes = $frame->listFE()->asQuery()->asObjectArray();
         $fe = new FrameElement();
         foreach ($fes as $feData) {
             $fe->setPersistent(false);
             $feEntry = $this->getEntry() . '_' . $feData->entry;
             $entry = new Entry();
             $entry->cloneEntry($feData->entry, $feEntry);
             $fe->setEntry($feData->entry);
             $entity = new Entity();
             $entity->setAlias($feEntry);
             $entity->setType('FE');
             $entity->save();
             Base::createEntityRelation($entity->getId(), 'rel_elementof', $this->getIdEntity());
             $coreType = new TypeInstance($feData->idCoreType);
             Base::createEntityRelation($entity->getId(), 'rel_hastype', $coreType->getIdEntity());
             $fe->setIdEntity($entity->getId());
             $fe->setActive(true);
             $fe->setIdColor($feData->idColor);
             $fe->saveModel();
         }
         $transaction->commit();
     } catch (\Exception $e) {
         $transaction->rollback();
         throw new \Exception($e->getMessage());
     }
 }
 public function createFromData($fe)
 {
     $this->setPersistent(false);
     $this->setEntry($fe->entry);
     $this->setActive($fe->active);
     $this->setIdEntity($fe->idEntity);
     $this->setIdColor($fe->idColor);
     $coreType = new TypeInstance();
     $idCoreType = $coreType->getIdCoreTypeByEntry($fe->coreType);
     $coreType->getById($idCoreType);
     Base::createEntityRelation($fe->idEntity, 'rel_hastype', $coreType->getIdEntity());
     parent::save();
 }
 public static function newFromProlucidSearchInstance($table, $inst)
 {
     global $toprundir;
     $toprundir = "/tmp/";
     $jobclus = new ProlucidJobCluster();
     $jobclus->setEmail("*****@*****.**");
     $fh = new FileHandler();
     print "\nGenerating input files for [" . $inst->getName() . "]\n";
     $exname = $inst->getPropertyValue("Experiment");
     $ex = new TypeInstance("Experiment", $exname);
     $ex->fetch($table);
     $jobclus->setExperiment($ex);
     // Set the experiment
     $dbname = $inst->getPropertyValue("Protein_Database");
     $db = new TypeInstance("Protein_Database", $dbname);
     $db->fetch($table);
     $dbfile = preg_replace("#http://DUMMYHOST.ROOTDIR/misc/MiniFileView.php/#", "", $db->getPropertyValue("File"));
     $dbfile = $fh->getFilePath($dbfile);
     $jobclus->setDatabaseFile($dbfile);
     // Set the database
     $jobclus->setSourceInstance($inst);
     // Set the source instance
     $jobclus->setSourceType("Prolucid_Search");
     // Set the source type
     $count = 1;
     $jobname = $inst->getName() . "_LSF_Job_" . $count;
     $jobinst = new TypeInstance("LSF_Job", $jobname);
     while ($jobinst->exists($table)) {
         $count++;
         $jobname = $inst->getName() . "_LSF_Job_" . $count;
         $jobinst = new TypeInstance("LSF_Job", $jobname);
     }
     $jobdir = $toprundir . $jobname . "/";
     $outdir = $jobdir . "out";
     $jobclus->setJobName($jobname);
     // Set the job name
     $jobclus->setRunDir($jobdir);
     // Set the job directory
     $jobclus->setOutDir($outdir);
     // Set the output directory
     return $jobclus;
 }
<?php

$topdir = dirname(dirname(__FILE__));
error_reporting(E_ALL);
require_once "{$topdir}/GlobalConfig.php";
require_once "{$topdir}/plugins/HarvardSMLims/ProlucidJobCluster.php";
require_once "{$topdir}/datamodel/TestDB.php";
require_once "Test.php";
$tname = 'semantic_data';
$sqlfile = 'testdb_small.sql';
$sqlfile2 = getcwd() . '/prolucid.sql';
$test = new Test();
$testdb = new TestDB();
$test->result($testdb, "Created TestDB");
$testdb->load_sql($sqlfile2);
$test->result($testdb, "Loaded prolucid sql");
$table = $testdb->getTable();
$test->result($table, "Got Table");
$plinst = new TypeInstance("Prolucid_Search", "PRO00001");
$plinst->fetch($table);
print $plinst->printValues() . "\n";
$jobclus = ProlucidJobCluster::newFromProlucidSearchInstance($table, $plinst);
$jobclus->split();
$test->print_total("ProlucidJobCluster");