1 <?php |
1 <?php |
2 |
2 |
3 use CorpusParole\Models\GeoResource; |
3 use CorpusParole\Models\GeoResource; |
|
4 use CorpusParole\Models\Document; |
4 use CorpusParole\Libraries\CocoonUtils; |
5 use CorpusParole\Libraries\CocoonUtils; |
5 |
6 |
6 /** |
7 /** |
7 * |
8 * |
8 */ |
9 */ |
9 class GeoResourceTest extends TestCase { |
10 class GeoResourceTest extends TestCase { |
10 |
11 |
11 const TEST_DOCS = [ |
12 const TEST_DOCS = [ |
12 "LOC1" => <<<EOT |
13 "LOC1" => __DIR__.'/files/GeoResourceTest/loc1.ttl', |
13 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . |
14 "LOC2" => __DIR__.'/files/GeoResourceTest/loc2.ttl', |
14 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
15 "LOC3" => __DIR__.'/files/GeoResourceTest/loc3.ttl', |
15 @prefix sesame: <http://www.openrdf.org/schema/sesame#> . |
|
16 @prefix owl: <http://www.w3.org/2002/07/owl#> . |
|
17 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
|
18 @prefix fn: <http://www.w3.org/2005/xpath-functions#> . |
|
19 |
|
20 <%1\$scrdo-CFPP2000_35_SOUND> a <http://www.openarchives.org/ore/terms/Aggregation> ; |
|
21 <http://www.europeana.eu/schemas/edm/aggregatedCHO> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND> ; |
|
22 <http://www.europeana.eu/schemas/edm/dataProvider> "Langage et langues : description, théorisation, transmission" ; |
|
23 <http://www.europeana.eu/schemas/edm/hasView> <http://cocoon.huma-num.fr/exist/crdo/cfpp2000/fra/Ozgur_Kilic_H_32_alii_3e-2.xml> , <http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.mp3> , <http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.wav> ; |
|
24 <http://www.europeana.eu/schemas/edm/isShownAt> <http://corpusdelaparole.huma-num.fr/corpus-app#/detail/crdo-CFPP2000_35_SOUND> ; |
|
25 <http://www.europeana.eu/schemas/edm/isShownBy> <http://cocoon.huma-num.fr/data/archi/masters/372593.wav> ; |
|
26 <http://www.europeana.eu/schemas/edm/provider> "Corpus de la Parole"@fr ; |
|
27 <http://www.europeana.eu/schemas/edm/rights> <http://creativecommons.org/licenses/by-nc-sa/4.0/> . |
|
28 |
|
29 <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND> a <http://www.europeana.eu/schemas/edm/ProvidedCHO> ; |
|
30 <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ; |
|
31 <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
32 <http://purl.org/dc/terms/extent> "PT48M26S" ; |
|
33 <http://purl.org/dc/terms/issued> "2013-10-12T14:35:57+02:00"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
34 <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ; |
|
35 <http://purl.org/dc/elements/1.1/contributor> <http://viaf.org/viaf/93752300> , "Tanguy, Noalig" , "Chevrier, Michel" , "Kiliç, Ozgur" , "Salvegas, Etienne" , "du-Breuil-de-Pont-en-Auge, Augustin" , "du-Breuil-de-Pont-en-Auge, Benoît" ; |
|
36 <http://purl.org/dc/elements/1.1/description> "Enregistrement issu du Corpus de Français Parlé Parisien des années 2000 (CFPP2000)"@fr , "Quartier(s) concerné(s) : Paris 3e, et 20e (pour l'âge adulte); Anonymisation : Noalig TANGUY;"@fr ; |
|
37 <http://purl.org/dc/elements/1.1/identifier> "ark:/87895/1.17-375004" , "%2\$scrdo-CFPP2000_35_SOUNDid" , "oai:crdo.vjf.cnrs.fr:crdo-CFPP2000_35" , "Cote producteur: [03-01] Ozgur_Kilic_H_32_alii_3e"@fr , "ark:/87895/1.17-372593" , "oai:crdo.vjf.cnrs.fr:crdo-CFPP2000_35_SOUND" ; |
|
38 <http://purl.org/dc/elements/1.1/language> <http://lexvo.org/id/iso639-3/fra> ; |
|
39 <http://purl.org/dc/elements/1.1/publisher> <http://viaf.org/viaf/142432638>; |
|
40 <http://purl.org/dc/elements/1.1/subject> <http://ark.bnf.fr/ark:/12148/cb13318415c> , "anthropological_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "lexicography"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "phonetics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , <http://lexvo.org/id/iso639-3/fra> , <http://ark.bnf.fr/ark:/12148/cb133188907> , <http://ark.bnf.fr/ark:/12148/cb11932762f> , "general_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , <http://ark.bnf.fr/ark:/12148/cb133183660> , "text_and_corpus_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "Français"@fr , <http://ark.bnf.fr/ark:/12148/cb122368540> , "phonology"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "semantics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "sociolinguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "syntax"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "typology"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , <http://ark.bnf.fr/ark:/12148/cb119418302> , <http://ark.bnf.fr/ark:/12148/cb135540729> , "discourse_analysis"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "historical_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "language_documentation"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , <http://ark.bnf.fr/ark:/12148/cb133192210> , <http://ark.bnf.fr/ark:/12148/cb119377452> , <http://ark.bnf.fr/ark:/12148/cb13320451h> , <http://ark.bnf.fr/ark:/12148/cb13318422n> , <http://ark.bnf.fr/ark:/12148/cb11975823c> , "mathematical_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> ; |
|
41 <http://purl.org/dc/elements/1.1/title> "Entretien de Ozgur Kiliç 2"@fr ; |
|
42 <http://purl.org/dc/elements/1.1/type> <http://ark.bnf.fr/ark:/12148/cb11932135w> , <http://ark.bnf.fr/ark:/12148/cb12481481z> , <http://purl.org/dc/dcmitype/Sound> , "primary_text"^^<http://www.language-archives.org/OLAC/1.1/linguistic-type> , <http://purl.org/dc/dcmitype/Text> , "narrative"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> , "report"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> , "unintelligible_speech"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> ; |
|
43 <http://purl.org/dc/terms/available> "2013-10-12"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
44 <http://purl.org/dc/terms/spatial> [ |
|
45 a <http://www.europeana.eu/schemas/edm/Place> ; |
|
46 owl:sameAs <http://sws.geonames.org/6618626/> ; |
|
47 <http://www.w3.org/2004/02/skos/core#note> "FR"^^<http://purl.org/dc/terms/ISO3166> , "France, Île-de-France, Paris, Université Sorbonne Nouvelle Paris 3, site Censier"@fr , "Domicile de Ozgur Kiliç"@fr , "France, Île-de-France, Paris 20"@fr |
|
48 ]; |
|
49 <http://www.europeana.eu/schemas/edm/isGatheredInto> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LANGUESDEFRANCE> , <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_CFPP2000> ; |
|
50 <http://www.language-archives.org/OLAC/1.1/depositor> <http://viaf.org/viaf/93752300> ; |
|
51 <http://www.language-archives.org/OLAC/1.1/interviewer> <http://viaf.org/viaf/93752300> ; |
|
52 <http://www.language-archives.org/OLAC/1.1/transcriber> "Tanguy, Noalig" ; |
|
53 <http://purl.org/dc/elements/1.1/coverage> "Quartier concerné : 3e"@fr ; |
|
54 <http://www.language-archives.org/OLAC/1.1/responder> "Chevrier, Michel" , "Kiliç, Ozgur" , "Salvegas, Etienne" , "du-Breuil-de-Pont-en-Auge, Augustin" , "du-Breuil-de-Pont-en-Auge, Benoît" ; |
|
55 <http://purl.org/dc/elements/1.1/relation> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_31_SOUND> . |
|
56 |
|
57 |
|
58 <http://cocoon.huma-num.fr/exist/crdo/cfpp2000/fra/Ozgur_Kilic_H_32_alii_3e-2.xml> a <http://www.europeana.eu/schemas/edm/WebResource> ; |
|
59 <http://purl.org/dc/elements/1.1/format> "application/xml"^^<http://purl.org/dc/terms/IMT> ; |
|
60 <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ; |
|
61 <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
62 <http://purl.org/dc/terms/issued> "2013-11-04T22:20:07+01:00"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
63 <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ; |
|
64 <http://purl.org/dc/terms/conformsTo> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_transcriber> . |
|
65 |
|
66 <http://cocoon.huma-num.fr/data/archi/masters/372593.wav> a <http://www.europeana.eu/schemas/edm/WebResource> ; |
|
67 <http://purl.org/dc/elements/1.1/format> "audio/x-wav"^^<http://purl.org/dc/terms/IMT> ; |
|
68 <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ; |
|
69 <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
70 <http://purl.org/dc/terms/extent> "PT48M26S" ; |
|
71 <http://purl.org/dc/terms/issued> "2013-10-12T14:35:57+02:00"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
72 <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> . |
|
73 |
|
74 <http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.mp3> a <http://www.europeana.eu/schemas/edm/WebResource> ; |
|
75 <http://purl.org/dc/elements/1.1/format> "audio/mpeg"^^<http://purl.org/dc/terms/IMT> ; |
|
76 <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ; |
|
77 <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
78 <http://purl.org/dc/terms/extent> "PT48M26S" ; |
|
79 <http://purl.org/dc/terms/issued> "2013-10-12T14:35:57+02:00"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
80 <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ; |
|
81 <http://www.europeana.eu/schemas/edm/isDerivativeOf> <http://cocoon.huma-num.fr/data/archi/masters/372593.wav> . |
|
82 |
|
83 <http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.wav> a <http://www.europeana.eu/schemas/edm/WebResource> ; |
|
84 <http://purl.org/dc/elements/1.1/format> "audio/x-wav"^^<http://purl.org/dc/terms/IMT> ; |
|
85 <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ; |
|
86 <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
87 <http://purl.org/dc/terms/extent> "PT48M26S" ; |
|
88 <http://purl.org/dc/terms/issued> "2013-10-12T14:35:57+02:00"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
89 <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ; |
|
90 <http://www.europeana.eu/schemas/edm/isDerivativeOf> <http://cocoon.huma-num.fr/data/archi/masters/372593.wav> . |
|
91 EOT |
|
92 , |
|
93 "LOC2" => <<<EOT |
|
94 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . |
|
95 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
|
96 @prefix sesame: <http://www.openrdf.org/schema/sesame#> . |
|
97 @prefix owl: <http://www.w3.org/2002/07/owl#> . |
|
98 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
|
99 @prefix fn: <http://www.w3.org/2005/xpath-functions#> . |
|
100 |
|
101 <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND> a <http://www.europeana.eu/schemas/edm/ProvidedCHO> ; |
|
102 <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ; |
|
103 <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
104 <http://purl.org/dc/terms/extent> "PT48M26S" ; |
|
105 <http://purl.org/dc/terms/issued> "2013-10-12T14:35:57+02:00"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
106 <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ; |
|
107 <http://purl.org/dc/elements/1.1/description> "Enregistrement issu du Corpus de Français Parlé Parisien des années 2000 (CFPP2000)"@fr , "Quartier(s) concerné(s) : Paris 3e, et 20e (pour l'âge adulte); Anonymisation : Noalig TANGUY;"@fr ; |
|
108 <http://purl.org/dc/elements/1.1/identifier> "ark:/87895/1.17-375004" , "%2\$scrdo-CFPP2000_35_SOUNDid" , "oai:crdo.vjf.cnrs.fr:crdo-CFPP2000_35" , "Cote producteur: [03-01] Ozgur_Kilic_H_32_alii_3e"@fr , "ark:/87895/1.17-372593" , "oai:crdo.vjf.cnrs.fr:crdo-CFPP2000_35_SOUND" ; |
|
109 <http://purl.org/dc/elements/1.1/language> <http://lexvo.org/id/iso639-3/fra> ; |
|
110 <http://purl.org/dc/elements/1.1/publisher> <http://viaf.org/viaf/142432638>; |
|
111 <http://purl.org/dc/elements/1.1/title> "Entretien de Ozgur Kiliç 2"@fr ; |
|
112 <http://purl.org/dc/terms/available> "2013-10-12"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
113 <http://purl.org/dc/terms/spatial> [ |
|
114 a <http://www.europeana.eu/schemas/edm/Place> ; |
|
115 <http://www.w3.org/2004/02/skos/core#note> "FR"^^<http://purl.org/dc/terms/ISO3166> , "France, Île-de-France, Paris, Université Sorbonne Nouvelle Paris 3, site Censier"@fr , "Domicile de Ozgur Kiliç"@fr , "France, Île-de-France, Paris 20"@fr |
|
116 ] . |
|
117 EOT |
|
118 , |
|
119 "LOC3" => <<<EOT |
|
120 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . |
|
121 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
|
122 @prefix sesame: <http://www.openrdf.org/schema/sesame#> . |
|
123 @prefix owl: <http://www.w3.org/2002/07/owl#> . |
|
124 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
|
125 @prefix fn: <http://www.w3.org/2005/xpath-functions#> . |
|
126 |
|
127 <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND> a <http://www.europeana.eu/schemas/edm/ProvidedCHO> ; |
|
128 <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ; |
|
129 <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
130 <http://purl.org/dc/terms/extent> "PT48M26S" ; |
|
131 <http://purl.org/dc/terms/issued> "2013-10-12T14:35:57+02:00"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
132 <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ; |
|
133 <http://purl.org/dc/elements/1.1/description> "Enregistrement issu du Corpus de Français Parlé Parisien des années 2000 (CFPP2000)"@fr , "Quartier(s) concerné(s) : Paris 3e, et 20e (pour l'âge adulte); Anonymisation : Noalig TANGUY;"@fr ; |
|
134 <http://purl.org/dc/elements/1.1/identifier> "ark:/87895/1.17-375004" , "%2\$scrdo-CFPP2000_35_SOUNDid" , "oai:crdo.vjf.cnrs.fr:crdo-CFPP2000_35" , "Cote producteur: [03-01] Ozgur_Kilic_H_32_alii_3e"@fr , "ark:/87895/1.17-372593" , "oai:crdo.vjf.cnrs.fr:crdo-CFPP2000_35_SOUND" ; |
|
135 <http://purl.org/dc/elements/1.1/language> <http://lexvo.org/id/iso639-3/fra> ; |
|
136 <http://purl.org/dc/elements/1.1/publisher> <http://viaf.org/viaf/142432638>; |
|
137 <http://purl.org/dc/elements/1.1/title> "Entretien de Ozgur Kiliç 2"@fr ; |
|
138 <http://purl.org/dc/terms/available> "2013-10-12"^^<http://purl.org/dc/terms/W3CDTF> ; |
|
139 <http://purl.org/dc/terms/spatial> [ |
|
140 a <http://www.europeana.eu/schemas/edm/Place> ; |
|
141 owl:sameAs <http://sws.geonames.org/6618626/> ; |
|
142 owl:sameAs <http://fr.dbpedia.org/resource/Gramazie> ; |
|
143 <http://www.w3.org/2004/02/skos/core#note> "FR"^^<http://purl.org/dc/terms/ISO3166> , "France, Île-de-France, Paris, Université Sorbonne Nouvelle Paris 3, site Censier"@fr , "Domicile de Ozgur Kiliç"@fr , "France, Île-de-France, Paris 20"@fr |
|
144 ] . |
|
145 EOT |
|
146 ]; |
16 ]; |
147 |
17 |
148 public function setUp() { |
18 public function setUp() { |
149 |
19 |
150 parent::setup(); |
20 parent::setup(); |
151 $this->graphs = []; |
21 $this->graphs = []; |
152 $this->graphUrl = sprintf("%1\$scrdo-CFPP2000_35_SOUND", config('corpusparole.corpus_doc_id_base_uri')); |
22 $this->graphUrl = sprintf("%1\$scrdo-CFPP2000_35_SOUND", config('corpusparole.corpus_doc_id_base_uri')); |
153 foreach(self::TEST_DOCS as $k => $ttl) { |
23 foreach(self::TEST_DOCS as $k => $ttl) { |
154 |
24 |
155 $this->graphs[$k] = new EasyRdf\Graph($this->graphUrl, sprintf($ttl, config('corpusparole.corpus_doc_id_base_uri'), config('corpusparole.corpus_id_scheme'))); |
25 $this->graphs[$k] = new EasyRdf\Graph($this->graphUrl, sprintf(file_get_contents($ttl), config('corpusparole.corpus_doc_id_base_uri'), config('corpusparole.corpus_id_scheme'))); |
156 } |
26 } |
157 } |
27 } |
158 |
28 |
159 public function getGeoResource($key) { |
29 public function getGeoResource($key) { |
160 |
30 |
161 $graph = $this->graphs[$key]; |
31 $graph = $this->graphs[$key]; |
|
32 $providedCHO = $graph->get("<".config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND>", "<http://www.europeana.eu/schemas/edm/aggregatedCHO>"); |
162 $places = $graph->allOfType("<http://www.europeana.eu/schemas/edm/Place>"); |
33 $places = $graph->allOfType("<http://www.europeana.eu/schemas/edm/Place>"); |
163 assert(count($places)>0); |
34 assert(count($places)>0); |
164 $place = $places[0]; |
35 $place = $places[0]; |
165 |
36 |
166 return new GeoResource($place->getUri(), $graph); |
37 return new GeoResource($place->getUri(), $graph, $providedCHO); |
|
38 |
|
39 } |
|
40 |
|
41 public function getGeoResourceEdit($key) { |
|
42 $graph = $this->graphs[$key]; |
|
43 $doc = new Document($this->graphUrl, $graph); |
|
44 |
|
45 return $doc->addGeoInfo(); |
167 |
46 |
168 } |
47 } |
169 |
48 |
170 public function testConstructor() { |
49 public function testConstructor() { |
171 |
50 |