diff -r 4fca650b9b8a -r fac22d8c2df8 server/src/app/Models/Document.php --- a/server/src/app/Models/Document.php Tue Feb 23 18:52:27 2016 +0100 +++ b/server/src/app/Models/Document.php Thu Feb 25 10:20:01 2016 +0100 @@ -36,6 +36,7 @@ private $issued = null; private $modified = null; private $contributors = null; + private $subjects = null; public function getProvidedCHO() { if(is_null($this->providedCHO)) { @@ -54,6 +55,7 @@ $this->issued = null; $this->modified = null; $this->contributors = null; + $this->subjects = null; } public function getId() { @@ -316,6 +318,16 @@ $this->clearMemoizationCache(); } + /** + * Get subjects list + */ + public function getSubjects() { + if(is_null($this->subjects)) { + $this->subjects = $this->getProvidedCHO()->all(''); + } + return $this->subjects; + } + public function isIsomorphic($doc) { return Isomorphic::isomorphic($this->graph, $doc->graph); } @@ -337,7 +349,7 @@ } else { $mediaArray = array_map( function($m) { - $f = Utils::processLiteralOrString($m['format']); + $f = Utils::processLiteralResourceOrString($m['format']); $res = $m; $res['format'] = $f; return $res;}, @@ -345,7 +357,7 @@ ); $publishers = array_map( - function($v) { return Utils::processLiteralOrString($v); }, + function($v) { return Utils::processLiteralResourceOrString($v); }, $this->getPublishers() ); @@ -354,6 +366,11 @@ $this->getContributors() ); + $subjects = array_map( + function($s) { return Utils::processLiteralResourceOrString($s); }, + $this->getSubjects() + ); + $res = [ 'id' => $this->getId(), 'uri' => $this->getUri(), @@ -362,6 +379,7 @@ 'modified' => $this->getModifiedValue(), 'publishers' => $publishers, 'contributors' => $contributors, + 'subjects' => $subjects, 'mediaArray'=> $mediaArray ];