server/src/tests/libraries/Mappers/CocoonSoundRdfMapperTest.php
changeset 108 be2d3b30b2e0
parent 21 01e7e6a17317
child 111 af85c436048f
--- a/server/src/tests/libraries/Mappers/CocoonSoundRdfMapperTest.php	Fri Jan 22 17:43:25 2016 +0100
+++ b/server/src/tests/libraries/Mappers/CocoonSoundRdfMapperTest.php	Tue Jan 19 19:16:23 2016 +0100
@@ -36,7 +36,7 @@
             <http://purl.org/dc/terms/isFormatOf> <http://cocoon.huma-num.fr/data/eslo/ESLO1_ENT_019_22km.wav> , <http://cocoon.huma-num.fr/data/eslo/ESLO1_ENT_019.mp3> ;
             <http://purl.org/dc/terms/accessRights> " Freely available for non-commercial use" ;
             <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ;
-            <http://purl.org/dc/terms/isPartOf> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LANGUESDEFRANCE> , <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ESLO1> ;
+            <http://purl.org/dc/terms/isPartOf> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LANGUESDEFRANCE> , <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ESLO1>, <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ESLO1_ENT_010> ;
             <http://purl.org/dc/terms/extent> "PT0H47M16S" ;
             <http://purl.org/dc/terms/created> "1969-04-11"^^<http://purl.org/dc/terms/W3CDTF> ;
             <http://purl.org/dc/terms/spatial> "FR"^^<http://purl.org/dc/terms/ISO3166> , <http://vocab.getty.edu/tgn/7008337> , "France, Centre, Loiret, Orléans"@fr ;
@@ -272,7 +272,6 @@
             'http://purl.org/dc/elements/1.1/type',
             'http://purl.org/dc/elements/1.1/language',
             'http://purl.org/dc/terms/medium',
-            'http://purl.org/dc/terms/isPartOf',
             'http://purl.org/dc/elements/1.1/source',
             'http://purl.org/dc/terms/alternative',
             'http://purl.org/dc/terms/modified',
@@ -305,10 +304,40 @@
     }
 
     /**
-    * Test one to one mapping spatial info
-    *
-    * @return void
-    */
+     * Test mapping for isPartOf
+     *
+     * @return void
+     */
+    public function testOneToOneProvidedCHOIsPartOf() {
+        $providedCHO = $this->resGraphes['BASE']->get('edm:ProvidedCHO', '^rdf:type');
+        $sourceNode = $this->inputGraphes['BASE']->get('http://crdo.risc.cnrs.fr/schemas/Resource', '^rdf:type');
+
+        $this->assertNotNull($providedCHO);
+        $this->assertNotNull($sourceNode);
+
+        $isGatheredInto = $providedCHO->all($this->resGraphes['BASE']->resource('http://www.europeana.eu/schemas/edm/isGatheredInto'));
+        $this->assertCount(2, $isGatheredInto, "Must have two collection node");
+
+        $ispartOf = $providedCHO->all($this->resGraphes['BASE']->resource('http://purl.org/dc/terms/isPartOf'));
+        $this->assertCount(1, $ispartOf, "Must have one collection node");
+
+        $outputValuesStr = [];
+        foreach($providedCHO->all($this->resGraphes['BASE']->resource('http://www.europeana.eu/schemas/edm/isGatheredInto')) as $outputValue) {
+            array_push($outputValuesStr, strval($outputValue));
+        }
+        $this->assertNotEmpty($outputValuesStr, "we must found some values to test isGatheredInto");
+
+        $this->assertContains("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LANGUESDEFRANCE", $outputValuesStr, "http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LANGUESDEFRANCE not found in output graph");
+        $this->assertContains("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ESLO1", $outputValuesStr, "http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ESLO1 not found in output graph");
+
+        $this->assertEquals("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ESLO1_ENT_010", strval($providedCHO->get($this->resGraphes['BASE']->resource('http://purl.org/dc/terms/isPartOf'))), "the isPartOf mus equals http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ESLO1_ENT_010");
+    }
+
+    /**
+     * Test one to one mapping spatial info
+     *
+     * @return void
+     */
     public function testOneToOneProvidedCHOSpatial() {
         $providedCHO = $this->resGraphes['BASE']->get('edm:ProvidedCHO', '^rdf:type');
         $sourceNode = $this->inputGraphes['BASE']->get('http://crdo.risc.cnrs.fr/schemas/Resource', '^rdf:type');
@@ -468,7 +497,6 @@
 
     }
 
-
     /**
      * Test collection graph creation
      * @return void