server/src/tests/Libraries/Mergers/CocoonSoundRdfMergerTest.php
author ymh <ymh.work@gmail.com>
Tue, 20 Mar 2018 15:02:40 +0100
changeset 573 25f3d28f51b2
parent 526 cdaf9dfb5dfd
permissions -rw-r--r--
Added tag 0.0.25 for changeset 190ae1dee68d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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\Mergers\CocoonSoundRdfMerger;
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 CocoonSoundRdfMergerTest 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 = [
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    18
        'BASE' => __DIR__.'/files/CocoonSoundRdfMergerTest/base_doc.ttl',
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    19
        'SOURCE' => __DIR__.'/files/CocoonSoundRdfMergerTest/source_doc.ttl',
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    20
        'BASE_NO_SPATIAL' => __DIR__.'/files/CocoonSoundRdfMergerTest/base_no_spatial.ttl',
170
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    21
        'SOURCE_NO_SPATIAL' => __DIR__.'/files/CocoonSoundRdfMergerTest/source_no_spatial.ttl',
526
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
    22
        'SOURCE_MORE_SPATIAL_NOTES' => __DIR__.'/files/CocoonSoundRdfMergerTest/source_more_spatial_notes.ttl',
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
    23
        'SOURCE_RIGHTS' => __DIR__.'/files/CocoonSoundRdfMergerTest/source_rights.ttl',
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
    ];
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
    const TEST_INPUT_ID = "crdo-ESLO1_ENT_019";
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
    27
    const TEST_GRAPH_URI = "http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ESLO1_ENT_019";
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
    const TEST_CHO_URI = "http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ESLO1_ENT_019";
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
    private $inputGraphes = [];
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
    private $resGraph;
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
    function __construct(string $name = null) {
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
        parent::__construct($name);
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
    }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
    public function setUp() {
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
        parent::setUp();
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
        foreach(CocoonSoundRdfMergerTest::TEST_INPUT_DOCS as $key => $inputDoc) {
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    42
            $this->inputGraphes[$key] = new Graph("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND", file_get_contents($inputDoc));
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
        }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
    }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
    public function tearDown() {
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
        parent::tearDown();
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
    }
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
     * 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
    53
     *
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
     * @return void
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
    public function testInit()
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
    {
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    58
        $merger = new CocoonSoundRdfMerger();
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    59
        $this->resGraph['NORMAL'] = $merger->mergeGraph($this->inputGraphes['BASE'], $this->inputGraphes['SOURCE']);
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    60
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
        $this->assertTrue(true);
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    62
        //echo $this->resGraph['NORMAL']->serialise('turtle');
18
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
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
    /**
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
     * test the result graph.
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
     *
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
     * @return void
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
     */
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
    public function testResGraph() {
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    71
        $merger = new CocoonSoundRdfMerger();
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    72
        $this->resGraph['NORMAL'] = $merger->mergeGraph($this->inputGraphes['BASE'], $this->inputGraphes['SOURCE']);
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    73
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    74
        $this->assertNotNull($this->resGraph['NORMAL'], "Res graph must not be null");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    75
        $this->assertEquals("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND", $this->resGraph['NORMAL']->getUri(), "graph uri must be equals to http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND");
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
    }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
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
     * test the merged Aggregation
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
     * @return void
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
    public function testAggregationResource() {
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    84
        $merger = new CocoonSoundRdfMerger();
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    85
        $this->resGraph['NORMAL'] = $merger->mergeGraph($this->inputGraphes['BASE'], $this->inputGraphes['SOURCE']);
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    86
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    87
        $aggregationResList = $this->resGraph['NORMAL']->allOfType('http://www.openarchives.org/ore/terms/Aggregation');
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
        $this->assertCount(1, $aggregationResList, "Only one Aggregation node");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
        $aggregationRes = $aggregationResList[0];
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
    91
        $this->assertEquals("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND",$aggregationRes->getUri(),"Aggregation node uri must be http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND");
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
        $singleValuesRes = [
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    94
            'http://www.europeana.eu/schemas/edm/aggregatedCHO' => ['size'=>1, 'val' => $this->resGraph['NORMAL']->resource("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND")],
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
            'http://www.europeana.eu/schemas/edm/provider' => ['size'=>1, 'val' => new Literal("Corpus de la Parole", "fr", null)],
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    96
            'http://www.europeana.eu/schemas/edm/dataProvider' => ['size'=>1, 'val' => $this->resGraph['NORMAL']->resource("http://viaf.org/viaf/142432638")],
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    97
            'http://www.europeana.eu/schemas/edm/isShownAt' => ['size'=>1, 'val' => $this->resGraph['NORMAL']->resource("http://corpusdelaparole.huma-num.fr/corpus-app#/detail/crdo-CFPP2000_35_SOUND")],
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    98
            'http://www.europeana.eu/schemas/edm/isShownBy' => ['size'=>1, 'val' => $this->resGraph['NORMAL']->resource("http://cocoon.huma-num.fr/data/archi/masters/372593.wav")],
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
    99
            'http://www.europeana.eu/schemas/edm/rights' => ['size'=>1, 'val' => $this->resGraph['NORMAL']->resource("http://creativecommons.org/licenses/by-nc-sa/4.0/")],
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
            'http://www.europeana.eu/schemas/edm/hasView' => ['size' => 4, 'val' => [
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   101
                $this->resGraph['NORMAL']->resource("http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.wav"),
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   102
                $this->resGraph['NORMAL']->resource("http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.mp3"),
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   103
                $this->resGraph['NORMAL']->resource("http://cocoon.huma-num.fr/exist/crdo/cfpp2000/fra/Ozgur_Kilic_H_32_alii_3e-2.xml"),
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   104
                $this->resGraph['NORMAL']->resource("http://cocoon.huma-num.fr/exist/crdo/cfpp2000/fra/Ozgur_Kilic_H_32_alii_3e-2.xhtml")
18
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
        ];
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
        foreach($singleValuesRes as $property => $resVal) {
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
            $resList = $aggregationRes->all($this->inputGraphes['BASE']->resource($property));
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
            $this->assertCount($resVal['size'], $resList, "$property list size $resVal[size]");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
            if($resVal['size'] == 1) {
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
                $this->assertEquals($resVal['val'], $resList[0], "$property size one not equals");
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
            else {
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
                $this->assertEquals($resVal['val'], $resList, "$property size more than one not equals");
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
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
    }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
    /**
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
     * test web resources
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
     *
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
     * @return void
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
     */
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
    public function testWebResources() {
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   127
        $merger = new CocoonSoundRdfMerger();
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   128
        $this->resGraph['NORMAL'] = $merger->mergeGraph($this->inputGraphes['BASE'], $this->inputGraphes['SOURCE']);
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   129
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   130
        $webResList = $this->resGraph['NORMAL']->allOfType('http://www.europeana.eu/schemas/edm/WebResource');
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
        $this->assertCount(5, $webResList, "Must have 5 webResource");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
    }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
    /**
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
    * Test one to one mapping spatial info
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
    *
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
    * @return void
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
    */
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   141
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
    public function testProvidedCHOSpatial() {
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   143
        $merger = new CocoonSoundRdfMerger();
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   144
        $this->resGraph['NORMAL'] = $merger->mergeGraph($this->inputGraphes['BASE'], $this->inputGraphes['SOURCE']);
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   145
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   146
        $providedCHO = $this->resGraph['NORMAL']->get('edm:ProvidedCHO', '^rdf:type');
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
        $this->assertNotNull($providedCHO);
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   150
        $spatials = $providedCHO->all($this->resGraph['NORMAL']->resource('http://purl.org/dc/terms/spatial'));
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
        $this->assertCount(1, $spatials, "Must have only one spatial node");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
        $spatial = $spatials[0];
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
        $this->assertTrue($spatial->isBNode(),"spatial node must be blank");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
        $this->assertEquals("edm:Place", $spatial->type(), "spatial node type must be edm:Place");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
        $lats = $spatial->all('geo:lat');
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
        $this->assertCount(1, $lats, "One latitude");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
        $this->assertInstanceOf("EasyRdf\Literal", $lats[0], "Latitude must be a litteral");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
        $this->assertEquals(Literal::create("48.83975", null, 'xsd:float'), $lats[0], "lat must be '48.83975'^^xsd:float");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
        $longs = $spatial->all('geo:long');
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
        $this->assertCount(1, $longs, "One longitude");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
        $this->assertInstanceOf("EasyRdf\Literal", $longs[0], "Longitude must be a litteral");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
        $this->assertEquals(Literal::create("2.3542", null, 'xsd:float'), $longs[0], "long must be '2.3542'^^xsd:float");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
        $notes = $spatial->all('skos:note');
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
        $this->assertCount(3, $notes, "3 notes");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
        $this->assertContainsOnlyInstancesOf("EasyRdf\Literal", $notes, "Notes mus be only literals");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
        $this->assertEquals(Literal::create("FR", null, "dc:ISO3166"), $notes[0], "notes contains 'FR'^^dc:ISO3166");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
        $this->assertEquals(Literal::create("France, Paris, Université Sorbonne Nouvelle Paris 3, site Censier", "fr", null), $notes[1], "notes contains 'France, Centre, Loiret, Orléans'@fr");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
        $this->assertEquals(Literal::create("Other place very important", "fr", null), $notes[2], "notes contains 'Other place very important'@fr");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
        $sameas = $spatial->all('owl:sameAs');
170
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   175
        $this->assertCount(2, $sameas, "2 same as");
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
        $this->assertContainsOnlyInstancesOf("EasyRdf\Resource", $sameas, "Notes mus be only resources");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
        $this->assertEquals('http://vocab.getty.edu/tgn/7008038', $sameas[0]->getUri(), "uri must be http://vocab.getty.edu/tgn/7008038");
170
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   178
        $this->assertEquals('http://vocab.getty.edu/tgn/1234567890', $sameas[1]->getUri(), "uri must be http://vocab.getty.edu/tgn/1234567890");
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
    }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   182
    public function testProvidedCHOSpatialNoSource() {
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   183
        $merger = new CocoonSoundRdfMerger();
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   184
        $this->resGraph['NO_SPATIAL_SRC'] = $merger->mergeGraph($this->inputGraphes['BASE'], $this->inputGraphes['SOURCE_NO_SPATIAL']);
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   185
        $providedCHO = $this->resGraph['NO_SPATIAL_SRC']->get('edm:ProvidedCHO', '^rdf:type');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   186
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   187
        //print($this->resGraph['NO_SPATIAL_SRC']->dump('ttl'));
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   188
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   189
        $this->assertNotNull($providedCHO);
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   190
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   191
        $spatials = $providedCHO->all($this->resGraph['NO_SPATIAL_SRC']->resource('http://purl.org/dc/terms/spatial'));
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   192
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   193
        $this->assertCount(1, $spatials, "Must have only one spatial node");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   194
        $spatial = $spatials[0];
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   195
        $this->assertTrue($spatial->isBNode(),"spatial node must be blank");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   196
        $this->assertEquals("edm:Place", $spatial->type(), "spatial node type must be edm:Place");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   197
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   198
        $lats = $spatial->all('geo:lat');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   199
        $this->assertCount(1, $lats, "One latitude");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   200
        $this->assertInstanceOf("EasyRdf\Literal", $lats[0], "Latitude must be a litteral");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   201
        $this->assertEquals(Literal::create("48.83975", null, 'xsd:float'), $lats[0], "lat must be '48.83975'^^xsd:float");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   202
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   203
        $longs = $spatial->all('geo:long');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   204
        $this->assertCount(1, $longs, "One longitude");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   205
        $this->assertInstanceOf("EasyRdf\Literal", $longs[0], "Longitude must be a litteral");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   206
        $this->assertEquals(Literal::create("2.3542", null, 'xsd:float'), $longs[0], "long must be '2.3542'^^xsd:float");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   207
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   208
        $notes = $spatial->all('skos:note');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   209
        $this->assertCount(2, $notes, "2 notes");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   210
        $this->assertContainsOnlyInstancesOf("EasyRdf\Literal", $notes, "Notes mus be only literals");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   211
        $this->assertEquals(Literal::create("FR", null, "dc:ISO3166"), $notes[0], "notes contains 'FR'^^dc:ISO3166");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   212
        $this->assertEquals(Literal::create("France, Paris, Université Sorbonne Nouvelle Paris 3, site Censier", "fr", null), $notes[1], "notes contains 'France, Centre, Loiret, Orléans'@fr");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   213
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   214
        $sameas = $spatial->all('owl:sameAs');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   215
        $this->assertCount(1, $sameas, "1 same as");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   216
        $this->assertContainsOnlyInstancesOf("EasyRdf\Resource", $sameas, "Notes mus be only resources");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   217
        $this->assertEquals('http://vocab.getty.edu/tgn/7008038', $sameas[0]->getUri(), "uri must be http://vocab.getty.edu/tgn/7008038");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   218
    }
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   219
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   220
    public function testProvidedCHOSpatialNoBase() {
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   221
        $merger = new CocoonSoundRdfMerger();
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   222
        $this->resGraph['NO_SPATIAL_BASE'] = $merger->mergeGraph($this->inputGraphes['BASE_NO_SPATIAL'], $this->inputGraphes['SOURCE']);
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   223
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   224
        $providedCHO = $this->resGraph['NO_SPATIAL_BASE']->get('edm:ProvidedCHO', '^rdf:type');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   225
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   226
        //print($this->resGraph['NO_SPATIAL_SRC']->dump('ttl'));
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   227
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   228
        $this->assertNotNull($providedCHO);
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   229
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   230
        $spatials = $providedCHO->all($this->resGraph['NO_SPATIAL_BASE']->resource('http://purl.org/dc/terms/spatial'));
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   231
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   232
        $this->assertCount(1, $spatials, "Must have only one spatial node");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   233
        $spatial = $spatials[0];
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   234
        $this->assertTrue($spatial->isBNode(),"spatial node must be blank");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   235
        $this->assertEquals("edm:Place", $spatial->type(), "spatial node type must be edm:Place");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   236
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   237
        $lats = $spatial->all('geo:lat');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   238
        $this->assertCount(1, $lats, "One latitude");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   239
        $this->assertInstanceOf("EasyRdf\Literal", $lats[0], "Latitude must be a litteral");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   240
        $this->assertEquals(Literal::create("99.83975", null, 'xsd:float'), $lats[0], "lat must be '99.83975'^^xsd:float");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   241
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   242
        $longs = $spatial->all('geo:long');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   243
        $this->assertCount(1, $longs, "One longitude");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   244
        $this->assertInstanceOf("EasyRdf\Literal", $longs[0], "Longitude must be a litteral");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   245
        $this->assertEquals(Literal::create("25.3542", null, 'xsd:float'), $longs[0], "long must be '25.3542'^^xsd:float");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   246
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   247
        $notes = $spatial->all('skos:note');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   248
        $this->assertCount(3, $notes, "3 notes");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   249
        $this->assertContainsOnlyInstancesOf("EasyRdf\Literal", $notes, "Notes mus be only literals");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   250
        $this->assertEquals(Literal::create("FR", null, "dc:ISO3166"), $notes[0], "notes contains 'FR'^^dc:ISO3166");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   251
        $this->assertEquals(Literal::create("France, Paris, Université Sorbonne Nouvelle Paris 3, site Censier", "fr", null), $notes[1], "notes contains 'France, Centre, Loiret, Orléans'@fr");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   252
        $this->assertEquals(Literal::create("Other place very important", "fr", null), $notes[2], "notes contains 'Other place very important'@fr");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   253
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   254
        $sameas = $spatial->all('owl:sameAs');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   255
        $this->assertCount(1, $sameas, "1 same as");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   256
        $this->assertContainsOnlyInstancesOf("EasyRdf\Resource", $sameas, "Notes mus be only resources");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   257
        $this->assertEquals('http://vocab.getty.edu/tgn/1234567890', $sameas[0]->getUri(), "uri must be http://vocab.getty.edu/tgn/1234567890");
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   258
    }
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   259
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   260
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
    /**
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
     * Test one to one mapping
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
     * @return void
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
    public function testProvidedCHOSingleproperty() {
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   267
        $merger = new CocoonSoundRdfMerger();
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   268
        $this->resGraph['NORMAL'] = $merger->mergeGraph($this->inputGraphes['BASE'], $this->inputGraphes['SOURCE']);
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   269
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   270
        $properties = [
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   271
            "http://purl.org/dc/elements/1.1/title",
122
b37fde30dd4a correct problem of identifier
ymh <ymh.work@gmail.com>
parents: 116
diff changeset
   272
            "http://purl.org/dc/elements/1.1/identifier",
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
            "http://purl.org/dc/terms/extent",
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
            "http://purl.org/dc/terms/available",
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   275
            "http://purl.org/dc/terms/created",
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
            "http://purl.org/dc/terms/issued"
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
        ];
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   278
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   279
        $providedCHO = $this->resGraph['NORMAL']->get('edm:ProvidedCHO', '^rdf:type');
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   280
        $baseNode = $this->inputGraphes['BASE']->get('edm:ProvidedCHO', '^rdf:type');
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   281
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
        $this->assertNotNull($providedCHO);
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   283
        $this->assertNotNull($baseNode);
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   284
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   285
        foreach ($properties as $prop) {
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   286
            $outputValuesStr = [];
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   287
            foreach($providedCHO->all($this->resGraph['NORMAL']->resource($prop)) as $outputValue) {
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   288
                array_push($outputValuesStr, strval($outputValue));
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   289
            }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   290
            $this->assertNotEmpty($outputValuesStr, "we must found some values to test $prop");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   291
            foreach ($baseNode->all($this->inputGraphes['BASE']->resource($prop)) as $value) {
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   292
                $this->assertContains(strval($value), $outputValuesStr, "$prop not found in output graph");
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   293
            }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
        }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   296
    }
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
116
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   298
    public function testRightsWebResource() {
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   299
        $merger = new CocoonSoundRdfMerger();
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   300
        $this->resGraph['NORMAL'] = $merger->mergeGraph($this->inputGraphes['BASE'], $this->inputGraphes['SOURCE']);
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   301
116
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   302
        $properties = [
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   303
            "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
   304
            'http://purl.org/dc/terms/license',
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   305
            'http://purl.org/dc/terms/accessRights',
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   306
        ];
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   307
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   308
        $webResourceList = $this->resGraph['NORMAL']->all('edm:WebResource', '^rdf:type');
116
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   309
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   310
        //just check that they have all these resources.
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   311
        //TODO: check that the same rights are kept (difficult)
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   312
        foreach ($webResourceList as $webResource) {
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   313
            foreach ($properties as $prop) {
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   314
                $outputValuesStr = [];
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 152
diff changeset
   315
                foreach($webResource->all($this->resGraph['NORMAL']->resource($prop)) as $outputValue) {
116
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   316
                    array_push($outputValuesStr, strval($outputValue));
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   317
                }
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   318
                $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
   319
            }
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   320
        }
e60c55988ed4 put right, access and licence info on webresource
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   321
    }
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   322
504
4ab820b387da Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents: 170
diff changeset
   323
    /**
526
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   324
     * Test rights merge
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   325
     *
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   326
     * @return void
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   327
     */
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   328
    public function testRightsDifferentsAggregatedCHO() {
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   329
        $merger = new CocoonSoundRdfMerger();
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   330
        $this->resGraph['NORMAL'] = $merger->mergeGraph($this->inputGraphes['BASE'], $this->inputGraphes['SOURCE_RIGHTS']);
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   331
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   332
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   333
        $aggregationResList = $this->resGraph['NORMAL']->allOfType('http://www.openarchives.org/ore/terms/Aggregation');
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   334
        $this->assertCount(1, $aggregationResList, "Only one Aggregation node");
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   335
        $aggregationRes = $aggregationResList[0];
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   336
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   337
        $resList = $aggregationRes->all($this->inputGraphes['BASE']->resource('http://www.europeana.eu/schemas/edm/rights'));
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   338
        $this->assertCount(1, $resList, "'http://www.europeana.eu/schemas/edm/rights' list size 1");
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   339
        $this->assertEquals($this->resGraph['NORMAL']->resource("http://creativecommons.org/licenses/by-nc-sa/4.0/"), $resList[0], "'http://www.europeana.eu/schemas/edm/rights' size one not equals");
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   340
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   341
    }
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   342
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   343
cdaf9dfb5dfd correct licence problem in bug #0026523
ymh <ymh.work@gmail.com>
parents: 504
diff changeset
   344
    /**
504
4ab820b387da Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents: 170
diff changeset
   345
     * Test one to one mapping spatial info
4ab820b387da Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents: 170
diff changeset
   346
     *
4ab820b387da Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents: 170
diff changeset
   347
     * @return void
4ab820b387da Correct the handling of created date. Should correct #0025744
ymh <ymh.work@gmail.com>
parents: 170
diff changeset
   348
     */
170
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   349
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   350
    public function testProvidedCHOSpatialMore() {
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   351
        $merger = new CocoonSoundRdfMerger();
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   352
        $this->resGraph['MORE_SPATIAL_NOTES'] = $merger->mergeGraph($this->inputGraphes['BASE'], $this->inputGraphes['SOURCE_MORE_SPATIAL_NOTES']);
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   353
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   354
        $providedCHO = $this->resGraph['MORE_SPATIAL_NOTES']->get('edm:ProvidedCHO', '^rdf:type');
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   355
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   356
        $this->assertNotNull($providedCHO);
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   357
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   358
        $spatials = $providedCHO->all($this->resGraph['MORE_SPATIAL_NOTES']->resource('http://purl.org/dc/terms/spatial'));
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   359
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   360
        $this->assertCount(1, $spatials, "Must have only one spatial node");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   361
        $spatial = $spatials[0];
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   362
        $this->assertTrue($spatial->isBNode(),"spatial node must be blank");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   363
        $this->assertEquals("edm:Place", $spatial->type(), "spatial node type must be edm:Place");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   364
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   365
        $lats = $spatial->all('geo:lat');
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   366
        $this->assertCount(1, $lats, "One latitude");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   367
        $this->assertInstanceOf("EasyRdf\Literal", $lats[0], "Latitude must be a litteral");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   368
        $this->assertEquals(Literal::create("48.83975", null, 'xsd:float'), $lats[0], "lat must be '48.83975'^^xsd:float");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   369
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   370
        $longs = $spatial->all('geo:long');
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   371
        $this->assertCount(1, $longs, "One longitude");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   372
        $this->assertInstanceOf("EasyRdf\Literal", $longs[0], "Longitude must be a litteral");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   373
        $this->assertEquals(Literal::create("2.3542", null, 'xsd:float'), $longs[0], "long must be '2.3542'^^xsd:float");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   374
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   375
        $notes = $spatial->all('skos:note');
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   376
        $this->assertCount(4, $notes, "4 notes");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   377
        $this->assertContainsOnlyInstancesOf("EasyRdf\Literal", $notes, "Notes must be only literals");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   378
        $this->assertEquals(Literal::create("FR", null, "dc:ISO3166"), $notes[0], "notes contains 'FR'^^dc:ISO3166");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   379
        $this->assertEquals(Literal::create("France, Paris, Université Sorbonne Nouvelle Paris 3, site Censier", "fr", null), $notes[1], "notes contains 'France, Centre, Loiret, Orléans'@fr");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   380
        $this->assertEquals(Literal::create("Other place very important", "en", null), $notes[2], "notes contains 'Other place very important'@en");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   381
        $this->assertEquals(Literal::create("Autre place importante", "fr", null), $notes[3], "notes contains 'Autre place importante'@fr");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   382
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   383
        $sameas = $spatial->all('owl:sameAs');
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   384
        $this->assertCount(2, $sameas, "2 same as");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   385
        $this->assertContainsOnlyInstancesOf("EasyRdf\Resource", $sameas, "Notes mus be only resources");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   386
        $this->assertEquals('http://vocab.getty.edu/tgn/7008038', $sameas[0]->getUri(), "uri must be http://vocab.getty.edu/tgn/7008038");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   387
        $this->assertEquals('http://vocab.getty.edu/tgn/1234567890', $sameas[1]->getUri(), "uri must be http://vocab.getty.edu/tgn/1234567890");
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   388
    }
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   389
31bee084df32 Documents cn have more than one spatial sameas property
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   390
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents:
diff changeset
   391
}