Skip to content

Commit

Permalink
fix: fixed tests and typo in functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
vbyndych committed Oct 13, 2023
1 parent 4828881 commit 0df3a8c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 1 addition & 3 deletions core/kernel/persistence/starsql/class.StarIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
*/

Expand All @@ -26,8 +26,6 @@
/**
* Iterator over all triples
*
* @author joel bout <[email protected]>
* @package generis
*/
class core_kernel_persistence_starsql_StarIterator extends \IteratorIterator implements \RecursiveIterator
{
Expand Down
4 changes: 3 additions & 1 deletion core/kernel/persistence/starsql/class.StarRdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
4 changes: 2 additions & 2 deletions test/unit/core/data/import/RdfImportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
14 changes: 7 additions & 7 deletions test/unit/core/kernel/persistence/OntologyRdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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));
Expand All @@ -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);
Expand Down

0 comments on commit 0df3a8c

Please sign in to comment.