Support configuration for http client

This commit is contained in:
Babibubebon 2020-09-01 03:17:05 +09:00
parent 340446e8a4
commit 0a4a31c94d
No known key found for this signature in database
GPG key ID: 575C0B67FDDAF4AE
2 changed files with 7 additions and 0 deletions

View file

@ -29,6 +29,10 @@ class ResourceController extends Controller
*/ */
protected function querySparql($request) protected function querySparql($request)
{ {
if (!empty($request->datasetConfig['http'])) {
$httpClient = new \EasyRdf\Http\Client(null, $request->datasetConfig['http']);
\EasyRdf\Http::setDefaultHttpClient($httpClient);
}
$client = new \EasyRdf\Sparql\Client($request->datasetConfig['endpoint']); $client = new \EasyRdf\Sparql\Client($request->datasetConfig['endpoint']);
$query = <<<EOT $query = <<<EOT
CONSTRUCT { CONSTRUCT {

View file

@ -8,6 +8,9 @@ return [
'html_uri' => 'https://example.com/page/{id}', 'html_uri' => 'https://example.com/page/{id}',
'data_uri' => 'https://example.com/data/{id}', 'data_uri' => 'https://example.com/data/{id}',
'endpoint' => 'https://example.com/query', // SPARQL endpoint URI 'endpoint' => 'https://example.com/query', // SPARQL endpoint URI
'http' => [
'timeout' => 30,
]
], ],
*/ */
]; ];