Merge pull request #4 from Babibubebon/develop

Develop into Master
This commit is contained in:
Babibubebon 2020-01-23 16:50:37 +09:00 committed by GitHub
commit ef3d9ea3c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 12 deletions

View file

@ -25,10 +25,9 @@ class ResourceController extends Controller
/**
* @param $request
* @param $id
* @return \EasyRdf_Graph
*/
protected function querySparql($request, $id)
protected function querySparql($request)
{
$client = new \EasyRdf_Sparql_Client($request->datasetConfig['endpoint']);
$query = <<<EOT
@ -51,7 +50,7 @@ EOT;
*/
public function html(Request $request, $id)
{
$graph = $this->querySparql($request, urldecode($id));
$graph = $this->querySparql($request);
if ($graph->isEmpty()) {
abort(404);
}
@ -75,7 +74,7 @@ EOT;
abort(400);
}
$graph = $this->querySparql($request, $id);
$graph = $this->querySparql($request);
try {
$data = $graph->serialise(substr($ext, 1));
} catch (\EasyRdf_Exception $e) {

View file

@ -22,7 +22,7 @@ class DatasetMiddleware
$datasetName = explode('.', $request->route()[1]['as'])[1];
$currentDatasetConfig = config('datasets.' . $datasetName);
$id = $request->route('id');
$id = urldecode($request->route('id'));
$resourceUri = str_replace('{id}', $id, $currentDatasetConfig['resource_uri']);
$dataUri = str_replace('{id}', $id, $currentDatasetConfig['data_uri']);

View file

@ -2,7 +2,7 @@
return [
'version' => '1.2.1',
'version' => '1.2.2',
/*
|--------------------------------------------------------------------------

View file

@ -14,14 +14,14 @@
@foreach($objects as $object)
<li>
@if($object['type'] === 'uri')
<a href="{{ $object['value'] }}">{{ $object['value'] }}</a>
<a href="{{ $object['value'] }}">{{ \EasyRdf_Namespace::shorten($object['value']) ?? $object['value'] }}</a>
@elseif($object['type'] === 'literal')
{{ $object['value'] }}
@if(isset($object['lang']))
<small>{{ '@'.$object['lang'] }}</small>
<small class="langtag">{{ '@'.$object['lang'] }}</small>
@endif
@if(isset($object['datatype']))
<small>^^{{ \EasyRdf_Namespace::shorten($object['datatype']) ?? $object['datatype'] }}</small>
<small class="datatype">^^{{ \EasyRdf_Namespace::shorten($object['datatype']) ?? $object['datatype'] }}</small>
@endif
@endif
</li>

View file

@ -4,9 +4,19 @@
@endsection
@section('content')
<section>
<header>
<h1>@yield('title')</h1>
<div>
<code class="h5">{{ $primaryTopic }}</code>
<div>
An Entity of Type:
<ul class="list-inline" style="display: inline">
@foreach($graph->typesAsResources($primaryTopic) as $type)
<li class="list-inline-item"><a href="{{ $type->getUri() }}">{{ $type->shorten() }}</a></li>
@endforeach
</li>
</div>
</div>
<div class="float-right">
<div class="dropdown">
@ -24,7 +34,7 @@
</div>
</div>
</div>
</section>
</header>
<table class="table table-sm mt-3">
<thead>