author | ymh <ymh.work@gmail.com> |
Tue, 17 Nov 2015 13:11:55 +0100 | |
changeset 18 | f2a40bbc27f6 |
parent 4 | f55970e41793 |
child 19 | eadaf0b8f02e |
permissions | -rw-r--r-- |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
<?php |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
namespace CorpusParole\Models; |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
use Config; |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
use CorpusParole\Libraries\Utils; |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
6 |
use CorpusParole\Libraries\CocoonUtils; |
3
2b3247d02769
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
7 |
use CorpusParole\Libraries\RdfModel\RdfModelResource; |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
8 |
use JsonSerializable; |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
use Log; |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
10 |
use EasyRdf\Literal; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
11 |
use EasyRdf\Resource; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
12 |
use EasyRdf\Graph; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
13 |
use EasyRdf\Isomorphic; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
14 |
|
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
/** |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
17 |
* Model class for Document. Inherit from EasyRd\Resource |
3
2b3247d02769
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
18 |
* SELECT DISTINCT ?g WHERE {GRAPH ?g {?s ?p ?o}} |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
*/ |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
20 |
class Document extends RdfModelResource implements JsonSerializable { |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
public function __construct($uri, $graph = null) { |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
23 |
parent::__construct($uri, $graph); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
private $id = null; |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
public function getId() { |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
if(is_null($this->id)) { |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
30 |
$this->id = CocoonUtils::getIdFromUri($this->uri); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
return $this->id; |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
33 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
34 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
35 |
public function getTitle() { |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
36 |
try { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
37 |
return $this->getLiteral('<http://purl.org/dc/elements/1.1/title>'); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
38 |
} catch(\Exception $e) { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
39 |
return null; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
40 |
} |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
41 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
public function getPublishers() { |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
44 |
try { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
45 |
return $this->allLiterals('dc11:publisher'); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
46 |
} catch(\Exception $e) { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
47 |
return []; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
48 |
} |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
49 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
51 |
public function getMediaArray() { |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
53 |
//TODO: add media type |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
54 |
$res = []; |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
55 |
$formats = []; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
56 |
try { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
57 |
$formats = $this->allResources("dc:isFormatOf"); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
58 |
} catch(\Exception $e) { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
59 |
// do nothing |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
60 |
} |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
61 |
foreach ($formats as $f) { |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
62 |
$uri = $f->getUri(); |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
63 |
$mimetype = Utils::getMimetype($uri); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
64 |
array_push($res, ["url" => $uri, "format" => $mimetype]); |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
65 |
} |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
66 |
|
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
67 |
$format = null; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
68 |
try { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
69 |
$format = $this->getLiteral('dc11:format'); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
70 |
} catch(\Exception $e) { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
71 |
// do nothing |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
72 |
} |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
73 |
array_push($res, ["url" => $this->getUri(), "format" => $format]); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
74 |
return $res; |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
75 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
76 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
77 |
public function getTypes() { |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
78 |
return $this->all('dc11:type'); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
79 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
80 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
81 |
public function getDiscourseTypes() { |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
82 |
return array_values(array_filter($this->getTypes(), function($v) { |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
83 |
return $v instanceof Literal && $v->getDatatypeUri() === Config::get('constants.OLAC_DISCOURSE_TYPE')['uri']; |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
84 |
})); |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
85 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
86 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
87 |
public function getOtherTypes() { |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
88 |
$res = array_values(array_filter($this->getTypes(), function($v) { |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
89 |
return $v instanceof Resource || $v->getDatatypeUri() !== Config::get('constants.OLAC_DISCOURSE_TYPE')['uri']; |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
90 |
})); |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
91 |
return $res; |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
92 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
93 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
94 |
public function updateDiscourseTypes(array $discoursesTypes) { |
3
2b3247d02769
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
95 |
|
2b3247d02769
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
96 |
$this->startDelta(); |
2b3247d02769
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
97 |
|
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
98 |
foreach($this->getDiscourseTypes() as $discourseType) { |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
99 |
$this->delete('dc11:type', $discourseType); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
100 |
$this->currentDelta->getDeletedGraph()->add($this, 'dc11:type', new Literal($discourseType, null, Config::get('constants.OLAC_DISCOURSE_TYPE')['uri'])); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
101 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
102 |
// re-add them |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
103 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
104 |
foreach($discoursesTypes as $dType) { |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
105 |
$this->add('dc11:type', new Literal($dType, null, Config::get('constants.OLAC_DISCOURSE_TYPE')['uri'])); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
106 |
$this->currentDelta->getAddedGraph()->add($this, 'dc11:type', new Literal($dType, null, Config::get('constants.OLAC_DISCOURSE_TYPE')['uri'])); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
107 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
108 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
109 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
110 |
public function isIsomorphic($doc) { |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
111 |
return Isomorphic::isomorphic($this->graph, $doc->graph); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
112 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
113 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
114 |
/* |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
115 |
* Clone document. |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
116 |
* clone also the innerDocumenent |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
117 |
*/ |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
118 |
public function __clone() { |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
119 |
|
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
120 |
$this->graph = new Graph($this->graph->getUri(), $this->graph->toRdfPhp()); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
121 |
} |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
122 |
|
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
123 |
public function jsonSerialize() { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
124 |
if(!$this->graph) { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
125 |
return [ |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
126 |
'id' => $this->getId(), |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
127 |
]; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
128 |
} else { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
129 |
$mediaArray = array_map( |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
130 |
function($m) { |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
131 |
$f = Utils::processLiteralOrString($m['format']); |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
132 |
return ['url' => $m['url'], 'format' => $f];}, |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
133 |
$this->getMediaArray() |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
134 |
); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
135 |
|
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
136 |
$publishers = array_map( |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
137 |
function($v) { return Utils::processLiteralOrString($v); }, |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
138 |
$this->getPublishers() |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
139 |
); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
140 |
|
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
141 |
return [ |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
142 |
'id' => $this->getId(), |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
143 |
'uri' => $this->getUri(), |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
144 |
'title' => $this->getTitle()->getValue(), |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
145 |
'publishers' => $publishers, |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
146 |
'mediaArray'=> $mediaArray |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
147 |
]; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
148 |
} |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
149 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
150 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
151 |
} |