Exemple #1
0
 /**
  * Returns all located Loomp annotations (ARS_LocatedAnnotation)
  * for a given ARS_UIMA_Annotation.
  * 
  * @param   ARS_UIMA_Annotation  $uimaAnnotation
  * 		The UIMA annotation.
  * @return  array  The located loomp annotations (ARS_LocatedAnnotation).
  */
 public function getLocatedLoompAnnotationsForARS_UIMA_Annotation($uimaAnnotation)
 {
     $loompAnnotations = array();
     $begin = $uimaAnnotation->hasAttribute('begin') ? $uimaAnnotation->getAttribute('begin') : null;
     $end = $uimaAnnotation->hasAttribute('end') ? $uimaAnnotation->getAttribute('end') : null;
     $namespaceUrl = $uimaAnnotation->getNamespaceUrl($uimaAnnotation->getNamespace());
     $full = $namespaceUrl ? $namespaceUrl . '/' : '';
     $full .= $uimaAnnotation->getName();
     $mappedAttributes = array_key_exists($full, $this->_mappings) ? $this->_mappings[$full] : null;
     if (!empty($mappedAttributes)) {
         foreach ($mappedAttributes as $attribute => $uris) {
             if (empty($attribute) || $uimaAnnotation->hasAttribute($attribute)) {
                 foreach ($uris as $uri) {
                     if (array_key_exists($uri, $this->_annotations)) {
                         $seeAlsoProp = array_key_exists($full, $this->_seeAlso_mappings) ? $this->_seeAlso_mappings[$full] : null;
                         $seeAlso = $seeAlsoProp && $uimaAnnotation->hasAttribute($seeAlsoProp) ? $uimaAnnotation->getAttribute($seeAlsoProp) : null;
                         $loompAnnotations[] = new ARS_LocatedAnnotation($this->_annotations[$uri], $begin, $end, null, $seeAlso);
                     }
                 }
             }
         }
     }
     return array_values(array_unique($loompAnnotations));
 }