server/src/app/Console/Commands/IndexDocuments.php
changeset 496 a53762d61c06
parent 407 2dba812c7ef2
child 497 f3474aeec884
--- a/server/src/app/Console/Commands/IndexDocuments.php	Fri Feb 03 13:01:08 2017 +0100
+++ b/server/src/app/Console/Commands/IndexDocuments.php	Fri Feb 03 16:35:09 2017 +0100
@@ -207,25 +207,25 @@
                 array_push($res, [
                     'uri' => $mBnf[0],
                     'code' => $mBnf[1],
-                    'type' => 'bnf'
+                    'type' => Utils::SUBJECT_TYPE_BNF
                 ]);
             } elseif($s instanceof Resource && preg_match(config('corpusparole.lexvo_url_regexp'), $s->getUri(), $mLexvo) === 1) {
                 array_push($res, [
                     'uri' => $mLexvo[0],
                     'code' => $mLexvo[1],
-                    'type' => 'lxv'
+                    'type' => Utils::SUBJECT_TYPE_LEXVO
                 ]);
             } elseif($s instanceof Literal && strpos($s->getDatatypeUri(), config('corpusparole.olac_base_url')) === 0 ) {
                 array_push($res, [
                     'uri' => $s->getValue(),
                     'code' => $s->getValue(),
-                    'type' => 'olac'
+                    'type' => Utils::SUBJECT_TYPE_OLAC
                 ]);
             } elseif($s instanceof Literal) {
                 array_push($res, [
                     'uri' => $s->getValue(),
                     'code' => $s->getValue(),
-                    'type' => 'txt'
+                    'type' => Utils::SUBJECT_TYPE_TXT
                 ]);
             }
             return $res;
@@ -235,7 +235,7 @@
             array_unique(array_reduce(
                 $sres,
                 function($r, $so) {
-                    if($so['type'] === 'bnf') {
+                    if($so['type'] === Utils::SUBJECT_TYPE_BNF) {
                         array_push($r, $so['uri']);
                     }
                     return $r;
@@ -246,7 +246,7 @@
             array_unique(array_reduce(
                 $sres,
                 function($r, $so) {
-                    if($so['type'] === 'lxv') {
+                    if($so['type'] === Utils::SUBJECT_TYPE_LEXVO) {
                         array_push($r, $so['uri']);
                     }
                     return $r;
@@ -256,12 +256,12 @@
 
         return array_map(function($so) use ($labelsBnf, $labelsLexvo) {
             $label = $so['uri'];
-            if($so['type'] === 'bnf') {
+            if($so['type'] === Utils::SUBJECT_TYPE_BNF) {
                 $label = $labelsBnf[$label];
-            } elseif ($so['type'] === 'lxv') {
+            } elseif ($so['type'] === Utils::SUBJECT_TYPE_LEXVO) {
                 $label = $labelsLexvo[$label];
             }
-            return [ 'label' => $label, 'code' => $so['code'], 'label_code' =>  $label."|".$so['type']."|".$so['code'] ]; }, $sres
+            return [ 'label' => $label, 'code' => $so['type']."|".$so['code'], 'label_code' =>  $label."|".$so['type']."|".$so['code'] ]; }, $sres
         );
     }