mirror of
https://github.com/Babibubebon/lodfe.git
synced 2024-09-22 17:34:19 +09:00
commit
ef3d9ea3c2
5 changed files with 21 additions and 12 deletions
|
@ -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) {
|
||||
|
|
|
@ -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']);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
return [
|
||||
|
||||
'version' => '1.2.1',
|
||||
'version' => '1.2.2',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -4,9 +4,19 @@
|
|||
@endsection
|
||||
|
||||
@section('content')
|
||||
<section>
|
||||
<header>
|
||||
<h1>@yield('title')</h1>
|
||||
<code class="h5">{{ $primaryTopic }}</code>
|
||||
<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>
|
||||
|
|
Loading…
Reference in a new issue