server/src/app/Models/Document.php
changeset 163 59c68fc4848e
parent 145 49b75287c30b
child 168 17f10b56c079
--- a/server/src/app/Models/Document.php	Sat May 28 11:49:38 2016 +0200
+++ b/server/src/app/Models/Document.php	Sun May 29 16:50:17 2016 +0200
@@ -239,6 +239,24 @@
         return $res;
     }
 
+    public function getTranscript() {
+        $res = null;
+        foreach($this->graph->allOfType("<http://www.europeana.eu/schemas/edm/WebResource>") as $webResource) {
+            $format = $webResource->getLiteral("dc11:format")->getValue();
+
+            if((0 === strpos($format, 'application/xml')) ||
+               (0 === strpos($format, 'application/pdf')) ) {
+                $conformsTo = $webResource->getResource("<http://purl.org/dc/terms/conformsTo>");
+                $res = [
+                    'url' =>  $webResource->getUri(),
+                    'format' => $format,
+                    'conforms-to' => $conformsTo?$conformsTo->getUri():null,
+                ];
+            }
+        }
+        return $res;
+    }
+
     public function getContributors() {
         if(is_null($this->contributors)) {
             $this->contributors = array_reduce(
@@ -418,6 +436,7 @@
                 'publishers' => $publishers,
                 'contributors' => $contributors,
                 'subjects' => $subjects,
+                'transcript' => $this->getTranscript(),
                 'mediaArray'=> $mediaArray
             ];