17 @prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . |
17 @prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . |
18 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
18 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
19 @prefix skos: <http://www.w3.org/2004/02/skos/core#> . |
19 @prefix skos: <http://www.w3.org/2004/02/skos/core#> . |
20 @prefix owl: <http://www.w3.org/2002/07/owl#> . |
20 @prefix owl: <http://www.w3.org/2002/07/owl#> . |
21 |
21 |
22 <###h#ttp://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND> |
22 <http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND> |
23 a ore:Aggregation ; |
23 a ore:Aggregation ; |
24 edm:aggregatedCHO <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND> ; |
24 edm:aggregatedCHO <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND> ; |
25 edm:provider "Corpus de la Parole"@fr ; |
25 edm:provider "Corpus de la Parole"@fr ; |
26 edm:dataProvider <http://viaf.org/viaf/142432638> ; |
26 edm:dataProvider <http://viaf.org/viaf/142432638> ; |
27 edm:isShownAt <http://cocoon.huma-num.fr/exist/crdo/meta/crdo-CFPP2000_35_SOUND> ; |
27 edm:isShownAt <http://cocoon.huma-num.fr/exist/crdo/meta/crdo-CFPP2000_35_SOUND> ; |
97 |
97 |
98 |
98 |
99 public function setUp() { |
99 public function setUp() { |
100 |
100 |
101 parent::setup(); |
101 parent::setup(); |
102 $this->graph = new EasyRdf\Graph("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", DocumentTest::TEST_DOC); |
102 $this->graph = new EasyRdf\Graph("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", DocumentTest::TEST_DOC); |
103 |
103 |
104 } |
104 } |
105 |
105 |
106 public function testConstructor() { |
106 public function testConstructor() { |
107 $this->assertNotNull($this->graph, 'Graph shoud not be null'); |
107 $this->assertNotNull($this->graph, 'Graph shoud not be null'); |
108 |
108 |
109 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
109 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
110 |
110 |
111 $this->assertEquals('crdo-CFPP2000_35_SOUND',$doc->getId(),'Must have the correct id'); |
111 $this->assertEquals('crdo-CFPP2000_35_SOUND',$doc->getId(),'Must have the correct id'); |
112 } |
112 } |
113 |
113 |
114 public function testTitle() { |
114 public function testTitle() { |
115 $this->assertNotNull($this->graph, 'Graph shoud not be null'); |
115 $this->assertNotNull($this->graph, 'Graph shoud not be null'); |
116 |
116 |
117 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
117 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
118 |
118 |
119 $this->assertEquals("CFPP2000 [03-01] Ozgur_Kilic_H_32_alii_3e Entretien de Ozgur KILIÇ 2",$doc->getTitle(),'Must have correct title'); |
119 $this->assertEquals("CFPP2000 [03-01] Ozgur_Kilic_H_32_alii_3e Entretien de Ozgur KILIÇ 2",$doc->getTitle(),'Must have correct title'); |
120 $this->assertInstanceOf(EasyRdf\Literal::class, $doc->getTitle(), "Title must be a literal"); |
120 $this->assertInstanceOf(EasyRdf\Literal::class, $doc->getTitle(), "Title must be a literal"); |
121 $this->assertEquals('fr', $doc->getTitle()->getLang(), "Language title must be fr"); |
121 $this->assertEquals('fr', $doc->getTitle()->getLang(), "Language title must be fr"); |
122 } |
122 } |
123 |
123 |
124 public function testModified() { |
124 public function testModified() { |
125 $this->assertNotNull($this->graph, 'Graph shoud not be null'); |
125 $this->assertNotNull($this->graph, 'Graph shoud not be null'); |
126 |
126 |
127 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
127 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
128 $this->assertInstanceOf(EasyRdf\Literal::class, $doc->getModified(), "Modified must be a literal"); |
128 $this->assertInstanceOf(EasyRdf\Literal::class, $doc->getModified(), "Modified must be a literal"); |
129 $this->assertEquals("http://purl.org/dc/terms/W3CDTF", $doc->getModified()->getDatatypeURI(), "type must be http://purl.org/dc/terms/W3CDTF"); |
129 $this->assertEquals("http://purl.org/dc/terms/W3CDTF", $doc->getModified()->getDatatypeURI(), "type must be http://purl.org/dc/terms/W3CDTF"); |
130 $this->assertEquals("2013-10-12T14:35:57+02:00", $doc->getModified(), "modified must be 2013-10-12T14:35:57+02:00"); |
130 $this->assertEquals("2013-10-12T14:35:57+02:00", $doc->getModified(), "modified must be 2013-10-12T14:35:57+02:00"); |
131 |
131 |
132 } |
132 } |
133 |
133 |
134 |
134 |
135 public function testPublisher() { |
135 public function testPublisher() { |
136 |
136 |
137 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
137 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
138 |
138 |
139 $this->assertCount(1, $doc->getPublishers(), 'Publisher is an array of size 1'); |
139 $this->assertCount(1, $doc->getPublishers(), 'Publisher is an array of size 1'); |
140 $this->assertInstanceOf('EasyRdf\Resource', $doc->getPublishers()[0], 'publisher is a resource'); |
140 $this->assertInstanceOf('EasyRdf\Resource', $doc->getPublishers()[0], 'publisher is a resource'); |
141 $this->assertEquals("http://viaf.org/viaf/142432638", $doc->getPublishers()[0]->getUri(),""); |
141 $this->assertEquals("http://viaf.org/viaf/142432638", $doc->getPublishers()[0]->getUri(),""); |
142 } |
142 } |
143 |
143 |
144 public function testMediaArray() { |
144 public function testMediaArray() { |
145 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
145 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
146 |
146 |
147 $this->assertCount(5, $doc->getMediaArray(), "Media array must be of size 5"); |
147 $this->assertCount(5, $doc->getMediaArray(), "Media array must be of size 5"); |
148 foreach($doc->getMediaArray() as $url => $media) { |
148 foreach($doc->getMediaArray() as $url => $media) { |
149 $this->assertCount(5, $media, "media is a 5 element array"); |
149 $this->assertCount(5, $media, "media is a 5 element array"); |
150 $this->assertArrayHasKey('format', $media, "media has 'format key'"); |
150 $this->assertArrayHasKey('format', $media, "media has 'format key'"); |
219 ); |
219 ); |
220 } |
220 } |
221 } |
221 } |
222 |
222 |
223 public function testGetDiscourseTypes() { |
223 public function testGetDiscourseTypes() { |
224 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
224 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
225 |
225 |
226 $this->assertCount(3, $doc->getDiscourseTypes(), "types array must be of size 3"); |
226 $this->assertCount(3, $doc->getDiscourseTypes(), "types array must be of size 3"); |
227 |
227 |
228 $this->assertContainsOnlyInstancesOf("EasyRdf\Literal", $doc->getDiscourseTypes(), "Result contains only literals"); |
228 $this->assertContainsOnlyInstancesOf("EasyRdf\Literal", $doc->getDiscourseTypes(), "Result contains only literals"); |
229 $type = $doc->getDiscourseTypes()[0]; |
229 $type = $doc->getDiscourseTypes()[0]; |
230 $this->assertEquals("narrative", $type->getValue(), "discourse type is narrative"); |
230 $this->assertEquals("narrative", $type->getValue(), "discourse type is narrative"); |
231 $this->assertEquals("http://www.language-archives.org/OLAC/1.1/discourse-type", $type->getDatatypeUri(), "discourse type url"); |
231 $this->assertEquals("http://www.language-archives.org/OLAC/1.1/discourse-type", $type->getDatatypeUri(), "discourse type url"); |
232 } |
232 } |
233 |
233 |
234 public function testCloneDocument() { |
234 public function testCloneDocument() { |
235 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
235 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
236 |
236 |
237 $doc2 = clone $doc; |
237 $doc2 = clone $doc; |
238 |
238 |
239 $this->assertNotSame($doc, $doc2, "documents must not be the same"); |
239 $this->assertNotSame($doc, $doc2, "documents must not be the same"); |
240 $this->assertNotSame($doc->getGraph(), $doc2->getGraph(), "documents must not be the same"); |
240 $this->assertNotSame($doc->getGraph(), $doc2->getGraph(), "documents must not be the same"); |
241 |
241 |
242 $this->assertTrue(EasyRdf\Isomorphic::isomorphic($doc->getGraph(), $doc2->getGraph()),"graph must be isomorphic"); |
242 $this->assertTrue(EasyRdf\Isomorphic::isomorphic($doc->getGraph(), $doc2->getGraph()),"graph must be isomorphic"); |
243 } |
243 } |
244 |
244 |
245 public function testIsIsomorphic() { |
245 public function testIsIsomorphic() { |
246 $doc1 = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
246 $doc1 = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
247 $doc2 = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", new EasyRdf\Graph("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", DocumentTest::TEST_DOC)); |
247 $doc2 = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", new EasyRdf\Graph("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", DocumentTest::TEST_DOC)); |
248 |
248 |
249 $this->assertTrue($doc1->isIsomorphic($doc2),"document must be isomorphic"); |
249 $this->assertTrue($doc1->isIsomorphic($doc2),"document must be isomorphic"); |
250 |
250 |
251 $doc2->addLiteral('dc11:type', new EasyRdf\Literal("oratory", null, Config::get('OLAC_DISCOURSE_TYPE')['uri'])); |
251 $doc2->addLiteral('dc11:type', new EasyRdf\Literal("oratory", null, Config::get('OLAC_DISCOURSE_TYPE')['uri'])); |
252 |
252 |
255 |
255 |
256 public function testUpdateDiscourseTypes() { |
256 public function testUpdateDiscourseTypes() { |
257 |
257 |
258 $newDiscourseTypes = ['oratory','dialogue','narrative', 'formulaic', 'ludic']; |
258 $newDiscourseTypes = ['oratory','dialogue','narrative', 'formulaic', 'ludic']; |
259 |
259 |
260 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
260 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
261 $this->assertCount(3, $doc->getDiscourseTypes(), "types array must be of size 3"); |
261 $this->assertCount(3, $doc->getDiscourseTypes(), "types array must be of size 3"); |
262 |
262 |
263 $doc->updateDiscourseTypes($newDiscourseTypes); |
263 $doc->updateDiscourseTypes($newDiscourseTypes); |
264 |
264 |
265 $this->assertCount(5, $doc->getDiscourseTypes(), "types array must be of size 5"); |
265 $this->assertCount(5, $doc->getDiscourseTypes(), "types array must be of size 5"); |
273 |
273 |
274 public function testUpdateDiscourseTypesDelta() { |
274 public function testUpdateDiscourseTypesDelta() { |
275 |
275 |
276 $newDiscourseTypes = ['oratory','dialogue','narrative', 'formulaic', 'ludic']; |
276 $newDiscourseTypes = ['oratory','dialogue','narrative', 'formulaic', 'ludic']; |
277 |
277 |
278 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
278 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
279 |
279 |
280 $doc->updateDiscourseTypes($newDiscourseTypes); |
280 $doc->updateDiscourseTypes($newDiscourseTypes); |
281 |
281 |
282 $this->assertTrue($doc->isDirty()); |
282 $this->assertTrue($doc->isDirty()); |
283 |
283 |
284 $this->assertEquals(1, $doc->deltaCount(), "There is one delta"); |
284 $this->assertEquals(1, $doc->deltaCount(), "There is one delta"); |
285 |
285 |
286 $delta = $doc->getDeltaList()[0]; |
286 $delta = $doc->getDeltaList()[0]; |
287 |
287 |
288 $this->assertEquals("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $delta->getDeletedGraph()->getUri(), "uri of deleted graph must be ok"); |
288 $this->assertEquals("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $delta->getDeletedGraph()->getUri(), "uri of deleted graph must be ok"); |
289 $this->assertEquals("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $delta->getAddedGraph()->getUri(), "uri of added graph must be ok"); |
289 $this->assertEquals("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $delta->getAddedGraph()->getUri(), "uri of added graph must be ok"); |
290 |
290 |
291 $this->assertEquals(3, $delta->getDeletedGraph()->countTriples(), "deleted graph must have only 3 triples"); |
291 $this->assertEquals(3, $delta->getDeletedGraph()->countTriples(), "deleted graph must have only 3 triples"); |
292 $this->assertEquals(5, $delta->getAddedGraph()->countTriples(), "deleted graph must have only 5 triples"); |
292 $this->assertEquals(5, $delta->getAddedGraph()->countTriples(), "deleted graph must have only 5 triples"); |
293 |
293 |
294 $resQueryDiscourseType = $delta->getAddedGraph()->allLiterals($doc->getProvidedCHO(), 'dc11:type'); |
294 $resQueryDiscourseType = $delta->getAddedGraph()->allLiterals($doc->getProvidedCHO(), 'dc11:type'); |
329 |
329 |
330 public function testUpdateDiscourseTypesIsomorphic() { |
330 public function testUpdateDiscourseTypesIsomorphic() { |
331 |
331 |
332 $newDiscourseTypes = ['oratory','dialogue','narrative']; |
332 $newDiscourseTypes = ['oratory','dialogue','narrative']; |
333 |
333 |
334 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
334 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
335 $doc->updateDiscourseTypes($newDiscourseTypes); |
335 $doc->updateDiscourseTypes($newDiscourseTypes); |
336 |
336 |
337 $doc2 = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", new EasyRdf\Graph("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", DocumentTest::TEST_DOC)); |
337 $doc2 = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", new EasyRdf\Graph("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", DocumentTest::TEST_DOC)); |
338 |
338 |
339 $this->assertFalse($doc->isIsomorphic($doc2),"document must not be isomorphic after adding discourse type"); |
339 $this->assertFalse($doc->isIsomorphic($doc2),"document must not be isomorphic after adding discourse type"); |
340 } |
340 } |
341 |
341 |
342 public function testGetContributors() { |
342 public function testGetContributors() { |
343 $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph); |
343 $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph); |
344 |
344 |
345 $contributors = $doc->getContributors(); |
345 $contributors = $doc->getContributors(); |
346 |
346 |
347 $this->assertNotEmpty($contributors, "The contributors array should not be empty"); |
347 $this->assertNotEmpty($contributors, "The contributors array should not be empty"); |
348 $this->assertCount(8, $contributors, "The contributors array should have 8 elements"); |
348 $this->assertCount(8, $contributors, "The contributors array should have 8 elements"); |