# HG changeset patch # User ymh # Date 1486649136 -3600 # Node ID 4ab820b387daebfab419fb0be21bd49bfc672684 # Parent bd2701bd814286ca49d3335880db6caff236a0b2 Correct the handling of created date. Should correct #0025744 diff -r bd2701bd8142 -r 4ab820b387da server/src/app/Libraries/CocoonUtils.php --- a/server/src/app/Libraries/CocoonUtils.php Wed Feb 08 16:38:09 2017 +0100 +++ b/server/src/app/Libraries/CocoonUtils.php Thu Feb 09 15:05:36 2017 +0100 @@ -47,7 +47,7 @@ * @return string */ public static function getCocoonIdFromCorpusUri($uri) { - return substr($uri, strlen(config('corpusparole.cocoon_doc_id_base_uri'))); + return substr($uri, strlen(config('corpusparole.corpus_doc_id_base_uri'))); } /** diff -r bd2701bd8142 -r 4ab820b387da server/src/app/Libraries/Mappers/CocoonAbstractRdfMapper.php --- a/server/src/app/Libraries/Mappers/CocoonAbstractRdfMapper.php Wed Feb 08 16:38:09 2017 +0100 +++ b/server/src/app/Libraries/Mappers/CocoonAbstractRdfMapper.php Thu Feb 09 15:05:36 2017 +0100 @@ -135,6 +135,9 @@ } } + /** + * Add a date properties to a resource (providedCHO, WebResource,...) + */ protected function addDateProperties($targetRes, $res, $outputGraph) { $this->applyPropertiesToRes($res, $targetRes, [ ['http://purl.org/dc/terms/available', null], diff -r bd2701bd8142 -r 4ab820b387da server/src/app/Libraries/Mappers/CocoonContentRdfMapper.php --- a/server/src/app/Libraries/Mappers/CocoonContentRdfMapper.php Wed Feb 08 16:38:09 2017 +0100 +++ b/server/src/app/Libraries/Mappers/CocoonContentRdfMapper.php Thu Feb 09 15:05:36 2017 +0100 @@ -94,11 +94,15 @@ $this->addCHOResourceProperties($providedCHOResource, $res, $outputGraph); - $this->addDateProperties($providedCHOResource, $res, $outputGraph); + $this->addProvidedCHODateProperties($providedCHOResource, $res, $outputGraph); $this->addSpatialProperties($providedCHOResource, $res, $outputGraph); } + protected function addProvidedCHODateProperties($targetRes, $res, $outputGraph) { + $this->addDateProperties($targetRes, $res, $outputGraph); + } + protected function addResourceRightProperties($resource, $res) { $this->applyPropertiesToRes($res, $resource, [ ['http://purl.org/dc/elements/1.1/rights', null], diff -r bd2701bd8142 -r 4ab820b387da server/src/app/Libraries/Mappers/CocoonTextRdfMapper.php --- a/server/src/app/Libraries/Mappers/CocoonTextRdfMapper.php Wed Feb 08 16:38:09 2017 +0100 +++ b/server/src/app/Libraries/Mappers/CocoonTextRdfMapper.php Thu Feb 09 15:05:36 2017 +0100 @@ -149,6 +149,13 @@ // } // } + /** + * Map date properties to providedCHO. + * In the case of a Text, we do nothing as the information must come from the Sound. + */ + protected function addProvidedCHODateProperties($targetRes, $res, $outputGraph) { + } + protected function mapWebResources($res, $outputGraph) { $resId = CocoonUtils::getIdFromUri($this->getResourceBaseId($res)); $resUri = CocoonUtils::getCorpusUriFromId($resId); diff -r bd2701bd8142 -r 4ab820b387da server/src/app/Libraries/Mergers/CocoonSoundRdfMerger.php --- a/server/src/app/Libraries/Mergers/CocoonSoundRdfMerger.php Wed Feb 08 16:38:09 2017 +0100 +++ b/server/src/app/Libraries/Mergers/CocoonSoundRdfMerger.php Thu Feb 09 15:05:36 2017 +0100 @@ -159,7 +159,7 @@ "http://purl.org/dc/terms/issued", ], $targetArray, $baseRes, $srcRes); - // Must handle modified + // Must handle modified and created $isBaseText = false; foreach ($baseRes->all("dc11:type","resource") as $resType) { $type = $resType->getUri(); @@ -171,7 +171,22 @@ if($isBaseText) { // The base is Text. In this case for http://purl.org/dc/terms/mofified, // the sound takes over. So we switch baseRes with srcRes in the arguments + //print_r($targetArray); + //print_r($srcRes->get("")); $this->mergeProperties([], ["http://purl.org/dc/terms/mofified"], $targetArray, $srcRes, $baseRes); + // created must be handled separately + $srcCreated = $srcRes->get(""); + $baseCreated = $baseRes->get(""); + + if(is_null($srcCreated) && !is_null($baseCreated)) { + // There is no created in sound. Remove created info from targetArray + unset($targetArray['http://purl.org/dc/terms/created']); + } elseif (!is_null($srcCreated) && !is_null($baseCreated)) { + // Force Sound value into target array + $targetArray['http://purl.org/dc/terms/created'] = [ + $srcCreated->toRdfPhp() + ]; + } } } diff -r bd2701bd8142 -r 4ab820b387da server/src/app/Libraries/Mergers/CocoonTextRdfMerger.php --- a/server/src/app/Libraries/Mergers/CocoonTextRdfMerger.php Wed Feb 08 16:38:09 2017 +0100 +++ b/server/src/app/Libraries/Mergers/CocoonTextRdfMerger.php Thu Feb 09 15:05:36 2017 +0100 @@ -105,5 +105,28 @@ "http://purl.org/dc/terms/modified", ], $targetArray, $baseRes, $srcRes); + // Must handle created + $isBaseSound = false; + foreach ($baseRes->all("dc11:type","resource") as $resType) { + $type = $resType->getUri(); + if($type === 'http://purl.org/dc/dcmitype/Sound') { + $isBaseSound = true; + break; + } + } + if($isBaseSound) { + // The base is Sound. In this case for http://purl.org/dc/terms/created, + // the sound takes over. + // The case to ensure is when there is no created info in the sound. We must make sure it stays that way + $srcCreated = $srcRes->get(""); + $baseCreated = $baseRes->get(""); + + if(!is_null($srcCreated) && is_null($baseCreated)) { + // There is no created in sound. Remove created info from targetArray + unset($targetArray['http://purl.org/dc/terms/created']); + } + } + + } } diff -r bd2701bd8142 -r 4ab820b387da server/src/tests/Libraries/Mappers/CocoonTextRdfMapperTest.php --- a/server/src/tests/Libraries/Mappers/CocoonTextRdfMapperTest.php Wed Feb 08 16:38:09 2017 +0100 +++ b/server/src/tests/Libraries/Mappers/CocoonTextRdfMapperTest.php Thu Feb 09 15:05:36 2017 +0100 @@ -287,5 +287,32 @@ } } + /** + * Test date info to providedCHO is not mapped + * + * @return void + */ + public function testProvidedCHODateNotMapped() { + + $properties = [ + 'http://purl.org/dc/terms/available', + 'http://purl.org/dc/terms/created', + 'http://purl.org/dc/terms/issued', + 'http://purl.org/dc/terms/modified', + ]; + + $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); + + foreach ($properties as $prop) { + $outputValuesStr = []; + $this->assertEmpty($providedCHO->all($this->resGraphes['BASE']->resource($prop)), "Date info $prop must be empty"); + } + + } + } diff -r bd2701bd8142 -r 4ab820b387da server/src/tests/Libraries/Mergers/CocoonSoundRdfMergerTest.php --- a/server/src/tests/Libraries/Mergers/CocoonSoundRdfMergerTest.php Wed Feb 08 16:38:09 2017 +0100 +++ b/server/src/tests/Libraries/Mergers/CocoonSoundRdfMergerTest.php Thu Feb 09 15:05:36 2017 +0100 @@ -319,11 +319,11 @@ } } - /** - * Test one to one mapping spatial info - * - * @return void - */ + /** + * Test one to one mapping spatial info + * + * @return void + */ public function testProvidedCHOSpatialMore() { $merger = new CocoonSoundRdfMerger(); diff -r bd2701bd8142 -r 4ab820b387da server/src/tests/Libraries/Mergers/CocoonTextRdfMergerTest.php --- a/server/src/tests/Libraries/Mergers/CocoonTextRdfMergerTest.php Wed Feb 08 16:38:09 2017 +0100 +++ b/server/src/tests/Libraries/Mergers/CocoonTextRdfMergerTest.php Thu Feb 09 15:05:36 2017 +0100 @@ -14,249 +14,14 @@ class CocoonTextRdfMergerTest extends TestCase { - const TEST_INPUT_DOCS = [ - 'SOUND' => << . - @prefix edm: . - @prefix dc11: . - @prefix olac: . - @prefix dc: . - @prefix geo: . - @prefix xsd: . - @prefix skos: . - @prefix owl: . - - - a ore:Aggregation ; - edm:aggregatedCHO ; - edm:provider "Corpus de la Parole"@fr ; - edm:dataProvider "Laboratoire de langues et civilisations à tradition orale" ; - edm:isShownAt ; - edm:isShownBy ; - edm:rights ; - edm:hasView , . - - - a edm:ProvidedCHO ; - dc:identifier "crdo-UVE_MOCIKA_SOUND" ; - dc11:description "Voilà pourquoi le bernard-l'hermite, aujourd'hui, se cache dans les coquilles vides qu'il trouve, alors que le crabe de cocotier n'a pas honte de se promener tout nu."@fr ; - dc11:language ; - dc11:publisher "Laboratoire de langues et civilisations à tradition orale" ; - dc11:rights "Copyright (c) Moyse-Faurie, Claire" ; - dc11:type , "primary_text"^^olac:linguistic-type, "narrative"^^olac:discourse-type, ; - dc:license ; - dc11:subject , , ; - dc11:title "The two hermit crabs and the coconut crab"@en ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" ; - dc:extent "PT2M35S" ; - edm:isGatheredInto , ; - olac:depositor ; - dc11:contributor , "Idakote, Félicien" ; - olac:researcher ; - olac:speaker "Idakote, Félicien" ; - dc:available "2010-10-23"^^dc:W3CDTF ; - dc:created "1997-08-29"^^dc:W3CDTF ; - dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; - dc:modified "2012-03-25"^^dc:W3CDTF ; - dc:spatial [ - a edm:Place ; - geo:lat "-20.46667"^^xsd:float ; - geo:long "166.65"^^xsd:float ; - skos:note "NC"^^dc:ISO3166, "New Caledonia, Ohnyat (Ouvéa)" ; - owl:sameAs - ] . - - - a edm:WebResource ; - dc:extent "PT2M35S" ; - dc11:format "audio/x-wav"^^dc:IMT ; - dc:created "1997-08-29"^^dc:W3CDTF ; - dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; - dc:license ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . - - - - a edm:WebResource ; - dc:extent "PT2M35S" ; - dc11:format "audio/x-wav"^^dc:IMT ; - edm:isDerivativeOf ; - dc:created "1997-08-29"^^dc:W3CDTF ; - dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; - dc:license ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . - - - - a edm:WebResource ; - dc:extent "PT2M35S" ; - dc11:format "audio/mpeg"^^dc:IMT ; - edm:isDerivativeOf ; - dc:created "1997-08-29"^^dc:W3CDTF ; - dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; - dc:license ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . - -EOT - , - 'SOUND_NO_MOD' => << . - @prefix edm: . - @prefix dc11: . - @prefix olac: . - @prefix dc: . - @prefix geo: . - @prefix xsd: . - @prefix skos: . - @prefix owl: . - - - a ore:Aggregation ; - edm:aggregatedCHO ; - edm:provider "Corpus de la Parole"@fr ; - edm:dataProvider "Laboratoire de langues et civilisations à tradition orale" ; - edm:isShownAt ; - edm:isShownBy ; - edm:rights ; - edm:hasView , . - - - a edm:ProvidedCHO ; - dc:identifier "crdo-UVE_MOCIKA_SOUND" ; - dc11:description "Voilà pourquoi le bernard-l'hermite, aujourd'hui, se cache dans les coquilles vides qu'il trouve, alors que le crabe de cocotier n'a pas honte de se promener tout nu."@fr ; - dc11:language ; - dc11:publisher "Laboratoire de langues et civilisations à tradition orale" ; - dc11:rights "Copyright (c) Moyse-Faurie, Claire" ; - dc11:type , "primary_text"^^olac:linguistic-type, "narrative"^^olac:discourse-type, ; - dc:license ; - dc11:subject , , ; - dc11:title "The two hermit crabs and the coconut crab"@en ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" ; - dc:extent "PT2M35S" ; - edm:isGatheredInto , ; - olac:depositor ; - dc11:contributor , "Idakote, Félicien" ; - olac:researcher ; - olac:speaker "Idakote, Félicien" ; - dc:available "2010-10-23"^^dc:W3CDTF ; - dc:created "1997-08-29"^^dc:W3CDTF ; - dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; - dc:spatial [ - a edm:Place ; - geo:lat "-20.46667"^^xsd:float ; - geo:long "166.65"^^xsd:float ; - skos:note "NC"^^dc:ISO3166, "New Caledonia, Ohnyat (Ouvéa)" ; - owl:sameAs - ] . - - - a edm:WebResource ; - dc:extent "PT2M35S" ; - dc11:format "audio/x-wav"^^dc:IMT ; - dc:created "1997-08-29"^^dc:W3CDTF ; - dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; - dc:license ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . - - - - a edm:WebResource ; - dc:extent "PT2M35S" ; - dc11:format "audio/x-wav"^^dc:IMT ; - edm:isDerivativeOf ; - dc:created "1997-08-29"^^dc:W3CDTF ; - dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; - dc:license ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . - - - - a edm:WebResource ; - dc:extent "PT2M35S" ; - dc11:format "audio/mpeg"^^dc:IMT ; - edm:isDerivativeOf ; - dc:created "1997-08-29"^^dc:W3CDTF ; - dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; - dc:license ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . - -EOT - , - 'TEXT' => << . - @prefix edm: . - @prefix dc11: . - @prefix olac: . - @prefix dc: . - @prefix skos: . - - - a ore:Aggregation ; - edm:aggregatedCHO ; - edm:provider "Corpus de la Parole"@fr ; - edm:dataProvider ; - edm:isShownAt ; - edm:isShownBy ; - edm:rights ; - edm:hasView , . - - - a edm:ProvidedCHO ; - dc:identifier "crdo-UVE_MOCIKA_SOUND" ; - dc11:description "Voilà pourquoi le bernard-l'hermite, aujourd'hui, se cache dans les coquilles vides qu'il trouve, alors que le crabe de cocotier n'a pas honte de se promener tout nu."@fr ; - dc11:language ; - dc11:publisher ; - dc11:rights "Copyright (c) Moyse-Faurie, Claire" ; - dc11:type "primary_text"^^olac:linguistic-type, , "narrative"^^olac:discourse-type ; - dc:license ; - dc11:subject ; - dc11:title "The two hermit crabs and the coconut crab"@en ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" ; - edm:isGatheredInto , ; - dc:alternative "Les deux bernard-l'hermite et le crabe de cocotier"@fr ; - olac:depositor ; - dc11:contributor , "Moyse-Faurie, Claire", "Idakote, Félicien" ; - olac:researcher "Moyse-Faurie, Claire" ; - olac:speaker "Idakote, Félicien" ; - dc:available "2011-02-05"^^dc:W3CDTF ; - dc:issued "2011-02-05T23:22:23+01:00"^^dc:W3CDTF ; - dc:modified "2002-02-20"^^dc:W3CDTF ; - dc:spatial [ - a edm:Place ; - skos:note "NC"^^dc:ISO3166, "New Caledonia, Ohnyat (Ouvéa)" - ] . - - - a edm:WebResource ; - dc11:format "application/xml"^^dc:IMT ; - dc:issued "2011-02-05T23:22:23+01:00"^^dc:W3CDTF ; - dc:license ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . - - - - a edm:WebResource ; - dc11:format "application/xhtml+xml"^^dc:IMT ; - dc:issued "2011-02-05T23:22:23+01:00"^^dc:W3CDTF ; - dc:license ; - dc:accessRights "Freely available for non-commercial use" ; - dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . - -EOT + 'SOUND' => __DIR__.'/files/CocoonTextRdfMergerTest/sound.ttl', + 'SOUND_NO_MOD' => __DIR__.'/files/CocoonTextRdfMergerTest/sound_no_mod.ttl', + 'SOUND_NO_CREATED' => __DIR__.'/files/CocoonTextRdfMergerTest/sound_no_created.ttl', + 'TEXT' => __DIR__.'/files/CocoonTextRdfMergerTest/text.ttl', + 'TEXT_CREATED' => __DIR__.'/files/CocoonTextRdfMergerTest/text_created.ttl' ]; - private $inputGraphes = []; private $resGraph = []; @@ -268,7 +33,7 @@ parent::setUp(); foreach(CocoonTextRdfMergerTest::TEST_INPUT_DOCS as $key => $inputDoc) { - $this->inputGraphes[$key] = new Graph("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND", $inputDoc); + $this->inputGraphes[$key] = new Graph("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND", file_get_contents($inputDoc)); } $merger = new CocoonTextRdfMerger(); @@ -279,6 +44,25 @@ $this->resGraph['SOUND_NO_MOD_TEXT'] = $merger->mergeGraph($this->inputGraphes['SOUND_NO_MOD'], $this->inputGraphes['TEXT']); $merger = new CocoonSoundRdfMerger(); $this->resGraph['TEXT_SOUND_NO_MOD'] = $merger->mergeGraph($this->inputGraphes['TEXT'], $this->inputGraphes['SOUND_NO_MOD']); + + $merger = new CocoonSoundRdfMerger(); + $this->resGraph['CREATED_TEXT_NO_CREATED_SOUND_NO_CREATED'] = $merger->mergeGraph($this->inputGraphes['TEXT'], $this->inputGraphes['SOUND_NO_CREATED']); + $merger = new CocoonSoundRdfMerger(); + $this->resGraph['CREATED_TEXT_SOUND_NO_CREATED'] = $merger->mergeGraph($this->inputGraphes['TEXT_CREATED'], $this->inputGraphes['SOUND_NO_CREATED']); + $merger = new CocoonSoundRdfMerger(); + $this->resGraph['CREATED_TEXT_NO_CREATED_SOUND'] = $merger->mergeGraph($this->inputGraphes['TEXT'], $this->inputGraphes['SOUND']); + $merger = new CocoonSoundRdfMerger(); + $this->resGraph['CREATED_TEXT_SOUND'] = $merger->mergeGraph($this->inputGraphes['TEXT_CREATED'], $this->inputGraphes['SOUND']); + + $merger = new CocoonTextRdfMerger(); + $this->resGraph['CREATED_SOUND_NO_CREATED_TEXT_NO_CREATED'] = $merger->mergeGraph($this->inputGraphes['SOUND_NO_CREATED'], $this->inputGraphes['TEXT']); + $merger = new CocoonTextRdfMerger(); + $this->resGraph['CREATED_SOUND_TEXT_NO_CREATED'] = $merger->mergeGraph($this->inputGraphes['SOUND'], $this->inputGraphes['TEXT']); + $merger = new CocoonTextRdfMerger(); + $this->resGraph['CREATED_SOUND_NO_CREATED_TEXT'] = $merger->mergeGraph($this->inputGraphes['SOUND_NO_CREATED'], $this->inputGraphes['TEXT_CREATED']); + $merger = new CocoonTextRdfMerger(); + $this->resGraph['CREATED_SOUND_TEXT'] = $merger->mergeGraph($this->inputGraphes['SOUND'], $this->inputGraphes['TEXT_CREATED']); + } public function tearDown() { @@ -448,5 +232,187 @@ } + /** + * Test merge created merge TEXT with no created into SOUND with no created + * Should have no values + * @return void + */ + public function testCreatedSoundNocreatedTextNoCreated() { + + $resGraph = $this->resGraph["CREATED_SOUND_NO_CREATED_TEXT_NO_CREATED"]; + + $providedCHO = $resGraph->get('edm:ProvidedCHO', '^rdf:type'); + $this->assertNotNull($providedCHO); + + $outputValuesStr = []; + foreach($providedCHO->all($resGraph->resource("http://purl.org/dc/terms/created")) as $outputValue) { + array_push($outputValuesStr, strval($outputValue)); + } + $this->assertEmpty($outputValuesStr, "we must found no values to test http://purl.org/dc/terms/created"); + } + + /** + * Test merge created merge TEXT with created into SOUND with no created + * Should have no values + * @return void + */ + public function testCreatedSoundNoCreatedTextCreated() { + + $resGraph = $this->resGraph["CREATED_SOUND_NO_CREATED_TEXT"]; + + $providedCHO = $resGraph->get('edm:ProvidedCHO', '^rdf:type'); + $this->assertNotNull($providedCHO); + + $outputValuesStr = []; + foreach($providedCHO->all($resGraph->resource("http://purl.org/dc/terms/created")) as $outputValue) { + array_push($outputValuesStr, strval($outputValue)); + } + $this->assertEmpty($outputValuesStr, "we must found no values to test http://purl.org/dc/terms/created"); + + } + + /** + * Test merge created + * Merge TEXT with no created into SOUND with created + * Should have no values + * @return void + */ + public function testCreatedSoundCreatedTextNoCreated() { + + $resGraph = $this->resGraph["CREATED_SOUND_TEXT_NO_CREATED"]; + + $providedCHO = $resGraph->get('edm:ProvidedCHO', '^rdf:type'); + $baseNode = $this->inputGraphes['SOUND']->get('edm:ProvidedCHO', '^rdf:type'); + $this->assertNotNull($providedCHO); + $this->assertNotNull($baseNode); + + $outputValuesStr = []; + foreach($providedCHO->all($resGraph->resource("http://purl.org/dc/terms/created")) as $outputValue) { + array_push($outputValuesStr, strval($outputValue)); + } + $this->assertNotEmpty($outputValuesStr, "we must foundvalues to test http://purl.org/dc/terms/created"); + $this->assertCount(1, $outputValuesStr, "We should have one value"); + $baseCreated = $baseNode->get(""); + $this->assertEquals($outputValuesStr[0], strval($baseCreated), "We must same value than in sound"); + + } + + /** + * Test merge created + * Merge TEXT with created into SOUND with created + * Should have no values + * @return void + */ + public function testCreatedSoundCreatedTextCreated() { + + $resGraph = $this->resGraph["CREATED_SOUND_TEXT"]; + + $providedCHO = $resGraph->get('edm:ProvidedCHO', '^rdf:type'); + $baseNode = $this->inputGraphes['SOUND']->get('edm:ProvidedCHO', '^rdf:type'); + $this->assertNotNull($providedCHO); + $this->assertNotNull($baseNode); + + $outputValuesStr = []; + foreach($providedCHO->all($resGraph->resource("http://purl.org/dc/terms/created")) as $outputValue) { + array_push($outputValuesStr, strval($outputValue)); + } + $this->assertNotEmpty($outputValuesStr, "we must found values to test http://purl.org/dc/terms/created"); + $this->assertCount(1, $outputValuesStr, "We should have one value"); + $baseCreated = $providedCHO->get(""); + $this->assertEquals($outputValuesStr[0], strval($baseCreated), "We must same value than in sound"); + + } + + + /** + * Test merge created merge SOUND with no created into TEXT with no created + * Should have no values + * @return void + */ + public function testCreatedTextNocreatedSoundNoCreated() { + + $resGraph = $this->resGraph["CREATED_TEXT_NO_CREATED_SOUND_NO_CREATED"]; + + $providedCHO = $resGraph->get('edm:ProvidedCHO', '^rdf:type'); + $this->assertNotNull($providedCHO); + + $outputValuesStr = []; + foreach($providedCHO->all($resGraph->resource("http://purl.org/dc/terms/created")) as $outputValue) { + array_push($outputValuesStr, strval($outputValue)); + } + $this->assertEmpty($outputValuesStr, "we must found no values to test http://purl.org/dc/terms/created"); + } + + /** + * Test merge created merge SOUND with created into TEXT with no created + * Should have one value from sound + * @return void + */ + public function testCreatedTextNoCreatedSoundCreated() { + + $resGraph = $this->resGraph["CREATED_TEXT_NO_CREATED_SOUND"]; + + $providedCHO = $resGraph->get('edm:ProvidedCHO', '^rdf:type'); + $soundNode = $this->inputGraphes['SOUND']->get('edm:ProvidedCHO', '^rdf:type'); + $this->assertNotNull($providedCHO); + $this->assertNotNull($soundNode); + + $outputValuesStr = []; + foreach($providedCHO->all($resGraph->resource("http://purl.org/dc/terms/created")) as $outputValue) { + array_push($outputValuesStr, strval($outputValue)); + } + $this->assertNotEmpty($outputValuesStr, "we must foundvalues to test http://purl.org/dc/terms/created"); + $this->assertCount(1, $outputValuesStr, "We should have one value"); + $soundCreated = $soundNode->get(""); + $this->assertEquals($outputValuesStr[0], strval($soundCreated), "We must same value than in sound"); + + } + + /** + * Test merge created + * Merge SOUND with no created into TEXT with created + * Should have no values + * @return void + */ + public function testCreatedTextCreatedSoundNoCreated() { + + $resGraph = $this->resGraph["CREATED_TEXT_SOUND_NO_CREATED"]; + + $providedCHO = $resGraph->get('edm:ProvidedCHO', '^rdf:type'); + $this->assertNotNull($providedCHO); + + $outputValuesStr = []; + foreach($providedCHO->all($resGraph->resource("http://purl.org/dc/terms/created")) as $outputValue) { + array_push($outputValuesStr, strval($outputValue)); + } + $this->assertEmpty($outputValuesStr, "we must found no values to test http://purl.org/dc/terms/created"); + + } + + /** + * Test merge created + * Merge SOUND with created into TEXT with created + * Should have one value + * @return void + */ + public function testCreatedTextCreatedSoundCreated() { + + $resGraph = $this->resGraph["CREATED_TEXT_SOUND"]; + + $providedCHO = $resGraph->get('edm:ProvidedCHO', '^rdf:type'); + $soundNode = $this->inputGraphes['SOUND']->get('edm:ProvidedCHO', '^rdf:type'); + $this->assertNotNull($providedCHO); + $this->assertNotNull($soundNode); + + $outputValuesStr = []; + foreach($providedCHO->all($resGraph->resource("http://purl.org/dc/terms/created")) as $outputValue) { + array_push($outputValuesStr, strval($outputValue)); + } + $this->assertNotEmpty($outputValuesStr, "we must found values to test http://purl.org/dc/terms/created"); + $this->assertCount(1, $outputValuesStr, "We should have one value"); + $soundCreated = $soundNode->get(""); + $this->assertEquals($outputValuesStr[0], strval($soundCreated), "We must same value than in sound"); + + } } diff -r bd2701bd8142 -r 4ab820b387da server/src/tests/Libraries/Mergers/files/CocoonTextRdfMergerTest/sound.ttl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/tests/Libraries/Mergers/files/CocoonTextRdfMergerTest/sound.ttl Thu Feb 09 15:05:36 2017 +0100 @@ -0,0 +1,84 @@ +@prefix ore: . +@prefix edm: . +@prefix dc11: . +@prefix olac: . +@prefix dc: . +@prefix geo: . +@prefix xsd: . +@prefix skos: . +@prefix owl: . + + + a ore:Aggregation ; + edm:aggregatedCHO ; + edm:provider "Corpus de la Parole"@fr ; + edm:dataProvider "Laboratoire de langues et civilisations à tradition orale" ; + edm:isShownAt ; + edm:isShownBy ; + edm:rights ; + edm:hasView , . + + + a edm:ProvidedCHO ; + dc:identifier "crdo-UVE_MOCIKA_SOUND" ; + dc11:description "Voilà pourquoi le bernard-l'hermite, aujourd'hui, se cache dans les coquilles vides qu'il trouve, alors que le crabe de cocotier n'a pas honte de se promener tout nu."@fr ; + dc11:language ; + dc11:publisher "Laboratoire de langues et civilisations à tradition orale" ; + dc11:rights "Copyright (c) Moyse-Faurie, Claire" ; + dc11:type , "primary_text"^^olac:linguistic-type, "narrative"^^olac:discourse-type, ; + dc:license ; + dc11:subject , , ; + dc11:title "The two hermit crabs and the coconut crab"@en ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" ; + dc:extent "PT2M35S" ; + edm:isGatheredInto , ; + olac:depositor ; + dc11:contributor , "Idakote, Félicien" ; + olac:researcher ; + olac:speaker "Idakote, Félicien" ; + dc:available "2010-10-23"^^dc:W3CDTF ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:modified "2012-03-25"^^dc:W3CDTF ; + dc:spatial [ + a edm:Place ; + geo:lat "-20.46667"^^xsd:float ; + geo:long "166.65"^^xsd:float ; + skos:note "NC"^^dc:ISO3166, "New Caledonia, Ohnyat (Ouvéa)" ; + owl:sameAs + ] . + + + a edm:WebResource ; + dc:extent "PT2M35S" ; + dc11:format "audio/x-wav"^^dc:IMT ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . + + + + a edm:WebResource ; + dc:extent "PT2M35S" ; + dc11:format "audio/x-wav"^^dc:IMT ; + edm:isDerivativeOf ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . + + + + a edm:WebResource ; + dc:extent "PT2M35S" ; + dc11:format "audio/mpeg"^^dc:IMT ; + edm:isDerivativeOf ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . diff -r bd2701bd8142 -r 4ab820b387da server/src/tests/Libraries/Mergers/files/CocoonTextRdfMergerTest/sound_no_created.ttl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/tests/Libraries/Mergers/files/CocoonTextRdfMergerTest/sound_no_created.ttl Thu Feb 09 15:05:36 2017 +0100 @@ -0,0 +1,83 @@ +@prefix ore: . +@prefix edm: . +@prefix dc11: . +@prefix olac: . +@prefix dc: . +@prefix geo: . +@prefix xsd: . +@prefix skos: . +@prefix owl: . + + + a ore:Aggregation ; + edm:aggregatedCHO ; + edm:provider "Corpus de la Parole"@fr ; + edm:dataProvider "Laboratoire de langues et civilisations à tradition orale" ; + edm:isShownAt ; + edm:isShownBy ; + edm:rights ; + edm:hasView , . + + + a edm:ProvidedCHO ; + dc:identifier "crdo-UVE_MOCIKA_SOUND" ; + dc11:description "Voilà pourquoi le bernard-l'hermite, aujourd'hui, se cache dans les coquilles vides qu'il trouve, alors que le crabe de cocotier n'a pas honte de se promener tout nu."@fr ; + dc11:language ; + dc11:publisher "Laboratoire de langues et civilisations à tradition orale" ; + dc11:rights "Copyright (c) Moyse-Faurie, Claire" ; + dc11:type , "primary_text"^^olac:linguistic-type, "narrative"^^olac:discourse-type, ; + dc:license ; + dc11:subject , , ; + dc11:title "The two hermit crabs and the coconut crab"@en ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" ; + dc:extent "PT2M35S" ; + edm:isGatheredInto , ; + olac:depositor ; + dc11:contributor , "Idakote, Félicien" ; + olac:researcher ; + olac:speaker "Idakote, Félicien" ; + dc:available "2010-10-23"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:modified "2012-03-25"^^dc:W3CDTF ; + dc:spatial [ + a edm:Place ; + geo:lat "-20.46667"^^xsd:float ; + geo:long "166.65"^^xsd:float ; + skos:note "NC"^^dc:ISO3166, "New Caledonia, Ohnyat (Ouvéa)" ; + owl:sameAs + ] . + + + a edm:WebResource ; + dc:extent "PT2M35S" ; + dc11:format "audio/x-wav"^^dc:IMT ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . + + + + a edm:WebResource ; + dc:extent "PT2M35S" ; + dc11:format "audio/x-wav"^^dc:IMT ; + edm:isDerivativeOf ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . + + + + a edm:WebResource ; + dc:extent "PT2M35S" ; + dc11:format "audio/mpeg"^^dc:IMT ; + edm:isDerivativeOf ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . diff -r bd2701bd8142 -r 4ab820b387da server/src/tests/Libraries/Mergers/files/CocoonTextRdfMergerTest/sound_no_mod.ttl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/tests/Libraries/Mergers/files/CocoonTextRdfMergerTest/sound_no_mod.ttl Thu Feb 09 15:05:36 2017 +0100 @@ -0,0 +1,83 @@ +@prefix ore: . +@prefix edm: . +@prefix dc11: . +@prefix olac: . +@prefix dc: . +@prefix geo: . +@prefix xsd: . +@prefix skos: . +@prefix owl: . + + + a ore:Aggregation ; + edm:aggregatedCHO ; + edm:provider "Corpus de la Parole"@fr ; + edm:dataProvider "Laboratoire de langues et civilisations à tradition orale" ; + edm:isShownAt ; + edm:isShownBy ; + edm:rights ; + edm:hasView , . + + + a edm:ProvidedCHO ; + dc:identifier "crdo-UVE_MOCIKA_SOUND" ; + dc11:description "Voilà pourquoi le bernard-l'hermite, aujourd'hui, se cache dans les coquilles vides qu'il trouve, alors que le crabe de cocotier n'a pas honte de se promener tout nu."@fr ; + dc11:language ; + dc11:publisher "Laboratoire de langues et civilisations à tradition orale" ; + dc11:rights "Copyright (c) Moyse-Faurie, Claire" ; + dc11:type , "primary_text"^^olac:linguistic-type, "narrative"^^olac:discourse-type, ; + dc:license ; + dc11:subject , , ; + dc11:title "The two hermit crabs and the coconut crab"@en ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" ; + dc:extent "PT2M35S" ; + edm:isGatheredInto , ; + olac:depositor ; + dc11:contributor , "Idakote, Félicien" ; + olac:researcher ; + olac:speaker "Idakote, Félicien" ; + dc:available "2010-10-23"^^dc:W3CDTF ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:spatial [ + a edm:Place ; + geo:lat "-20.46667"^^xsd:float ; + geo:long "166.65"^^xsd:float ; + skos:note "NC"^^dc:ISO3166, "New Caledonia, Ohnyat (Ouvéa)" ; + owl:sameAs + ] . + + + a edm:WebResource ; + dc:extent "PT2M35S" ; + dc11:format "audio/x-wav"^^dc:IMT ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . + + + + a edm:WebResource ; + dc:extent "PT2M35S" ; + dc11:format "audio/x-wav"^^dc:IMT ; + edm:isDerivativeOf ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . + + + + a edm:WebResource ; + dc:extent "PT2M35S" ; + dc11:format "audio/mpeg"^^dc:IMT ; + edm:isDerivativeOf ; + dc:created "1997-08-29"^^dc:W3CDTF ; + dc:issued "2010-10-23T00:08:27+02:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . diff -r bd2701bd8142 -r 4ab820b387da server/src/tests/Libraries/Mergers/files/CocoonTextRdfMergerTest/text.ttl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/tests/Libraries/Mergers/files/CocoonTextRdfMergerTest/text.ttl Thu Feb 09 15:05:36 2017 +0100 @@ -0,0 +1,60 @@ +@prefix ore: . +@prefix edm: . +@prefix dc11: . +@prefix olac: . +@prefix dc: . +@prefix skos: . + + + a ore:Aggregation ; + edm:aggregatedCHO ; + edm:provider "Corpus de la Parole"@fr ; + edm:dataProvider ; + edm:isShownAt ; + edm:isShownBy ; + edm:rights ; + edm:hasView , . + + + a edm:ProvidedCHO ; + dc:identifier "crdo-UVE_MOCIKA_SOUND" ; + dc11:description "Voilà pourquoi le bernard-l'hermite, aujourd'hui, se cache dans les coquilles vides qu'il trouve, alors que le crabe de cocotier n'a pas honte de se promener tout nu."@fr ; + dc11:language ; + dc11:publisher ; + dc11:rights "Copyright (c) Moyse-Faurie, Claire" ; + dc11:type "primary_text"^^olac:linguistic-type, , "narrative"^^olac:discourse-type ; + dc:license ; + dc11:subject ; + dc11:title "The two hermit crabs and the coconut crab"@en ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" ; + edm:isGatheredInto , ; + dc:alternative "Les deux bernard-l'hermite et le crabe de cocotier"@fr ; + olac:depositor ; + dc11:contributor , "Moyse-Faurie, Claire", "Idakote, Félicien" ; + olac:researcher "Moyse-Faurie, Claire" ; + olac:speaker "Idakote, Félicien" ; + dc:available "2011-02-05"^^dc:W3CDTF ; + dc:issued "2011-02-05T23:22:23+01:00"^^dc:W3CDTF ; + dc:modified "2002-02-20"^^dc:W3CDTF ; + dc:spatial [ + a edm:Place ; + skos:note "NC"^^dc:ISO3166, "New Caledonia, Ohnyat (Ouvéa)" + ] . + + + a edm:WebResource ; + dc11:format "application/xml"^^dc:IMT ; + dc:issued "2011-02-05T23:22:23+01:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . + + + + a edm:WebResource ; + dc11:format "application/xhtml+xml"^^dc:IMT ; + dc:issued "2011-02-05T23:22:23+01:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . diff -r bd2701bd8142 -r 4ab820b387da server/src/tests/Libraries/Mergers/files/CocoonTextRdfMergerTest/text_created.ttl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/tests/Libraries/Mergers/files/CocoonTextRdfMergerTest/text_created.ttl Thu Feb 09 15:05:36 2017 +0100 @@ -0,0 +1,61 @@ +@prefix ore: . +@prefix edm: . +@prefix dc11: . +@prefix olac: . +@prefix dc: . +@prefix skos: . + + + a ore:Aggregation ; + edm:aggregatedCHO ; + edm:provider "Corpus de la Parole"@fr ; + edm:dataProvider ; + edm:isShownAt ; + edm:isShownBy ; + edm:rights ; + edm:hasView , . + + + a edm:ProvidedCHO ; + dc:identifier "crdo-UVE_MOCIKA_SOUND" ; + dc11:description "Voilà pourquoi le bernard-l'hermite, aujourd'hui, se cache dans les coquilles vides qu'il trouve, alors que le crabe de cocotier n'a pas honte de se promener tout nu."@fr ; + dc11:language ; + dc11:publisher ; + dc11:rights "Copyright (c) Moyse-Faurie, Claire" ; + dc11:type "primary_text"^^olac:linguistic-type, , "narrative"^^olac:discourse-type ; + dc:license ; + dc11:subject ; + dc11:title "The two hermit crabs and the coconut crab"@en ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" ; + edm:isGatheredInto , ; + dc:alternative "Les deux bernard-l'hermite et le crabe de cocotier"@fr ; + olac:depositor ; + dc11:contributor , "Moyse-Faurie, Claire", "Idakote, Félicien" ; + olac:researcher "Moyse-Faurie, Claire" ; + olac:speaker "Idakote, Félicien" ; + dc:available "2011-02-05"^^dc:W3CDTF ; + dc:created "2017-01-01"^^dc:W3CDTF ; + dc:issued "2011-02-05T23:22:23+01:00"^^dc:W3CDTF ; + dc:modified "2002-02-20"^^dc:W3CDTF ; + dc:spatial [ + a edm:Place ; + skos:note "NC"^^dc:ISO3166, "New Caledonia, Ohnyat (Ouvéa)" + ] . + + + a edm:WebResource ; + dc11:format "application/xml"^^dc:IMT ; + dc:issued "2011-02-05T23:22:23+01:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" . + + + + a edm:WebResource ; + dc11:format "application/xhtml+xml"^^dc:IMT ; + dc:issued "2011-02-05T23:22:23+01:00"^^dc:W3CDTF ; + dc:license ; + dc:accessRights "Freely available for non-commercial use" ; + dc11:rights "Copyright (c) 2012 Université d'Orléans/LLL" .