server/src/app/Libraries/Mergers/CocoonSoundRdfMerger.php
changeset 117 7abc74acf392
parent 114 8af5ed0521a2
child 169 8fddc113095e
equal deleted inserted replaced
116:e60c55988ed4 117:7abc74acf392
   109             "http://www.europeana.eu/schemas/edm/dataProvider",
   109             "http://www.europeana.eu/schemas/edm/dataProvider",
   110             "http://www.europeana.eu/schemas/edm/isShownAt",
   110             "http://www.europeana.eu/schemas/edm/isShownAt",
   111             "http://www.europeana.eu/schemas/edm/isShownBy"
   111             "http://www.europeana.eu/schemas/edm/isShownBy"
   112         ], $targetArray, $baseRes, $srcRes);
   112         ], $targetArray, $baseRes, $srcRes);
   113 
   113 
   114     }
   114         $this->mergeEdmRight($targetArray, $baseRes, $srcRes);
       
   115 
       
   116     }
       
   117 
       
   118     protected function mergeEdmRight(&$targetArray, $baseRes, $srcRes) {
       
   119         $srcRdfPhp = $this->srcGraph->toRdfPhp();
       
   120         $srcArray = array_key_exists($srcRes->getUri(), $srcRdfPhp)?$srcRdfPhp[$srcRes->getUri()]:[];
       
   121         $baseRdfPhp = $this->baseGraph->toRdfPhp();
       
   122         $baseArray = array_key_exists($baseRes->getUri(), $baseRdfPhp)?$baseRdfPhp[$baseRes->getUri()]:[];
       
   123 
       
   124         $prop = "http://www.europeana.eu/schemas/edm/rights";
       
   125 
       
   126         $baseRight = null;
       
   127         if(isset($baseArray[$prop]) && count($baseArray[$prop]) > 0) {
       
   128             $baseRight = $baseArray[$prop][0];
       
   129         }
       
   130         $srcRight = null;
       
   131         if(isset($srcArray[$prop]) && count($srcArray[$prop]) > 0) {
       
   132             $srcRight = $srcArray[$prop][0];
       
   133         }
       
   134 
       
   135         $license = [ 'type' => 'uri', 'value' => config('corpusparole.corpus_doc_default_cc_rights') ];
       
   136 
       
   137         if($baseRight != null && $baseRight == $srcRight ) {
       
   138             $license = $baseRight;
       
   139         }
       
   140 
       
   141         $targetArray[$prop] = [$license,];
       
   142     }
       
   143 
       
   144 
   115 
   145 
   116     protected function mergeEdmProvidedCHO($baseRes, $srcRes, $uri=null) {
   146     protected function mergeEdmProvidedCHO($baseRes, $srcRes, $uri=null) {
   117         if(is_null($uri)) {
   147         if(is_null($uri)) {
   118             $uri = $baseRes->getUri();
   148             $uri = $baseRes->getUri();
   119         }
   149         }