|
1 <?php |
|
2 namespace CorpusParole\Libraries\Mappers; |
|
3 |
|
4 use Config; |
|
5 |
|
6 use CorpusParole\Libraries\Utils; |
|
7 use CorpusParole\Libraries\CocoonUtils; |
|
8 |
|
9 use EasyRdf\Graph; |
|
10 use EasyRdf\Literal; |
|
11 use EasyRdf\Resource; |
|
12 |
|
13 |
|
14 /** |
|
15 * |
|
16 * rdf:type |
|
17 * sesame:directType |
|
18 ** <http://purl.org/dc/elements/1.1/description> -> providedCHO |
|
19 * <http://purl.org/dc/elements/1.1/format> -> webRepresentation |
|
20 * <http://purl.org/dc/elements/1.1/language> -> providedCHO |
|
21 * <http://purl.org/dc/elements/1.1/publisher> -> providedCHO |
|
22 * <http://purl.org/dc/elements/1.1/rights> -> providedCHO |
|
23 * <http://purl.org/dc/elements/1.1/subject> -> providedCHO |
|
24 * <http://purl.org/dc/elements/1.1/title> -> providedCHO |
|
25 * <http://purl.org/dc/elements/1.1/type> -> providedCHO |
|
26 * <http://purl.org/dc/terms/accessRights> -> providedCHO |
|
27 * <http://purl.org/dc/terms/available> -> providedCHO |
|
28 * <http://purl.org/dc/terms/conformsTo> -> for text -> webRepresentation (2 val : http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_transcriber : transcript, http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_archive) |
|
29 * <http://purl.org/dc/terms/created> -> providedCHO |
|
30 * <http://purl.org/dc/terms/isFormatOf> -> webResource |
|
31 *** <http://purl.org/dc/terms/isPartOf> ->collections |
|
32 * <http://purl.org/dc/terms/issued> -> providedCHO |
|
33 * <http://purl.org/dc/terms/license> -> providedCHO |
|
34 *** <http://purl.org/dc/terms/requires> -> transcriptions |
|
35 * <http://www.language-archives.org/OLAC/1.1/data_inputter> -> providedCHO |
|
36 * <http://www.language-archives.org/OLAC/1.1/depositor> -> providedCHO |
|
37 * <http://www.language-archives.org/OLAC/1.1/editor> -> providedCHO |
|
38 * <http://www.language-archives.org/OLAC/1.1/interviewer> -> providedCHO |
|
39 * <http://www.language-archives.org/OLAC/1.1/researcher> -> providedCHO |
|
40 * <http://www.language-archives.org/OLAC/1.1/speaker> -> providedCHO |
|
41 * <http://www.language-archives.org/OLAC/1.1/transcriber> -> providedCHO |
|
42 * <http://www.language-archives.org/OLAC/1.1/participant> -> providedCHO |
|
43 * <http://www.language-archives.org/OLAC/1.1/compiler> -> providedCHO |
|
44 * <http://www.language-archives.org/OLAC/1.1/interpreter> -> providedCHO |
|
45 * <http://www.language-archives.org/OLAC/1.1/author> -> providedCHO |
|
46 * <http://www.language-archives.org/OLAC/1.1/translator> -> providedCHO |
|
47 * <http://www.language-archives.org/OLAC/1.1/signer> -> providedCHO |
|
48 * <http://www.language-archives.org/OLAC/1.1/recorder> -> providedCHO |
|
49 * <http://www.language-archives.org/OLAC/1.1/responder> -> providedCHO |
|
50 * <http://www.language-archives.org/OLAC/1.1/developer> -> providedCHO |
|
51 * <http://www.language-archives.org/OLAC/1.1/sponsor> -> providedCHO |
|
52 * <http://www.language-archives.org/OLAC/1.1/annotator> -> providedCHO |
|
53 * <http://www.language-archives.org/OLAC/1.1/singer> -> providedCHO |
|
54 * <http://www.language-archives.org/OLAC/1.1/consultant> -> providedCHO |
|
55 * <http://www.language-archives.org/OLAC/1.1/research_participant> -> providedCHO |
|
56 * <http://crdo.risc.cnrs.fr/schemas/master> -> webRepresentation |
|
57 * <http://purl.org/dc/terms/extent> -> webRepresentation |
|
58 * <http://purl.org/dc/terms/isRequiredBy> -> transcriptions |
|
59 * <http://purl.org/dc/terms/spatial> -> edm:Place |
|
60 * <http://www.w3.org/2003/01/geo/wgs84_pos#lat> -> edm:Place |
|
61 * <http://www.w3.org/2003/01/geo/wgs84_pos#long> -> edm:Place |
|
62 * <http://purl.org/dc/elements/1.1/source> -> providedCHO |
|
63 * <http://purl.org/dc/terms/tableOfContents> -> providedCHO |
|
64 * <http://purl.org/dc/terms/alternative> -> providedCHO |
|
65 * <http://purl.org/dc/terms/modified> -> providedCHO |
|
66 * <http://purl.org/dc/terms/abstract> -> providedCHO |
|
67 * <http://purl.org/dc/elements/1.1/identifier> -> providedCHO but question... |
|
68 * <http://purl.org/dc/terms/medium> -> providedCHO |
|
69 * <http://purl.org/dc/elements/1.1/coverage> -> providedCHO |
|
70 * <http://purl.org/dc/elements/1.1/relation> - providedCHO |
|
71 * <http://purl.org/dc/terms/description> -> ProvidedCHO |
|
72 * <http://purl.org/dc/terms/bibliographicCitation> -> providedCHO |
|
73 * <http://purl.org/dc/elements/1.1/creator> -> providedCHO |
|
74 * <http://purl.org/dc/terms/references> -> providedCHO |
|
75 * <http://purl.org/dc/elements/1.1/reference> -> providedCHO |
|
76 * |
|
77 * pour olac : http://quijote.fdi.ucm.es:8084/LLOD-LSASummerWorkshop2015/Presentations/Simons--OLAC%20Metadata.pdf |
|
78 * DATA consolidation |
|
79 * -> edm:place : get label + altLabel |
|
80 */ |
|
81 class CocoonSoundRdfMapper extends CocoonContentRdfMapper { |
|
82 |
|
83 protected function getResourceBaseId($res=null) { |
|
84 |
|
85 if(is_null($res)) { |
|
86 $res = $this->inputGraph->resource($this->uri); |
|
87 } |
|
88 return $res->getUri(); |
|
89 } |
|
90 |
|
91 /** |
|
92 * Build teh webresources |
|
93 */ |
|
94 protected function mapWebResources($res, $outputGraph) { |
|
95 |
|
96 $resId = CocoonUtils::getIdFromUri($res->getUri()); |
|
97 $resUri = CocoonUtils::getCorpusUriFromId($resId); |
|
98 |
|
99 |
|
100 $aggregationNode = $outputGraph->resource($resUri, 'ore:Aggregation'); |
|
101 |
|
102 // get extent |
|
103 $extent = $res->get($this->inputGraph->resource('http://purl.org/dc/terms/extent')); |
|
104 |
|
105 // build master webresources |
|
106 $masterReprUrl = $res->get($this->inputGraph->resource('http://crdo.risc.cnrs.fr/schemas/master')); |
|
107 if(! is_null($masterReprUrl)) { |
|
108 $masterWebResource = $outputGraph->resource($masterReprUrl, 'edm:WebResources'); |
|
109 if(!is_null($extent)) { |
|
110 $masterWebResource->addLiteral($outputGraph->resource('http://purl.org/dc/terms/extent'),$extent); |
|
111 } |
|
112 $formatAdded = false; |
|
113 foreach($res->all($this->inputGraph->resource('http://purl.org/dc/elements/1.1/format')) as $wrformat) { |
|
114 $masterWebResource->addLiteral('http://purl.org/dc/elements/1.1/format', $wrformat); |
|
115 $formatAdded = true; |
|
116 } |
|
117 if(!$formatAdded) { |
|
118 $mimetype = Utils::getMimetype($masterReprUrl); |
|
119 $masterWebResource->addLiteral('http://purl.org/dc/elements/1.1/format', Literal::create($mimetype, null, $outputGraph->resource('http://purl.org/dc/terms/IMT'))); |
|
120 } |
|
121 |
|
122 $this->addDateToWebResource($res, $masterWebResource); |
|
123 |
|
124 } |
|
125 |
|
126 // build others |
|
127 foreach($res->all($this->inputGraph->resource('http://purl.org/dc/terms/isFormatOf')) as $reprUrl) { |
|
128 $webResource = $outputGraph->resource($reprUrl, 'edm:WebResources'); |
|
129 if(!is_null($extent)) { |
|
130 $webResource->addLiteral($outputGraph->resource('http://purl.org/dc/terms/extent'),$extent); |
|
131 } |
|
132 $mimetype = Utils::getMimetype($reprUrl); |
|
133 $webResource->addLiteral('http://purl.org/dc/elements/1.1/format', Literal::create($mimetype, null, $outputGraph->resource('http://purl.org/dc/terms/IMT'))); |
|
134 |
|
135 if(!is_null($masterReprUrl)) { |
|
136 $webResource->addResource('edm:isDerivativeOf', $masterReprUrl); |
|
137 } |
|
138 $this->addDateToWebResource($res, $webResource); |
|
139 $aggregationNode->addResource('edm:hasView', $reprUrl); |
|
140 } |
|
141 } |
|
142 } |