--- a/server/src/app/Libraries/Mergers/CocoonSoundRdfMerger.php Thu Feb 23 18:59:04 2017 +0100
+++ b/server/src/app/Libraries/Mergers/CocoonSoundRdfMerger.php Thu Mar 02 15:09:17 2017 +0100
@@ -132,10 +132,33 @@
$srcRight = $srcArray[$prop][0];
}
+
$license = [ 'type' => 'uri', 'value' => config('corpusparole.corpus_doc_default_cc_rights') ];
- if($baseRight != null && $baseRight == $srcRight ) {
+ if($baseRight == null && $srcRight != null) {
+ $license = $srcRight;
+ } elseif($baseRight != null && $srcRight == null) {
$license = $baseRight;
+ } elseif($baseRight != null && $srcRight != null) {
+
+ // The sound rights takes precedence. We test for Text which is easier.
+ $soundRight = null;
+ $baseCHO = $baseRes->get("<http://www.europeana.eu/schemas/edm/aggregatedCHO>");
+ if(!is_null($baseCHO)) {
+ foreach ($baseCHO->all("dc11:type","resource") as $resType) {
+ $type = $resType->getUri();
+ if($type === 'http://purl.org/dc/dcmitype/Text') {
+ // the baseRes is a text, we take the source
+ $soundRight = $srcRight;
+ break;
+ }
+ }
+ }
+ // in all case we take the base right
+ if(is_null($soundRight)) {
+ $soundRight = $baseRight;
+ }
+ $license = $soundRight;
}
$targetArray[$prop] = [$license,];