From e49d998e12441618ea6f5eb528e3125ab52a66e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=BB=C3=B3=C5=82tak?= Date: Wed, 26 Jul 2023 17:15:33 +0200 Subject: [PATCH] composer.json: allow both rdfInterface v1 and v2 --- composer.json | 8 ++++---- tests/TestUtilsTrait.php | 31 +++++++++++++++---------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index 4731022..e1e1b46 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,8 @@ "ext-pcre": "*", "ext-xmlreader" : "*", "zozlak/rdf-constants": "^1.1", - "sweetrdf/rdf-interface": "^1.0.0", - "sweetrdf/rdf-helpers": "^1.0.0", + "sweetrdf/rdf-interface": "^1.0.0 | ^2.0.0-RC1", + "sweetrdf/rdf-helpers": "^1.0.2", "pietercolpaert/hardf": "*", "ml/json-ld": "^1.2" }, @@ -37,9 +37,9 @@ "phpstan/phpstan": "*", "php-coveralls/php-coveralls": "^2.4", "squizlabs/php_codesniffer": "*", - "sweetrdf/quick-rdf": "^1.0.0", + "sweetrdf/quick-rdf": "^2.0.0-RC1", "sweetrdf/term-templates": "^1.0.0", - "sweetrdf/simple-rdf": "^1.0.0" + "sweetrdf/simple-rdf": "^2.0.0-RC1" }, "autoload-dev": { "psr-4": { diff --git a/tests/TestUtilsTrait.php b/tests/TestUtilsTrait.php index 583c5a0..55fb100 100644 --- a/tests/TestUtilsTrait.php +++ b/tests/TestUtilsTrait.php @@ -26,12 +26,11 @@ namespace quickRdfIo; -use rdfInterface\DataFactoryInterface as iDataFactory; -use rdfInterface\QuadInterface as iQuad; -use rdfInterface\BlankNodeInterface as iBlankNode; -use rdfInterface\DatasetInterface as iDataset; -use rdfInterface\ParserInterface as iParser; -use rdfInterface\DatasetMapReduceInterface as iDatasetMapReduce; +use rdfInterface\DataFactoryInterface; +use rdfInterface\QuadInterface; +use rdfInterface\BlankNodeInterface; +use rdfInterface\DatasetInterface; +use rdfInterface\ParserInterface; use quickRdf\Dataset; /** @@ -41,23 +40,23 @@ */ trait TestUtilsTrait { - private iDataFactory $df; - private iParser $refParser; + private DataFactoryInterface $df; + private ParserInterface $refParser; - private function unblank(iQuad $quad): iQuad { + private function unblank(QuadInterface $quad): QuadInterface { $sbj = $quad->getSubject(); - if ($sbj instanceof iBlankNode) { + if ($sbj instanceof BlankNodeInterface) { $quad = $quad->withSubject($this->df->namedNode('bn:' . $sbj->getValue())); } $obj = $quad->getObject(); - if ($obj instanceof iBlankNode) { + if ($obj instanceof BlankNodeInterface) { $quad = $quad->withObject($this->df->namedNode('bn:' . $obj->getValue())); } return $quad; } - private function assertDatasetsEqual(iDataset $test, iDataset $ref, - string $msg = ''): void { + private function assertDatasetsEqual(DatasetInterface $test, + DatasetInterface $ref, string $msg = ''): void { if ($ref->equals($test) === false) { echo "\n" . "REF:\n$ref" . @@ -69,14 +68,14 @@ private function assertDatasetsEqual(iDataset $test, iDataset $ref, $this->assertTrue($ref->equals($test), $msg); } - private function blankGraphAsDefaultGraph(iQuad $q): iQuad { - if ($q->getGraph() instanceof iBlankNode) { + private function blankGraphAsDefaultGraph(QuadInterface $q): QuadInterface { + if ($q->getGraph() instanceof BlankNodeInterface) { return $q->withGraph($this->df->defaultGraph()); } return $q; } - private function parseRef(string $refFile, bool $unblank): iDatasetMapReduce { + private function parseRef(string $refFile, bool $unblank): DatasetInterface { $refInput = fopen($refFile, 'r') ?: throw new \RuntimeException("Failed to open $refFile"); $ref = new Dataset(); $ref->add($this->refParser->parseStream($refInput));