public function listForEditor($idEntityCxn) { $criteria = $this->getCriteria()->select('idEntity,entries.name as name')->orderBy('entries.name'); Base::entryLanguage($criteria); Base::relation($criteria, 'constructionelement', 'construction', 'rel_elementof'); $criteria->where("construction.idEntity = {$idEntityCxn}"); return $criteria; }
public function listCE() { $ce = new ConstructionElement(); $criteria = $ce->getCriteria()->select('idConstructionElement, entry, entries.name as name, color.rgbFg, color.rgbBg, color.idColor'); Base::entryLanguage($criteria); Base::relation($criteria, 'constructionelement', 'construction', 'rel_elementof'); $criteria->where("construction.idConstruction = {$this->getId()}"); $criteria->orderBy('entries.name'); return $criteria; }
public function listLabelType($filter) { $idLanguage = \Manager::getSession()->idLanguage; $criteria = $this->getCriteria()->select('idLayerType, entry, genericlabel.name as labelType, genericlabel.idEntity as idLabelType')->orderBy('entry, genericlabel.name'); Base::relation($criteria, 'layertype', 'genericlabel', 'rel_haslabeltype'); $criteria->where("genericlabel.idLanguage = {$idLanguage}"); if ($filter->entry) { $criteria->where("entry = '{$filter->entry}'"); } return $criteria; }
public function listLUByWordForm($wordform) { $criteria = $this->getCriteria(); $criteria->select('lexeme.lexemeentries.lemma.lus.idLU'); $criteria->where("upper(form) = upper('{$wordform}')"); $lus = $criteria->asQuery()->chunkResult('idLU', 'idLU'); if (count($lus) > 0) { $lu = new LU(); $criteria = $lu->getCriteria()->select("idLU, concat(frame.entries.name,'.',name) as fullName"); Base::relation($criteria, 'lu', 'frame', 'rel_evokes'); Base::entryLanguage($criteria, 'frame'); $criteria->where("idLU", "IN", $lus); $criteria->where("lemma.idLanguage", "=", "frame.entries.idLanguage"); return $criteria->asQuery()->chunkResult('idLU', 'fullName'); } else { return new \stdClass(); } }
public function getLabelTypesGL($idSentence) { $criteria = $this->getCriteria(); $criteria->select("idAnnotationSet, l.idLayer, genericlabel.idEntity as idLabelType, genericlabel.name as labelType, genericlabel.idColor, '' as coreType"); $criteria->join('annotationset', 'sentence s', "annotationset.idSentence = s.idSentence"); $criteria->join('annotationset', 'layer l', "annotationset.idAnnotationSet = l.idAnnotationSet"); $criteria->join('layer l', 'layertype lt', "l.idLayerType=lt.idLayerType"); Base::relation($criteria, 'layertype lt', 'genericlabel', 'rel_haslabeltype'); $criteria->where("idSentence = {$idSentence}"); $criteria->where("lt.entry <> 'lty_gf'"); $criteria->where("(genericlabel.idLanguage = s.idLanguage)"); if (!\Manager::checkAccess('MASTER', A_EXECUTE)) { $criteria->where("idAnnotationSet = {$this->getId()}"); } $criteria->orderBy('idAnnotationSet, l.idLayer, genericlabel.name'); return $criteria; }
public function getBaseFrame() { // if template was created from a frame, this frame is the "base frame" $frame = new Frame(); $criteria = $frame->getCriteria()->select('idFrame, entries.name as name, entries.description as description')->orderBy('entries.name'); Base::relation($criteria, 'template', 'frame', 'rel_createdfrom'); $criteria->where("template.idEntity = {$this->getIdEntity()}"); Base::entryLanguage($criteria); return $criteria; }
public function listByFrame($idFrame, $idLanguage = '', $idLU = NULL) { $criteria = $this->getCriteria()->select('*')->orderBy('name'); Base::relation($criteria, 'lu', 'frame', 'rel_evokes'); $criteria->where("frame.idFrame = {$idFrame}"); $criteria->where("lemma.idLanguage = {$idLanguage}"); if ($idLU) { if (is_array($idLU)) { $criteria->where("idLU", "IN", $idLU); } else { $criteria->where("idLU = {$idLU}"); } } $criteria->orderBy('name'); return $criteria; }
public function listFE() { $fe = new FrameElement(); $criteria = $fe->getCriteria()->select('idFrameElement, entry, entries.name as name, typeinstance.entry as coreType, color.rgbFg, color.rgbBg, ' . 'typeinstance.idTypeInstance as idCoreType, color.idColor'); Base::entryLanguage($criteria); Base::relation($criteria, 'frameelement', 'frame', 'rel_elementof'); Base::relation($criteria, 'frameelement', 'typeinstance', 'rel_hastype'); $criteria->where("frame.idFrame = {$this->idFrame}"); $criteria->orderBy('typeinstance.idTypeInstance, entries.name'); return $criteria; }
public function addManualSubCorpusLU($data) { $transaction = $this->beginTransaction(); try { // verifica se a LU já tem um SubCorpus manually-added $criteria = $this->getCriteria()->select('min(idSubCorpus) as idSubCorpusManual'); Base::relation($criteria, 'lu', 'subcorpus', 'rel_hassubcorpus'); $criteria->where("lu.idLU = {$data->idLU}"); $criteria->where("entity.alias like 'sco_manually-added%'"); $idSubCorpus = $criteria->asQuery()->getResult()[0]['idSubCorpusManual']; if ($idSubCorpus) { $this->getById($idSubCorpus); } else { $entity = Base::createEntity('SC', 'sco_manually-added'); $this->setName('manually-added'); $this->setRank(0); $this->setIdEntity($entity->getId()); $this->save(); } $lu = LU::create($data->idLU); Base::createEntityRelation($lu->getIdEntity(), 'rel_hassubcorpus', $this->getIdEntity()); $annotationSet = new AnnotationSet(); $annotationSet->setIdSubCorpus($this->getId()); $annotationSet->setIdSentence($data->idSentence); $annotationSet->setIdAnnotationStatus('ast_manual'); $annotationSet->save(); $annotationSet->createLayersForLU($lu, $data); $transaction->commit(); } catch (\Exception $ex) { $transaction->rollback(); throw new \Exception($ex->getMessage()); } }
public function save($data) { $transaction = $this->beginTransaction(); try { if ($this->isPersistent()) { $coreType = new TypeInstance($this->getIdCoreType()); Base::updateEntityRelation($this->getIdEntity(), 'rel_hastype', $coreType->getIdEntity()); $this->setActive(true); $criteria = $this->getCriteria()->select('fe1.idFrameElement'); Base::relation($criteria, 'frameelement fe1', 'frameelement fe2', 'rel_hastemplate'); $criteria->where("fe2.idEntity = {$this->getIdEntity()}"); $fes = $criteria->asQuery()->getResult(); foreach ($fes as $fe) { $feTemplated = new FrameElement($fe['idFrameElement']); $feTemplated->setIdColor($this->getIdColor()); $feTemplated->save(); } } else { if ($data->idFrame) { $schema = new Frame($data->idFrame); } else { if ($data->idTemplate) { $schema = new Template($data->idTemplate); } } $entity = new Entity(); $entity->setAlias($this->getEntry()); $entity->setType('FE'); $entity->save(); $entry = new Entry(); $entry->newEntry($this->getEntry()); Base::createEntityRelation($entity->getId(), 'rel_elementof', $schema->getIdEntity()); $coreType = new TypeInstance($data->idCoreType); Base::createEntityRelation($entity->getId(), 'rel_hastype', $coreType->getIdEntity()); $this->setIdEntity($entity->getId()); $this->setActive(true); } parent::save(); $transaction->commit(); } catch (\Exception $e) { $transaction->rollback(); throw new \Exception($e->getMessage()); } }