34 private $publishers = null; |
34 private $publishers = null; |
35 private $mediaArray = null; |
35 private $mediaArray = null; |
36 private $issued = null; |
36 private $issued = null; |
37 private $modified = null; |
37 private $modified = null; |
38 private $contributors = null; |
38 private $contributors = null; |
|
39 private $subjects = null; |
39 |
40 |
40 public function getProvidedCHO() { |
41 public function getProvidedCHO() { |
41 if(is_null($this->providedCHO)) { |
42 if(is_null($this->providedCHO)) { |
42 $this->providedCHO = $this->get("<http://www.europeana.eu/schemas/edm/aggregatedCHO>"); |
43 $this->providedCHO = $this->get("<http://www.europeana.eu/schemas/edm/aggregatedCHO>"); |
43 } |
44 } |
52 $this->publishers = null; |
53 $this->publishers = null; |
53 $this->mediaArray = null; |
54 $this->mediaArray = null; |
54 $this->issued = null; |
55 $this->issued = null; |
55 $this->modified = null; |
56 $this->modified = null; |
56 $this->contributors = null; |
57 $this->contributors = null; |
|
58 $this->subjects = null; |
57 } |
59 } |
58 |
60 |
59 public function getId() { |
61 public function getId() { |
60 if(is_null($this->id)) { |
62 if(is_null($this->id)) { |
61 $ids = $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/identifier>'); |
63 $ids = $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/identifier>'); |
314 } |
316 } |
315 |
317 |
316 $this->clearMemoizationCache(); |
318 $this->clearMemoizationCache(); |
317 } |
319 } |
318 |
320 |
|
321 /** |
|
322 * Get subjects list |
|
323 */ |
|
324 public function getSubjects() { |
|
325 if(is_null($this->subjects)) { |
|
326 $this->subjects = $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/subject>'); |
|
327 } |
|
328 return $this->subjects; |
|
329 } |
|
330 |
319 public function isIsomorphic($doc) { |
331 public function isIsomorphic($doc) { |
320 return Isomorphic::isomorphic($this->graph, $doc->graph); |
332 return Isomorphic::isomorphic($this->graph, $doc->graph); |
321 } |
333 } |
322 |
334 |
323 /* |
335 /* |
335 'id' => $this->getId(), |
347 'id' => $this->getId(), |
336 ]; |
348 ]; |
337 } else { |
349 } else { |
338 $mediaArray = array_map( |
350 $mediaArray = array_map( |
339 function($m) { |
351 function($m) { |
340 $f = Utils::processLiteralOrString($m['format']); |
352 $f = Utils::processLiteralResourceOrString($m['format']); |
341 $res = $m; |
353 $res = $m; |
342 $res['format'] = $f; |
354 $res['format'] = $f; |
343 return $res;}, |
355 return $res;}, |
344 $this->getMediaArray() |
356 $this->getMediaArray() |
345 ); |
357 ); |
346 |
358 |
347 $publishers = array_map( |
359 $publishers = array_map( |
348 function($v) { return Utils::processLiteralOrString($v); }, |
360 function($v) { return Utils::processLiteralResourceOrString($v); }, |
349 $this->getPublishers() |
361 $this->getPublishers() |
350 ); |
362 ); |
351 |
363 |
352 $contributors = array_map( |
364 $contributors = array_map( |
353 function($c) { unset($c['nameLiteral']); return $c; }, |
365 function($c) { unset($c['nameLiteral']); return $c; }, |
354 $this->getContributors() |
366 $this->getContributors() |
|
367 ); |
|
368 |
|
369 $subjects = array_map( |
|
370 function($s) { return Utils::processLiteralResourceOrString($s); }, |
|
371 $this->getSubjects() |
355 ); |
372 ); |
356 |
373 |
357 $res = [ |
374 $res = [ |
358 'id' => $this->getId(), |
375 'id' => $this->getId(), |
359 'uri' => $this->getUri(), |
376 'uri' => $this->getUri(), |
360 'title' => $this->getTitleValue(), |
377 'title' => $this->getTitleValue(), |
361 'language' => $this->getLanguageValue(), |
378 'language' => $this->getLanguageValue(), |
362 'modified' => $this->getModifiedValue(), |
379 'modified' => $this->getModifiedValue(), |
363 'publishers' => $publishers, |
380 'publishers' => $publishers, |
364 'contributors' => $contributors, |
381 'contributors' => $contributors, |
|
382 'subjects' => $subjects, |
365 'mediaArray'=> $mediaArray |
383 'mediaArray'=> $mediaArray |
366 ]; |
384 ]; |
367 |
385 |
368 if($this->language_resolved) { |
386 if($this->language_resolved) { |
369 $res['language_resolved'] = $this->getLanguageResolved(); |
387 $res['language_resolved'] = $this->getLanguageResolved(); |