mirror of
https://github.com/Babibubebon/lodfe.git
synced 2024-09-23 01:34:21 +09:00
commit
ef3d9ea3c2
5 changed files with 21 additions and 12 deletions
|
@ -25,10 +25,9 @@ class ResourceController extends Controller
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $request
|
* @param $request
|
||||||
* @param $id
|
|
||||||
* @return \EasyRdf_Graph
|
* @return \EasyRdf_Graph
|
||||||
*/
|
*/
|
||||||
protected function querySparql($request, $id)
|
protected function querySparql($request)
|
||||||
{
|
{
|
||||||
$client = new \EasyRdf_Sparql_Client($request->datasetConfig['endpoint']);
|
$client = new \EasyRdf_Sparql_Client($request->datasetConfig['endpoint']);
|
||||||
$query = <<<EOT
|
$query = <<<EOT
|
||||||
|
@ -51,7 +50,7 @@ EOT;
|
||||||
*/
|
*/
|
||||||
public function html(Request $request, $id)
|
public function html(Request $request, $id)
|
||||||
{
|
{
|
||||||
$graph = $this->querySparql($request, urldecode($id));
|
$graph = $this->querySparql($request);
|
||||||
if ($graph->isEmpty()) {
|
if ($graph->isEmpty()) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +74,7 @@ EOT;
|
||||||
abort(400);
|
abort(400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$graph = $this->querySparql($request, $id);
|
$graph = $this->querySparql($request);
|
||||||
try {
|
try {
|
||||||
$data = $graph->serialise(substr($ext, 1));
|
$data = $graph->serialise(substr($ext, 1));
|
||||||
} catch (\EasyRdf_Exception $e) {
|
} catch (\EasyRdf_Exception $e) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ class DatasetMiddleware
|
||||||
$datasetName = explode('.', $request->route()[1]['as'])[1];
|
$datasetName = explode('.', $request->route()[1]['as'])[1];
|
||||||
$currentDatasetConfig = config('datasets.' . $datasetName);
|
$currentDatasetConfig = config('datasets.' . $datasetName);
|
||||||
|
|
||||||
$id = $request->route('id');
|
$id = urldecode($request->route('id'));
|
||||||
$resourceUri = str_replace('{id}', $id, $currentDatasetConfig['resource_uri']);
|
$resourceUri = str_replace('{id}', $id, $currentDatasetConfig['resource_uri']);
|
||||||
$dataUri = str_replace('{id}', $id, $currentDatasetConfig['data_uri']);
|
$dataUri = str_replace('{id}', $id, $currentDatasetConfig['data_uri']);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'version' => '1.2.1',
|
'version' => '1.2.2',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
@foreach($objects as $object)
|
@foreach($objects as $object)
|
||||||
<li>
|
<li>
|
||||||
@if($object['type'] === 'uri')
|
@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')
|
@elseif($object['type'] === 'literal')
|
||||||
{{ $object['value'] }}
|
{{ $object['value'] }}
|
||||||
@if(isset($object['lang']))
|
@if(isset($object['lang']))
|
||||||
<small>{{ '@'.$object['lang'] }}</small>
|
<small class="langtag">{{ '@'.$object['lang'] }}</small>
|
||||||
@endif
|
@endif
|
||||||
@if(isset($object['datatype']))
|
@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
|
||||||
@endif
|
@endif
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -4,9 +4,19 @@
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<section>
|
<header>
|
||||||
<h1>@yield('title')</h1>
|
<h1>@yield('title')</h1>
|
||||||
|
<div>
|
||||||
<code class="h5">{{ $primaryTopic }}</code>
|
<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="float-right">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
|
@ -24,7 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</header>
|
||||||
|
|
||||||
<table class="table table-sm mt-3">
|
<table class="table table-sm mt-3">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
Loading…
Reference in a new issue