From 2fc3419f1bb98dc183f48e9b94cf242428038f2b Mon Sep 17 00:00:00 2001 From: nruest Date: Thu, 13 Apr 2017 14:17:24 -0400 Subject: [PATCH] Remove triplestore client * Resolves https://github.com/Islandora-CLAW/CLAW/issues/600 remove test --- README.md | 26 +------------ src/Chullo.php | 2 - src/FedoraApi.php | 2 - src/IFedoraApi.php | 2 - src/IFedoraClient.php | 2 - src/ITriplestoreClient.php | 35 ----------------- src/TriplestoreClient.php | 69 ---------------------------------- test/TriplestoreClientTest.php | 67 --------------------------------- 8 files changed, 1 insertion(+), 204 deletions(-) delete mode 100644 src/ITriplestoreClient.php delete mode 100644 src/TriplestoreClient.php delete mode 100644 test/TriplestoreClientTest.php diff --git a/README.md b/README.md index e42427f..fbf9070 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Chullo is a PHP client for [Fedora](http://fedorarepository.org/) built using [Guzzle](http://guzzlephp.org) and [EasyRdf](http://www.easyrdf.org/). [![Latest Stable Version](https://img.shields.io/packagist/v/Islandora/chullo.svg?style=flat-square)](https://packagist.org/packages/islandora/chullo) -[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.5-8892BF.svg?style=flat-square)](https://php.net/) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/) [![Downloads](https://img.shields.io/packagist/dt/islandora/chullo.svg?style=flat-square)](https://packagist.org/packages/islandora/chullo) [![Build Status](https://travis-ci.org/Islandora-CLAW/chullo.svg?branch=master)](https://travis-ci.org/Islandora-CLAW/chullo) [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md) @@ -62,30 +62,6 @@ $chullo->saveGraph($uri, $graph); ``` -### Triplestore - -```php -use Islandora\Chullo\TriplestoreClient; - -$triplestore = TriplestoreClient::create('http://127.0.0.1:8080/bigdata/namespace/kb/sparql/'); - -$sparql = << - - SELECT ?s - WHERE { - ?s fedora:hasParent . - } - LIMIT 25 -EOD; - -$results = $triplestore->query($sparql); - -foreach ($results as $triple) { - echo $triple->s . "\n"; -} -``` - ## Maintainers/Sponsors Current maintainers: diff --git a/src/Chullo.php b/src/Chullo.php index e34801c..e62f6d5 100644 --- a/src/Chullo.php +++ b/src/Chullo.php @@ -6,8 +6,6 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * PHP Version 5.5.9 - * * @category Islandora * @package Islandora * @author Daniel Lamb diff --git a/src/FedoraApi.php b/src/FedoraApi.php index 2c1bda9..e7e9400 100644 --- a/src/FedoraApi.php +++ b/src/FedoraApi.php @@ -6,8 +6,6 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * PHP Version 5.5.9 - * * @category Islandora * @package Islandora * @author Daniel Lamb diff --git a/src/IFedoraApi.php b/src/IFedoraApi.php index 50b7c43..4a7979d 100644 --- a/src/IFedoraApi.php +++ b/src/IFedoraApi.php @@ -6,8 +6,6 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * PHP Version 5.5.9 - * * @category Islandora * @package Islandora * @author Daniel Lamb diff --git a/src/IFedoraClient.php b/src/IFedoraClient.php index ecc0b66..1a4d8f9 100644 --- a/src/IFedoraClient.php +++ b/src/IFedoraClient.php @@ -6,8 +6,6 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * PHP Version 5.5.9 - * * @category Islandora * @package Islandora * @author Daniel Lamb diff --git a/src/ITriplestoreClient.php b/src/ITriplestoreClient.php deleted file mode 100644 index e604c36..0000000 --- a/src/ITriplestoreClient.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @author Nick Ruest - * @author Diego Pino - * @license https://opensource.org/licenses/MIT MIT - * @link http://www.islandora.ca - */ - -namespace Islandora\Chullo; - -/** - * Interface for triplestore interaction. - */ -interface ITriplestoreClient -{ - /** - * Executes a sparql query. - * - * @param string $sparql Sparql query - * - * @return EasyRdf_Sparql_Result Results object - */ - public function query($sparql); -} diff --git a/src/TriplestoreClient.php b/src/TriplestoreClient.php deleted file mode 100644 index 52e9c61..0000000 --- a/src/TriplestoreClient.php +++ /dev/null @@ -1,69 +0,0 @@ - - * @author Nick Ruest - * @author Diego Pino - * @license https://opensource.org/licenses/MIT MIT - * @link http://www.islandora.ca - */ - -namespace Islandora\Chullo; - -use GuzzleHttp\Client; - -class TriplestoreClient implements ITriplestoreClient -{ - - protected $client; - - /** - * @codeCoverageIgnore - */ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * Static factory function - * - * @param string $sparql_endpoint Url for sparql endpoint - * - * @return TriplestoreClient - * @codeCoverageIgnore - */ - public static function create($sparql_endpoint) - { - $guzzle = new Client(['base_uri' => $sparql_endpoint]); - return new static($guzzle); - } - - /** - * Executes a sparql query. - * - * @param string $sparql Sparql query - * - * @return EasyRdf_Sparql_Result Results object - */ - public function query($sparql) - { - $response = $this->client->post("", [ - 'query' => [ - 'format' => 'json', - 'query' => $sparql, - ], - ]); - - return new \EasyRdf_Sparql_Result($response->getBody(), 'application/sparql-results+json'); - } -} diff --git a/test/TriplestoreClientTest.php b/test/TriplestoreClientTest.php deleted file mode 100644 index 1728c5e..0000000 --- a/test/TriplestoreClientTest.php +++ /dev/null @@ -1,67 +0,0 @@ - 'application/sparql-results+json'], $mock_response), - ]); - - $handler = HandlerStack::create($mock); - $guzzle = new Client(['handler' => $handler, - 'base_uri' => 'http://127.0.0.1:8080/bigdata/namespace/kb/sparql/']); - $client = new TriplestoreClient($guzzle); - - $result = $client->query(""); - - $this->assertInstanceOf("EasyRdf_Sparql_Result", $result); - } - - /** - * @covers Islandora\Chullo\TriplestoreClient::query - * @uses GuzzleHttp\Client - * @expectedException GuzzleHttp\Exception\ClientException - */ - public function testThrowsExceptionOn400() - { - $mock = new MockHandler([ - new Response(400), - ]); - - $handler = HandlerStack::create($mock); - $guzzle = new Client(['handler' => $handler, - 'base_uri' => 'http://127.0.0.1:8080/bigdata/namespace/kb/sparql/']); - $client = new TriplestoreClient($guzzle); - - $result = $client->query(""); - } -}