diff -r 16e1473a6a99 -r be2d3b30b2e0 server/src/tests/libraries/Mappers/CocoonSoundRdfMapperTest.php --- 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 @@ , ; " Freely available for non-commercial use" ; ; - , ; + , , ; "PT0H47M16S" ; "1969-04-11"^^ ; "FR"^^ , , "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