equal
deleted
inserted
replaced
|
1 <?php |
|
2 namespace CorpusParole\Models; |
|
3 |
|
4 use CorpusParole\Libraries\RdfModel\RdfModelResource; |
|
5 use CorpusParole\Libraries\Utils; |
|
6 use JsonSerializable; |
|
7 use Log; |
|
8 |
|
9 /** |
|
10 */ |
|
11 class GeoResource extends RdfModelResource implements JsonSerializable { |
|
12 |
|
13 public function __construct($uri, $graph) { |
|
14 parent::__construct($uri, $graph); |
|
15 } |
|
16 |
|
17 private $refLoc = false; |
|
18 private $notes = null; |
|
19 |
|
20 public function clearMemoizationCache() { |
|
21 $this->refLoc = false; |
|
22 $this->notes = null; |
|
23 } |
|
24 |
|
25 public function getRefLoc() { |
|
26 if($this->refLoc === false) { |
|
27 $refLoc = $this->getResource("<http://www.w3.org/2002/07/owl#sameAs>"); |
|
28 $this->refLoc = is_null($refLoc)?null:$refLoc->getUri(); |
|
29 } |
|
30 return $this->refLoc; |
|
31 } |
|
32 |
|
33 public function getNotes() { |
|
34 if(is_null($this->notes)) { |
|
35 $this->notes = $this->all('<http://www.w3.org/2004/02/skos/core#note>'); |
|
36 } |
|
37 return $this->notes; |
|
38 } |
|
39 |
|
40 public function jsonSerialize() { |
|
41 $notes = array_map( |
|
42 function($note) { return Utils::processLiteralResourceOrString($note); }, |
|
43 $this->getNotes() |
|
44 ); |
|
45 return [ |
|
46 'ref-loc' => $this->getRefLoc(), |
|
47 'notes' => $notes |
|
48 ]; |
|
49 } |
|
50 |
|
51 } |