diff -r a53762d61c06 -r f3474aeec884 server/src/app/Models/Document.php --- a/server/src/app/Models/Document.php Fri Feb 03 16:35:09 2017 +0100 +++ b/server/src/app/Models/Document.php Mon Feb 06 10:03:33 2017 +0100 @@ -29,6 +29,7 @@ private $transcript = false; private $contributors = null; private $subjects = null; + private $types = null; private $geoInfo = false; protected function clearMemoizationCache() { @@ -37,6 +38,7 @@ $this->mediaArray = null; $this->contributors = null; $this->subjects = null; + $this->types = null; $this->transcript = false; $this->geoInfo = false; } @@ -95,7 +97,10 @@ } public function getTypes() { - return $this->getProvidedCHO()->all('dc11:type'); + if(is_null($this->types)) { + $this->types = $this->getProvidedCHO()->all('dc11:type'); + } + return $this->types; } public function getDiscourseTypes() { @@ -350,11 +355,16 @@ function($s) { return Utils::processLiteralResourceOrString($s); }, $this->getSubjects() ); + $types = array_map( + function($s) { return Utils::processLiteralResourceOrString($s); }, + $this->getTypes() + ); $res = array_merge($res, [ 'publishers' => $publishers, 'contributors' => $contributors, 'subjects' => $subjects, + 'types' => $types, 'transcript' => $transcript, 'mediaArray'=> $mediaArray, 'geoInfo' => $geoInfo