--- a/server/src/app/Libraries/Mergers/CocoonSoundRdfMerger.php Fri Feb 05 15:08:46 2016 +0100
+++ b/server/src/app/Libraries/Mergers/CocoonSoundRdfMerger.php Fri Feb 05 17:01:09 2016 +0100
@@ -111,8 +111,38 @@
"http://www.europeana.eu/schemas/edm/isShownBy"
], $targetArray, $baseRes, $srcRes);
+ $this->mergeEdmRight($targetArray, $baseRes, $srcRes);
+
}
+ protected function mergeEdmRight(&$targetArray, $baseRes, $srcRes) {
+ $srcRdfPhp = $this->srcGraph->toRdfPhp();
+ $srcArray = array_key_exists($srcRes->getUri(), $srcRdfPhp)?$srcRdfPhp[$srcRes->getUri()]:[];
+ $baseRdfPhp = $this->baseGraph->toRdfPhp();
+ $baseArray = array_key_exists($baseRes->getUri(), $baseRdfPhp)?$baseRdfPhp[$baseRes->getUri()]:[];
+
+ $prop = "http://www.europeana.eu/schemas/edm/rights";
+
+ $baseRight = null;
+ if(isset($baseArray[$prop]) && count($baseArray[$prop]) > 0) {
+ $baseRight = $baseArray[$prop][0];
+ }
+ $srcRight = null;
+ if(isset($srcArray[$prop]) && count($srcArray[$prop]) > 0) {
+ $srcRight = $srcArray[$prop][0];
+ }
+
+ $license = [ 'type' => 'uri', 'value' => config('corpusparole.corpus_doc_default_cc_rights') ];
+
+ if($baseRight != null && $baseRight == $srcRight ) {
+ $license = $baseRight;
+ }
+
+ $targetArray[$prop] = [$license,];
+ }
+
+
+
protected function mergeEdmProvidedCHO($baseRes, $srcRes, $uri=null) {
if(is_null($uri)) {
$uri = $baseRes->getUri();