--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/app/Models/GeoResource.php Sun Jun 05 00:28:45 2016 +0200
@@ -0,0 +1,51 @@
+<?php
+namespace CorpusParole\Models;
+
+use CorpusParole\Libraries\RdfModel\RdfModelResource;
+use CorpusParole\Libraries\Utils;
+use JsonSerializable;
+use Log;
+
+/**
+ */
+class GeoResource extends RdfModelResource implements JsonSerializable {
+
+ public function __construct($uri, $graph) {
+ parent::__construct($uri, $graph);
+ }
+
+ private $refLoc = false;
+ private $notes = null;
+
+ public function clearMemoizationCache() {
+ $this->refLoc = false;
+ $this->notes = null;
+ }
+
+ public function getRefLoc() {
+ if($this->refLoc === false) {
+ $refLoc = $this->getResource("<http://www.w3.org/2002/07/owl#sameAs>");
+ $this->refLoc = is_null($refLoc)?null:$refLoc->getUri();
+ }
+ return $this->refLoc;
+ }
+
+ public function getNotes() {
+ if(is_null($this->notes)) {
+ $this->notes = $this->all('<http://www.w3.org/2004/02/skos/core#note>');
+ }
+ return $this->notes;
+ }
+
+ public function jsonSerialize() {
+ $notes = array_map(
+ function($note) { return Utils::processLiteralResourceOrString($note); },
+ $this->getNotes()
+ );
+ return [
+ 'ref-loc' => $this->getRefLoc(),
+ 'notes' => $notes
+ ];
+ }
+
+}
\ No newline at end of file