server/src/app/Models/TranscriptResource.php
author ymh <ymh.work@gmail.com>
Wed, 13 Sep 2017 22:19:48 +0200
changeset 544 ad58d7627f70
parent 521 b3c738a20af8
permissions -rw-r--r--
use same http client in ImportCocoonRDF and define version 0.22
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
namespace CorpusParole\Models;
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
use CorpusParole\Libraries\RdfModel\RdfModelResource;
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
use CorpusParole\Libraries\Utils;
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
use JsonSerializable;
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
use Log;
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
/**
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 */
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
class TranscriptResource extends WebResource  {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
    private $conformsTo = -1;
521
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    16
    private $rights = false;
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
    protected function doClearMemoizationCache() {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
        $this->conformsTo = -1;
521
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    21
        $this->rights = false;
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
    }
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
    public function getConformsTo() {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
        if($this->conformsTo === -1) {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
            $conformsTo = $this->getResource("<http://purl.org/dc/terms/conformsTo>");
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
            $this->conformsTo = is_null($conformsTo)?null:$conformsTo->getUri();
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
        }
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
        return $this->conformsTo;
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
    }
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
521
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    33
    public function getRights() {
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    34
        if($this->rights === false) {
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    35
            $rightsRes = $this->getResource("<http://purl.org/dc/terms/license>");
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    36
            $this->rights = is_null($rightsRes)?null:$rightsRes->getUri();
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    37
        }
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    38
        return $this->rights;
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    39
    }
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    40
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
    protected function jsonSerializeExtra() {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
        return [
521
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    44
            'conforms-to' => $this->getConformsTo(),
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    45
            'rights' => $this->getRights()
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
        ];
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
    }
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
521
b3c738a20af8 Add transcript right declaration, resolve bug #0026452
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    49
}