author | ymh <ymh.work@gmail.com> |
Thu, 09 Feb 2017 15:05:36 +0100 | |
changeset 504 | 4ab820b387da |
parent 152 | dd6b3adde73b |
permissions | -rw-r--r-- |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
<?php |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
use CorpusParole\Libraries\Mappers\CocoonTextRdfMapper; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
use CorpusParole\Libraries\CocoonUtils; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
use EasyRdf\Graph; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
use EasyRdf\Resource; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
use EasyRdf\Literal; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
use Illuminate\Foundation\Testing\WithoutMiddleware; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
use Illuminate\Foundation\Testing\DatabaseMigrations; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
use Illuminate\Foundation\Testing\DatabaseTransactions; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
class CocoonTextRdfMapperTest extends TestCase |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
{ |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
const TEST_INPUT_DOCS = [ |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
'BASE' => <<<EOT |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
@prefix owl: <http://www.w3.org/2002/07/owl#> . |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
@prefix fn: <http://www.w3.org/2005/xpath-functions#> . |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
@prefix sesame: <http://www.openrdf.org/schema/sesame#> . |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
@prefix v: <http://rdf.data-vocabulary.org/#> . |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
<http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-UVE_MOCIKA> a <http://crdo.risc.cnrs.fr/schemas/Resource> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
<http://purl.org/dc/elements/1.1/description> "Voilà pourquoi le bernard-l'hermite, aujourd'hui, se cache dans les coquilles vides qu'il trouve, alors que le crabe de cocotier n'a pas honte de se promener tout nu."@fr ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
<http://purl.org/dc/elements/1.1/format> "text/xml"^^<http://purl.org/dc/terms/IMT> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
<http://purl.org/dc/elements/1.1/type> "primary_text"^^<http://www.language-archives.org/OLAC/1.1/linguistic-type> , <http://purl.org/dc/dcmitype/Text> , "narrative"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
<http://purl.org/dc/elements/1.1/subject> <http://lexvo.org/id/iso639-3/uve> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
<http://purl.org/dc/elements/1.1/language> <http://lexvo.org/id/iso639-3/uve> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
<http://www.language-archives.org/OLAC/1.1/depositor> <http://viaf.org/viaf/56614135> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
33 |
<http://purl.org/dc/elements/1.1/publisher> <http://viaf.org/viaf/154919513> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
34 |
<http://purl.org/dc/elements/1.1/rights> "Copyright (c) Moyse-Faurie, Claire" ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
35 |
<http://purl.org/dc/elements/1.1/title> "The two hermit crabs and the coconut crab"@en ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
36 |
<http://purl.org/dc/terms/isFormatOf> <http://cocoon.huma-num.fr/exist/crdo/moyse-faurie/uve/crdo-UVE_MOCIKA.xml> , <http://cocoon.huma-num.fr/exist/crdo/moyse-faurie/uve/crdo-UVE_MOCIKA.xhtml> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
37 |
<http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
38 |
<http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/2.5/> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
39 |
<http://purl.org/dc/terms/isPartOf> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LANGUESDEFRANCE> , <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LACITO> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
40 |
<http://purl.org/dc/terms/spatial> "NC"^^<http://purl.org/dc/terms/ISO3166> , "New Caledonia, Ohnyat (Ouvéa)" ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
41 |
<http://purl.org/dc/terms/available> "2011-02-05"^^<http://purl.org/dc/terms/W3CDTF> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
<http://purl.org/dc/terms/issued> "2011-02-05T23:22:23+01:00"^^<http://purl.org/dc/terms/W3CDTF> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
<http://www.language-archives.org/OLAC/1.1/speaker> "Idakote, Félicien" ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
44 |
<http://purl.org/dc/terms/requires> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-UVE_MOCIKA_SOUND> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
45 |
<http://purl.org/dc/terms/alternative> "Les deux bernard-l'hermite et le crabe de cocotier"@fr ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
46 |
<http://www.language-archives.org/OLAC/1.1/researcher> "Moyse-Faurie, Claire" ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
47 |
<http://purl.org/dc/terms/modified> "2002-02-20"^^<http://purl.org/dc/terms/W3CDTF> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
48 |
<http://purl.org/dc/terms/conformsTo> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_archive> . |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
49 |
EOT |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
]; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
51 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
const TEST_INPUT_ID = "crdo-UVE_MOCIKA_SOUND"; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
53 |
const TEST_CHO_URI = "http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-UVE_MOCIKA_SOUND"; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
54 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
55 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
56 |
private $inputGraphes = []; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
57 |
private $resGraphes = []; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
58 |
private $mappers = []; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
59 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
60 |
function __construct(string $name = null) { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
61 |
parent::__construct($name); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
62 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
63 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
64 |
public function setUp() { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
65 |
parent::setUp(); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
66 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
125
diff
changeset
|
67 |
$this->testGraphUri = config('corpusparole.corpus_doc_id_base_uri').CocoonTextRdfMapperTest::TEST_INPUT_ID; |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
68 |
foreach(CocoonTextRdfMapperTest::TEST_INPUT_DOCS as $key => $inputDoc) { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
69 |
$this->inputGraphes[$key] = new Graph("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-UVE_MOCIKA", $inputDoc); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
70 |
$this->mappers[$key] = new CocoonTextRdfMapper($this->inputGraphes[$key]); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
71 |
$this->mappers[$key]->mapGraph(); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
72 |
$this->resGraphes[$key] = $this->mappers[$key]->getOutputGraphes()["http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-UVE_MOCIKA_SOUND"]; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
73 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
74 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
75 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
76 |
public function tearDown() { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
77 |
parent::tearDown(); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
78 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
79 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
80 |
/** |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
81 |
* Just test that the construct and setup are ok |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
82 |
* |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
83 |
* @return void |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
84 |
*/ |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
85 |
public function testInit() |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
86 |
{ |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
87 |
$this->assertTrue(true); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
88 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
89 |
|
115 | 90 |
|
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
91 |
/** |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
92 |
* Test that the returned graph has the same uri that the original. |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
93 |
* |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
94 |
* @return void |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
95 |
*/ |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
96 |
public function testUri() { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
97 |
|
114
8af5ed0521a2
Correct modified value for SOUND when merging. This comes not from TEXT
ymh <ymh.work@gmail.com>
parents:
112
diff
changeset
|
98 |
//echo $this->resGraphes['BASE']->serialise('turtle'); |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
99 |
//echo var_export($this->resGraphes['BASE']->toRdfPhp()); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
100 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
101 |
$this->assertNotNull($this->resGraphes['BASE']); |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
125
diff
changeset
|
102 |
$this->assertEquals($this->testGraphUri, $this->resGraphes['BASE']->getUri(), "URIS must be translated"); |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
103 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
104 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
105 |
/** |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
106 |
* Test that the return graph has one ore:Aggregation resource |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
107 |
* |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
108 |
* @return void |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
109 |
*/ |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
110 |
public function testAggregationResource() { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
111 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
112 |
$resources = $this->resGraphes['BASE']->allOfType('ore:Aggregation'); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
113 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
114 |
$this->assertCount(1, $resources, "Must found only one resources of type ore:Aggregation"); |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
125
diff
changeset
|
115 |
$this->assertEquals($this->testGraphUri,$resources[0]->getUri()); |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
116 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
117 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
118 |
/** |
115 | 119 |
* Test providedCHO identifier. |
120 |
* |
|
121 |
* @return void |
|
122 |
*/ |
|
123 |
public function testProvidedChoId() { |
|
124 |
$resources = $this->resGraphes['BASE']->allOfType('edm:ProvidedCHO'); |
|
125 |
||
126 |
$this->assertCount(1, $resources, "Must found only one resources of type edm:ProvidedCHO"); |
|
127 |
$providedCHO = $resources[0]; |
|
128 |
||
122 | 129 |
$identifier = $providedCHO->getLiteral('<http://purl.org/dc/elements/1.1/identifier>'); |
115 | 130 |
|
131 |
$this->assertInstanceOf('EasyRdf\Literal', $identifier, "identifier value must be a literal"); |
|
122 | 132 |
$this->assertEquals(config('corpusparole.corpus_id_scheme') . CocoonTextRdfMapperTest::TEST_INPUT_ID, $identifier->getValue(), "Value must be equals to ".config('corpusparole.corpus_id_scheme').CocoonTextRdfMapperTest::TEST_INPUT_ID); |
115 | 133 |
|
134 |
} |
|
135 |
||
116
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
136 |
public function testRightsWebResourceIdentity() { |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
137 |
$properties = [ |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
138 |
"http://purl.org/dc/elements/1.1/rights", |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
139 |
'http://purl.org/dc/terms/license', |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
140 |
]; |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
141 |
|
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
142 |
$webResourceList = $this->resGraphes['BASE']->all('edm:WebResource', '^rdf:type'); |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
143 |
$sourceNode = $this->inputGraphes['BASE']->get('http://crdo.risc.cnrs.fr/schemas/Resource', '^rdf:type'); |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
144 |
|
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
145 |
foreach ($webResourceList as $webResource) { |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
146 |
foreach ($properties as $prop) { |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
147 |
$outputValuesStr = []; |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
148 |
foreach($webResource->all($this->resGraphes['BASE']->resource($prop)) as $outputValue) { |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
149 |
array_push($outputValuesStr, strval($outputValue)); |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
150 |
} |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
151 |
$this->assertNotEmpty($outputValuesStr, "we must found some values to test $prop"); |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
152 |
foreach ($sourceNode->all($this->inputGraphes['BASE']->resource($prop)) as $value) { |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
153 |
$this->assertContains(strval($value), $outputValuesStr, "$prop not found in output graph"); |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
154 |
} |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
155 |
} |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
156 |
} |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
157 |
} |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
158 |
|
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
159 |
public function testRightsWebResourceTrim() { |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
160 |
$properties = [ |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
161 |
'http://purl.org/dc/terms/accessRights', |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
162 |
]; |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
163 |
|
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
164 |
$webResourceList = $this->resGraphes['BASE']->all('edm:WebResource', '^rdf:type'); |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
165 |
$sourceNode = $this->inputGraphes['BASE']->get('http://crdo.risc.cnrs.fr/schemas/Resource', '^rdf:type'); |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
166 |
|
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
167 |
foreach ($webResourceList as $webResource) { |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
168 |
foreach ($properties as $prop) { |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
169 |
$outputValuesStr = []; |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
170 |
foreach($webResource->all($this->resGraphes['BASE']->resource($prop)) as $outputValue) { |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
171 |
array_push($outputValuesStr, strval($outputValue)); |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
172 |
} |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
173 |
$this->assertNotEmpty($outputValuesStr, "we must found some values to test $prop"); |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
174 |
foreach ($sourceNode->all($this->inputGraphes['BASE']->resource($prop)) as $value) { |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
175 |
$this->assertContains(trim(strval($value)), $outputValuesStr, "$prop not found in output graph"); |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
176 |
} |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
177 |
} |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
178 |
} |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
179 |
} |
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
180 |
|
e60c55988ed4
put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents:
115
diff
changeset
|
181 |
|
115 | 182 |
/** |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
183 |
* Test providedCHO uri. |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
184 |
* |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
185 |
* @return void |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
186 |
*/ |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
187 |
public function testProvidedChoURI() { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
188 |
$resources = $this->resGraphes['BASE']->allOfType('edm:ProvidedCHO'); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
189 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
190 |
$this->assertCount(1, $resources, "Must found only one resources of type edm:ProvidedCHO"); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
191 |
$this->assertEquals(CocoonTextRdfMapperTest::TEST_CHO_URI,$resources[0]->getUri()); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
192 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
193 |
|
115 | 194 |
|
195 |
||
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
196 |
/** |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
197 |
* Test that the returned graph does not have a http://purl.org/dc/dcmitype/Sound type |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
198 |
* |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
199 |
* @return void |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
200 |
*/ |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
201 |
public function testType() { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
202 |
//"primary_text"^^<http://www.language-archives.org/OLAC/1.1/linguistic-type> , <http://purl.org/dc/dcmitype/Text> , "narrative"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
203 |
$providedCHO = $this->resGraphes['BASE']->get('edm:ProvidedCHO', '^rdf:type'); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
204 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
205 |
$this->assertNotNull($providedCHO); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
206 |
|
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
207 |
$this->assertcount(3, $providedCHO->all($this->resGraphes['BASE']->resource('http://purl.org/dc/elements/1.1/type')), 'but should find 2 literals'); |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
208 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
209 |
$dcTypeList = $providedCHO->all($this->resGraphes['BASE']->resource('http://purl.org/dc/elements/1.1/type')); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
210 |
foreach ($dcTypeList as $dcType) { |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
211 |
$this->assertThat( |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
212 |
$dcType, |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
213 |
$this->logicalXor( |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
214 |
$this->isInstanceOf(EasyRdf\Literal::class), |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
215 |
$this->isInstanceOf(EasyRdf\Resource::class) |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
216 |
) |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
217 |
); |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
218 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
219 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
220 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
221 |
/** |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
222 |
* Test that the web resources |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
223 |
* |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
224 |
* @return void |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
225 |
*/ |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
226 |
public function testWebResources() { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
227 |
|
111
af85c436048f
change edm:WebResources to edm:WebResources
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
228 |
$resources = $this->resGraphes['BASE']->allOfType('edm:WebResource'); |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
229 |
|
111
af85c436048f
change edm:WebResources to edm:WebResources
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
230 |
$this->assertCount(2, $resources, "Must found three webresource"); |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
231 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
125
diff
changeset
|
232 |
$aggregation = $this->resGraphes['BASE']->resource($this->testGraphUri); |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
233 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
234 |
foreach ($resources as $wres) { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
235 |
$mimetypes = $wres->all($this->resGraphes['BASE']->resource('http://purl.org/dc/elements/1.1/format')); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
236 |
$this->assertCount(1, $mimetypes, "Must find one mimetype."); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
237 |
$mimetype = $mimetypes[0]; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
238 |
$this->assertInstanceOf("EasyRdf\Literal", $mimetype, "mimetype must be literal"); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
239 |
$this->assertEquals("dc:IMT",$mimetype->getDatatype()); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
240 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
241 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
242 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
243 |
/** |
125 | 244 |
* Test that the web resources has good date |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
245 |
* |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
246 |
* @return void |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
247 |
*/ |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
248 |
public function testWebResourcesDate() { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
249 |
|
111
af85c436048f
change edm:WebResources to edm:WebResources
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
250 |
$resources = $this->resGraphes['BASE']->allOfType('edm:WebResource'); |
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
251 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
252 |
foreach ($resources as $wres) { |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
253 |
$this->assertFalse($wres->hasProperty("http://purl.org/dc/terms/available"),"web resource must not have http://purl.org/dc/terms/available"); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
254 |
$this->assertFalse($wres->hasProperty("http://purl.org/dc/terms/modified"),"web resource must not have http://purl.org/dc/terms/modified"); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
255 |
$this->assertTrue($wres->hasProperty("http://purl.org/dc/terms/issued"), "Must have http://purl.org/dc/terms/issued"); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
256 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
257 |
$issued = $wres->getLiteral('dc:issued'); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
258 |
//<http://purl.org/dc/terms/issued> "2014-12-05T15:00:19+01:00"^^<http://purl.org/dc/terms/W3CDTF> ; |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
259 |
$this->assertInstanceOf('EasyRdf\Literal', $issued, "issued value must be a literal"); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
260 |
$this->assertEquals('http://purl.org/dc/terms/W3CDTF', $issued->getDatatypeUri(), "issued datatype uri must be a http://purl.org/dc/terms/W3CDTF"); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
261 |
$this->assertEquals('2011-02-05T23:22:23+01:00', $issued->getValue(), "Value must be 2014-12-05T15:00:19+01:00"); |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
262 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
263 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
264 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
265 |
} |
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
266 |
|
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
267 |
|
125 | 268 |
/** |
269 |
* Test that the web resources as conformsTo property |
|
270 |
* |
|
271 |
* @return void |
|
272 |
*/ |
|
273 |
public function testWebResourcesConformsTo() { |
|
274 |
||
275 |
$resources = $this->resGraphes['BASE']->allOfType('edm:WebResource'); |
|
276 |
foreach ($resources as $wres) { |
|
277 |
||
278 |
$mimetypes = $wres->all($this->resGraphes['BASE']->resource('http://purl.org/dc/elements/1.1/format')); |
|
279 |
$mimetype = $mimetypes[0]->getValue(); |
|
280 |
if($mimetype !== 'application/xml') { |
|
281 |
continue; |
|
282 |
} |
|
283 |
$conformsTo = $wres->get('<http://purl.org/dc/terms/conformsTo>'); |
|
284 |
$this->assertNotNull($conformsTo, "Must have a conformsTo node"); |
|
285 |
$this->assertInstanceOf('EasyRdf\Resource', $conformsTo, "Must be a resource"); |
|
286 |
$this->assertEquals("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_archive", $conformsTo->getUri(), "Must be http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_archive"); |
|
287 |
} |
|
288 |
} |
|
289 |
||
504
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
290 |
/** |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
291 |
* Test date info to providedCHO is not mapped |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
292 |
* |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
293 |
* @return void |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
294 |
*/ |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
295 |
public function testProvidedCHODateNotMapped() { |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
296 |
|
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
297 |
$properties = [ |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
298 |
'http://purl.org/dc/terms/available', |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
299 |
'http://purl.org/dc/terms/created', |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
300 |
'http://purl.org/dc/terms/issued', |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
301 |
'http://purl.org/dc/terms/modified', |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
302 |
]; |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
303 |
|
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
304 |
$providedCHO = $this->resGraphes['BASE']->get('edm:ProvidedCHO', '^rdf:type'); |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
305 |
$sourceNode = $this->inputGraphes['BASE']->get('http://crdo.risc.cnrs.fr/schemas/Resource', '^rdf:type'); |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
306 |
|
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
307 |
$this->assertNotNull($providedCHO); |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
308 |
$this->assertNotNull($sourceNode); |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
309 |
|
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
310 |
foreach ($properties as $prop) { |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
311 |
$outputValuesStr = []; |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
312 |
$this->assertEmpty($providedCHO->all($this->resGraphes['BASE']->resource($prop)), "Date info $prop must be empty"); |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
313 |
} |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
314 |
|
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
315 |
} |
4ab820b387da
Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
316 |
|
125 | 317 |
|
18
f2a40bbc27f6
add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
318 |
} |