server/src/app/Libraries/Mappers/CocoonAbstractRdfMapper.php
changeset 145 49b75287c30b
parent 144 03678acbfda3
child 504 4ab820b387da
--- a/server/src/app/Libraries/Mappers/CocoonAbstractRdfMapper.php	Sat Mar 26 00:24:34 2016 +0100
+++ b/server/src/app/Libraries/Mappers/CocoonAbstractRdfMapper.php	Fri Apr 08 17:50:49 2016 +0200
@@ -80,6 +80,22 @@
         $providedCHOResource->add($prop, trim($value));
     }
 
+    protected function propertyCollectionMap($providedCHOResource, $prop, $value) {
+        // if this is a collection, we use the edm:isGatheredInto property
+        if(CocoonUtils::isResourceCollection($value)) {
+            $resId = CocoonUtils::getIdFromUri($value->getUri());
+            $resUri = CocoonUtils::getCorpusUriFromId($resId);
+            $providedCHOResource->addResource('http://www.europeana.eu/schemas/edm/isGatheredInto', $resUri);
+        } elseif (strpos($value->getUri(), config('corpusparole.cocoon_doc_id_base_uri')) === 0 ) {
+            $resId = CocoonUtils::getIdFromUri($value->getUri());
+            $resUri = CocoonUtils::getCorpusUriFromId($resId);
+            $providedCHOResource->add($prop, $resUri);
+        } else {
+            $providedCHOResource->add($prop, $value);
+        }
+    }
+
+
     protected function addSpatialProperties($destRes, $res, $outputGraph) {
         $spatials = $res->all($this->inputGraph->resource('http://purl.org/dc/terms/spatial'));
         $lats = $res->all($this->inputGraph->resource('http://www.w3.org/2003/01/geo/wgs84_pos#lat'));