server/src/app/Models/Document.php
changeset 122 b37fde30dd4a
parent 115 34ffc04cef62
child 125 e550b10fe3ca
--- a/server/src/app/Models/Document.php	Thu Feb 11 15:42:27 2016 +0100
+++ b/server/src/app/Models/Document.php	Fri Feb 12 15:30:32 2016 +0100
@@ -20,6 +20,7 @@
 class Document extends RdfModelResource implements JsonSerializable {
 
     public function __construct($uri, $graph = null) {
+        //print($graph->dump('html'));
         parent::__construct($uri, $graph);
     }
 
@@ -55,7 +56,12 @@
 
     public function getId() {
         if(is_null($this->id)) {
-            $this->id = $this->getProvidedCHO()->get('<http://purl.org/dc/terms/identifier>');
+            $ids = $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/identifier>');
+            foreach ($ids as $id) {
+                if($id instanceof Literal && strpos($id->getValue(), config('corpusparole.corpus_id_scheme')) === 0) {
+                    $this->id = $id->getValue();
+                }
+            }
             if(is_null($this->id)) {
                 $this->id = CocoonUtils::getIdFromCorpusUri($this->uri);
             }