|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the sweetrdf/InMemoryStoreSqlite package and licensed under |
|
5
|
|
|
* the terms of the GPL-3 license. |
|
6
|
|
|
* |
|
7
|
|
|
* (c) Konrad Abicht <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
10
|
|
|
* file that was distributed with this source code. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Tests\Integration\Store\QueryHandler; |
|
14
|
|
|
|
|
15
|
|
|
use sweetrdf\InMemoryStoreSqlite\Log\Logger; |
|
16
|
|
|
use sweetrdf\InMemoryStoreSqlite\Store\InMemoryStoreSqlite; |
|
17
|
|
|
use sweetrdf\InMemoryStoreSqlite\Store\QueryHandler\InsertQueryHandler; |
|
18
|
|
|
use Tests\TestCase; |
|
19
|
|
|
|
|
20
|
|
|
class InsertIntoQueryHandlerTest extends TestCase |
|
21
|
|
|
{ |
|
22
|
|
|
private function getSubjectUnderTest(): InsertQueryHandler |
|
23
|
|
|
{ |
|
24
|
|
|
/** @var \sweetrdf\InMemoryStoreSqlite\Log\Logger */ |
|
25
|
|
|
$logger = $this->getMockBuilder(Logger::class)->disableOriginalConstructor()->getMock(); |
|
26
|
|
|
|
|
27
|
|
|
return new InsertQueryHandler(InMemoryStoreSqlite::createInstance(), $logger); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function test1() |
|
31
|
|
|
{ |
|
32
|
|
|
$sut = $this->getSubjectUnderTest(); |
|
33
|
|
|
$graphIri = 'http://test/'; |
|
34
|
|
|
|
|
35
|
|
|
$sut->runQuery([ |
|
36
|
|
|
'query' => [ |
|
37
|
|
|
'construct_triples' => [ |
|
38
|
|
|
[ |
|
39
|
|
|
's' => 'http://www.w3.org/2009/manifest#agg05', |
|
40
|
|
|
's_type' => 'uri', |
|
41
|
|
|
'p' => 'http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#action', |
|
42
|
|
|
'o' => '_:28848a60b33', |
|
43
|
|
|
'o_type' => 'bnode', |
|
44
|
|
|
'o_datatype' => '', |
|
45
|
|
|
'o_lang' => '', |
|
46
|
|
|
], |
|
47
|
|
|
[ |
|
48
|
|
|
's' => '_:28848a60b33', |
|
49
|
|
|
's_type' => 'bnode', |
|
50
|
|
|
'p' => 'http://www.w3.org/2001/sw/DataAccess/tests/test-query#query', |
|
51
|
|
|
'o' => 'file:///var/www/html/in-memory-store-sqlite/tests/aggregates/agg05.rq', |
|
52
|
|
|
'o_type' => 'uri', |
|
53
|
|
|
'o_datatype' => '', |
|
54
|
|
|
'o_lang' => '', |
|
55
|
|
|
], |
|
56
|
|
|
], |
|
57
|
|
|
'target_graph' => $graphIri, |
|
58
|
|
|
], |
|
59
|
|
|
]); |
|
60
|
|
|
|
|
61
|
|
|
$query = 'SELECT * FROM <'.$graphIri.'> WHERE { ?s ?p ?o }'; |
|
62
|
|
|
$result = $sut->getStore()->query($query); |
|
63
|
|
|
$this->assertCount(2, $result); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|