server/src/app/Models/Document.php
changeset 498 265992e5b379
parent 497 f3474aeec884
child 500 4f507ba2bb4c
--- a/server/src/app/Models/Document.php	Mon Feb 06 10:03:33 2017 +0100
+++ b/server/src/app/Models/Document.php	Mon Feb 06 13:23:39 2017 +0100
@@ -30,6 +30,7 @@
     private $contributors = null;
     private $subjects = null;
     private $types = null;
+    private $descriptions = null;
     private $geoInfo = false;
 
     protected function clearMemoizationCache() {
@@ -39,6 +40,7 @@
         $this->contributors = null;
         $this->subjects = null;
         $this->types = null;
+        $this->descriptions = null;
         $this->transcript = false;
         $this->geoInfo = false;
     }
@@ -310,6 +312,19 @@
     }
 
 
+    /**
+     * Get subjects list
+     */
+    public function getDescriptions() {
+        if(is_null($this->descriptions)) {
+            $this->descriptions = [];
+            $this->descriptions = array_merge($this->descriptions, $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/description>'));
+            $this->descriptions = array_merge($this->descriptions, $this->getProvidedCHO()->all('<http://purl.org/dc/terms/abstract>'));
+            $this->descriptions = array_merge($this->descriptions, $this->getProvidedCHO()->all('<http://purl.org/dc/terms/tableOfContents>'));
+        }
+        return $this->descriptions;
+    }
+
 
     public function isIsomorphic($doc) {
         return Isomorphic::isomorphic($this->graph, $doc->graph);
@@ -359,6 +374,10 @@
                 function($s) { return Utils::processLiteralResourceOrString($s); },
                 $this->getTypes()
             );
+            $descriptions = array_map(
+                function($s) { return Utils::processLiteralResourceOrString($s); },
+                $this->getDescriptions()
+            );
 
             $res = array_merge($res, [
                 'publishers' => $publishers,
@@ -367,7 +386,8 @@
                 'types' => $types,
                 'transcript' => $transcript,
                 'mediaArray'=> $mediaArray,
-                'geoInfo' => $geoInfo
+                'geoInfo' => $geoInfo,
+                'descriptions' => $descriptions
             ]);
 
         }