Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
6.67% |
1 / 15 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| NewSqlOntology | |
6.67% |
1 / 15 |
|
50.00% |
1 / 2 |
5.25 | |
0.00% |
0 / 1 |
| getRdfInterface | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| provideSchema | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2020 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * @license GPLv2 |
| 21 | */ |
| 22 | |
| 23 | namespace oat\generis\model\kernel\persistence\newsql; |
| 24 | |
| 25 | use core_kernel_persistence_smoothsql_SmoothModel; |
| 26 | use oat\generis\persistence\sql\SchemaCollection; |
| 27 | |
| 28 | /** |
| 29 | * Abstraction for the new sql compatible ontology |
| 30 | */ |
| 31 | class NewSqlOntology extends core_kernel_persistence_smoothsql_SmoothModel |
| 32 | { |
| 33 | /** |
| 34 | * {@inheritDoc} |
| 35 | * @see core_kernel_persistence_smoothsql_SmoothModel::getRdfInterface() |
| 36 | */ |
| 37 | public function getRdfInterface() |
| 38 | { |
| 39 | return new NewSqlRdf($this); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * {@inheritDoc} |
| 44 | * @see core_kernel_persistence_smoothsql_SmoothModel::provideSchema() |
| 45 | */ |
| 46 | public function provideSchema(SchemaCollection $schemaCollection) |
| 47 | { |
| 48 | $schema = $schemaCollection->getSchema($this->getOption(self::OPTION_PERSISTENCE)); |
| 49 | $table = $schema->createTable("statements"); |
| 50 | $table->addColumn("id", "string", ["notnull" => true]); |
| 51 | |
| 52 | $table->addColumn("modelid", "integer", ["notnull" => true, "default" => 0]); |
| 53 | $table->addColumn("subject", "string", ["length" => 255, "default" => null]); |
| 54 | $table->addColumn("predicate", "string", ["length" => 255, "default" => null]); |
| 55 | $table->addColumn("object", "text", ["default" => null, "notnull" => false]); |
| 56 | |
| 57 | $table->addColumn("l_language", "string", ["length" => 255, "default" => null, "notnull" => false]); |
| 58 | |
| 59 | $table->addColumn("author", "string", ["length" => 255, "default" => null, "notnull" => false]); |
| 60 | $table->setPrimaryKey(["id"]); |
| 61 | $table->addOption('engine', 'MyISAM'); |
| 62 | $table->addColumn("epoch", "string", ["notnull" => null]); |
| 63 | |
| 64 | $table->addIndex(["subject", "predicate"], "k_sp", [], ['lengths' => [164, 164]]); |
| 65 | $table->addIndex(["predicate", "object"], "k_po", [], ['lengths' => [164, 164]]); |
| 66 | } |
| 67 | } |