diff --git a/core/kernel/persistence/starsql/class.StarIterator.php b/core/kernel/persistence/starsql/class.StarIterator.php index b96401296..77255440c 100644 --- a/core/kernel/persistence/starsql/class.StarIterator.php +++ b/core/kernel/persistence/starsql/class.StarIterator.php @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) 2014 Open Assessment Technologies SA + * Copyright (c) 2023 (original work) Open Assessment Technologies SA * */ @@ -26,8 +26,6 @@ /** * Iterator over all triples * - * @author joel bout - * @package generis */ class core_kernel_persistence_starsql_StarIterator extends \IteratorIterator implements \RecursiveIterator { diff --git a/core/kernel/persistence/starsql/class.StarRdf.php b/core/kernel/persistence/starsql/class.StarRdf.php index bd0443edc..1ac072b17 100644 --- a/core/kernel/persistence/starsql/class.StarRdf.php +++ b/core/kernel/persistence/starsql/class.StarRdf.php @@ -152,8 +152,10 @@ private function createSystemTripleQuery(iterable $tripleList): ?Statement $query = Query::new()->match($systemNode) ->where($systemNode->property('uri')->in(array_keys($systemSubjectList))) ->set($systemNode->labeled('System')); + + $query = Statement::create($query->build()); } - return Statement::create($query->build()); + return $query; } } diff --git a/test/unit/core/data/import/RdfImportTest.php b/test/unit/core/data/import/RdfImportTest.php index 8bf6bec64..23411f520 100644 --- a/test/unit/core/data/import/RdfImportTest.php +++ b/test/unit/core/data/import/RdfImportTest.php @@ -34,8 +34,8 @@ class RdfImportTest extends GenerisTestCase public function testRdfTripleImport(Ontology $ontology) { $this->assertEquals(0, $this->getTripleCount($ontology)); - $triple1 = core_kernel_classes_Triple::createTriple(0, 'subject', 'predicate', 'object'); - $triple2 = core_kernel_classes_Triple::createTriple(0, 'subject', 'predicate', 'object2'); + $triple1 = core_kernel_classes_Triple::createTriple(2, 'subject', 'predicate', 'object'); + $triple2 = core_kernel_classes_Triple::createTriple(2, 'subject', 'predicate', 'object2'); $importer = new RdfImporter(); $importer->setServiceLocator($ontology->getServiceLocator()); $importer->importTriples([$triple1, $triple2]); diff --git a/test/unit/core/kernel/persistence/OntologyRdfTest.php b/test/unit/core/kernel/persistence/OntologyRdfTest.php index f7ef03104..615af062b 100644 --- a/test/unit/core/kernel/persistence/OntologyRdfTest.php +++ b/test/unit/core/kernel/persistence/OntologyRdfTest.php @@ -38,8 +38,8 @@ class OntologyRdfTest extends GenerisTestCase public function testRdfInterface(Ontology $ontology) { $this->assertEquals(0, $this->getTripleCount($ontology)); - $triple1 = core_kernel_classes_Triple::createTriple(0, 'subject', 'predicate', 'object'); - $triple2 = core_kernel_classes_Triple::createTriple(0, 'subject', 'predicate', 'object2'); + $triple1 = core_kernel_classes_Triple::createTriple(2, 'subject', 'predicate', 'object'); + $triple2 = core_kernel_classes_Triple::createTriple(2, 'subject', 'predicate', 'object2'); $ontology->getRdfInterface()->add($triple1); $this->assertEquals(1, $this->getTripleCount($ontology)); $ontology->getRdfInterface()->remove($triple2); @@ -55,7 +55,7 @@ public function testRdfInterface(Ontology $ontology) public function testAdd(Ontology $ontology) { $this->assertEquals(0, $this->getTripleCount($ontology)); - $triple1 = core_kernel_classes_Triple::createTriple(0, 'subject', 'predicate', 'object'); + $triple1 = core_kernel_classes_Triple::createTriple(2, 'subject', 'predicate', 'object'); $ontology->getRdfInterface()->add($triple1); $this->assertEquals(1, $this->getTripleCount($ontology)); $triples = $ontology->getRdfInterface(); @@ -79,9 +79,9 @@ public function testAddTripleCollection(Ontology $ontology) $this->assertInstanceOf(Ontology::class, $ontology); $this->assertEquals(0, $this->getTripleCount($ontology)); - $triple1 = core_kernel_classes_Triple::createTriple(0, 'subject', 'predicate', 'object'); - $triple2 = core_kernel_classes_Triple::createTriple(0, 'subject2', OntologyRdf::RDF_TYPE, 'object2'); - $triple3 = core_kernel_classes_Triple::createTriple(0, 'subject3', OntologyRdfs::RDFS_SUBCLASSOF, 'object2'); + $triple1 = core_kernel_classes_Triple::createTriple(2, 'subject', 'predicate', 'object'); + $triple2 = core_kernel_classes_Triple::createTriple(2, 'subject2', OntologyRdf::RDF_TYPE, 'object2'); + $triple3 = core_kernel_classes_Triple::createTriple(2, 'subject3', OntologyRdfs::RDFS_SUBCLASSOF, 'object2'); $ontology->getRdfInterface()->addTripleCollection([$triple1, $triple2, $triple3]); $this->assertEquals(3, $this->getTripleCount($ontology)); @@ -95,7 +95,7 @@ public function testRemove(Ontology $ontology) { $this->assertInstanceOf(Ontology::class, $ontology); $this->assertEquals(0, $this->getTripleCount($ontology)); - $triple1 = core_kernel_classes_Triple::createTriple(0, 'subject', 'predicate', 'object'); + $triple1 = core_kernel_classes_Triple::createTriple(2, 'subject', 'predicate', 'object'); $ontology->getRdfInterface()->add($triple1); $this->assertEquals(1, $this->getTripleCount($ontology)); $ontology->getRdfInterface()->remove($triple1);