<?php
// src/Controller/OntoController.php
namespace App\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
class OntoController extends DMAbstractController
{
function getAnswerDescription($endpoint, $sparqltemplate, $entityuri)
{
$format = "application/sparql-results+json";
$query = str_replace ( "__uri__" , $entityuri , $sparqltemplate);
$searchUrl = $endpoint.'?'
.'query='.urlencode($query)
.'&format='.urlencode($format);
return $searchUrl;
}
function request($url, $auth){
// is curl installed?
if (!function_exists('curl_init')){
die('CURL is not installed!');
}
// get curl handle
$ch= curl_init();
// set request url
curl_setopt($ch,
CURLOPT_URL,
$url);
// return response, don't print/echo
curl_setopt($ch,
CURLOPT_RETURNTRANSFER,
TRUE);
// 2 lignes suivantes dangereuses, voir comment gérer des certificats
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $auth);
/*
Here you find more options for curl:
http://www.php.net/curl_setopt
*/
$response = curl_exec($ch);
if (curl_error($ch)) {
$error_msg = curl_error($ch);
}
curl_close($ch);
if ($response === FALSE) {
return "erreur ".$error_msg." dans l'appel de ".$url;
}
return $response;
}
function siteStructurer($descstruct, $description) {
$descstruct["sameAs"] = array();
$descstruct["class"] = array();
$descstruct["altLabel"] = array();
$descstruct["entityid"] = $descstruct["ville"] = $descstruct["longitude"] = $descstruct["latitude"] ="";
foreach ($description["results"]["bindings"] as $item) {
if ($item["p"]["value"]==="http://www.w3.org/2004/02/skos/core#prefLabel") //"http://www.w3.org/2000/01/rdf-schema#label")
{
if(array_key_exists("xml:lang", $item["o"])) {
$lang = $item["o"]["xml:lang"];
if ($lang=="en") $descstruct["entityid"] = $item["o"]["value"];
if ($lang=="fr") $descstruct["entityid"] = $item["o"]["value"];
} else {
$reflabel = $item["o"]["value"];
}
}
if ($item["p"]["value"]==="http://www.w3.org/2003/01/geo/wgs84_pos#lat") {
$descstruct["latitude"] = $item["o"]["value"];
}
if ($item["p"]["value"]==="http://www.w3.org/2003/01/geo/wgs84_pos#long") {
$descstruct["longitude"] = $item["o"]["value"];
}
if ($item["p"]["value"]==="http://www.w3.org/2002/07/owl#sameAs") {
if(!in_array($item["o"]["value"], $descstruct["sameAs"])){
array_push($descstruct["sameAs"], $item["o"]["value"]);
}
}
if ($item["p"]["value"]==="http://www.w3.org/2004/02/skos/core#altLabel") {
if(!in_array($item["o"]["value"], $descstruct["altLabel"])) {
array_push($descstruct["altLabel"], $item["o"]["value"]);
}
}
if ($item["p"]["value"]==="http://www.wikidata.org/prop/direct/P31") {
if(array_key_exists("xml:lang", $item["label"])) {
$lang = $item["label"]["xml:lang"];
if ($lang=="en") $descstruct["class"][$item["o"]["value"]] = [ "class"=> $item["o"]["value"], "label" =>$item["label"]["value"], "lang"=>$lang];
}
if(array_key_exists("super", $item)){
if(array_key_exists("xml:lang", $item["superlabel"])) $lang = $item["superlabel"]["xml:lang"]; else $lang = "";
if ($lang=="en")
$descstruct["class"][$item["super"]["value"]] = [ "class"=> $item["super"]["value"], "label" =>$item["superlabel"]["value"], "lang"=>$lang];
}
}
if (array_key_exists("cityname", $item)) {
$descstruct["ville"] = $item["cityname"]["value"];
}
if (array_key_exists("city", $item)) {
$descstruct["uriville"] = $item["city"]["value"];
}
}
if ($descstruct["ville"]=="") {
$descstruct["ville"] = $descstruct["uriville"];
}
if ($descstruct["entityid"]=="") {
$descstruct["entityid"] = $reflabel;
}
return $descstruct;
}
function newSiteDescription($desc, $debug=false)
{
}
function siteDescription($desc, $debug=false)
{
$uri = $desc["uri"];
$auth = "student:igr2018%"; // le dataset dmsites devrait être en libre accès
$format = "application/sparql-results+json";
$prefixes = <<<txt
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
prefix cmn: <http://givingsense.eu/datamusee/onto/musee/cmn/>
txt;
$sparqlTemplate = $prefixes . <<<txt
SELECT *
WHERE
{
{
{
<__uri__> ?p ?o .
optional { <__uri__> <http://dbpedia.org/ontology/city> ?city .
optional { ?city skos:prefLabel ?cityname } }
} UNION
{
?s owl:sameAs <__uri__> .
?s ?p ?o .
optional { ?s <http://dbpedia.org/ontology/city> ?city .
optional {
?city skos:prefLabel ?cityname
filter(lang(?cityname)='fr' || lang(?cityname)="")
}
}
}
optional {
<__uri__> wdt:P31 ?o .
?o rdfs:label ?label .
filter(lang(?label)='en' ||lang(?label)='fr' || lang(?label)="")
}
}
}
txt;
$descstruct = array();
$descstruct["entityid"] = $descstruct["altLabel"] = $descstruct["uriville"] =
$descstruct["latitude"] = $descstruct["longitude"] = $descstruct["sameAs"] =
$descstruct["ville"] = $descstruct["class"] = ""; // tempo
$mainquery = str_replace( "__uri__" , $uri , $sparqlTemplate);
$requestURL = $desc["endpoint"].'?'
.'query='.urlencode($mainquery)
.'&format='.urlencode($format);
$description = json_decode(self::request($requestURL, $auth), true);
// $description = self::request($requestURL, $auth);
$descstruct = self::siteStructurer($descstruct, $description);
$count = self::getGuestBookContribCount("https://kg.grains-de-culture.fr/dm/sparql",$uri);
$descstruct["countcontrib"] = $count["countcontrib"];
$descstruct["countuser"] = $count["countuser"];
$descstruct["countcontrib"] = $count["countcontrib"];
$descstruct["salescount"] = 0;
$descstruct["productscount"] = 0;
$descstruct["buyerscount"] = 0;
$classTemplate = $prefixes . <<<txt
SELECT distinct ?o ?label ?super ?superlabel
WHERE {
<__uri__> wdt:P31 ?o .
?o <http://www.wikidata.org/prop/direct/P279>* ?super.
?o rdfs:label ?label .
?super rdfs:label ?superlabel .
bind(lang(?superlabel) as ?lang)
filter((lang(?superlabel)='en') ||(lang(?superlabel)='en') )
}
txt;
$queryClasses = str_replace( "__uri__" , $uri , $classTemplate);
$requestURL = $desc["endpoint"].'?'
.'query='.urlencode($queryClasses)
.'&format='.urlencode($format);
$classes = json_decode(self::request($requestURL, $auth), true);
foreach ($classes["results"]["bindings"] as $item) {
$lang = "";
if(array_key_exists("xml:lang", $item["label"]))
$lang = $item["label"]["xml:lang"];
if ($lang=="en") $descstruct["class"][$item["o"]["value"]] = [ "class"=> $item["o"]["value"], "label" =>$item["label"]["value"], "lang"=>$lang];
if(array_key_exists("super", $item)){
if(array_key_exists("xml:lang", $item["superlabel"])) $lang = $item["superlabel"]["xml:lang"]; else $lang = "";
if ($lang=="en")
$descstruct["class"][$item["super"]["value"]] = [ "class"=> $item["super"]["value"], "label" =>$item["superlabel"]["value"], "lang"=>$lang];
}
}
$descstruct["dataset"] = "dmsites";
$descstruct["triplestore"] = "https://kg.grains-de-culture.fr/";
$descstruct["query"] = $mainquery;
$descstruct["jsonarray"] = $description;
$descstruct["url"] = $requestURL;
$descstruct["uri"] = $uri;
$descstruct["debug"] = $mainquery;
$descstruct["entitytype"] = "Site culturel";
$template = 'site/dmcmnsite.html.twig';
if ($debug) $template = "testTemplateSite.html.twig";
return $this->render($template, [
//return $this->render('testTemplateSite.html.twig', [
'desc' => $desc,
'descstruct' => $descstruct,
'entitytype' => $descstruct["entitytype"],
'description' => $description
]);
}
function getGuestBookContribCount($endpoint, $urisite)
{
$sparqltemplate = <<<txt
PREFIX schema: <http://schema.org/>
select (count(distinct ?s) as ?cl)(count(distinct ?user) as ?cu)
where
{
values ?graph { <http://datamusee.givingsense.eu/livredor/parismusees> <http://datamusee.givingsense.eu/livredor/cmn> }
graph ?graph {
?app schema:about <__uri__> .
?s a <http://datamusee.givingsense.eu/onto/contribution>;
<http://datamusee.givingsense.eu/onto/contribution/hasUser> ?user;
<http://datamusee.givingsense.eu/onto/contribution/hasAppli> ?app .
}
}
txt;
$format = "application/sparql-results+json";
$query = str_replace( "__uri__" , $urisite , $sparqltemplate);
$auth = "student:igr2018%"; // le dataset dmmeta devrait être en libre accès
$requestURL = $endpoint.'?'
.'query='.urlencode($query)
.'&format='.urlencode($format);
$res = json_decode(self::request($requestURL, $auth), true);
$count = array(); $count["countcontrib"] = $count["countuser"] = 0;
if ($res) {
$count["countcontrib"] = $res["results"]["bindings"][0]["cl"]["value"];
$count["countuser"] = $res["results"]["bindings"][0]["cu"]["value"];
}
//return $query;
return $count;
}
/*
http://givingsense.eu/datamusee/onto/cmn/categories
*/
/**
@Route("/onto/events")
*/
public function events()
{
$desc = array();
$desc["endpoint"] = "https://kg.grains-de-culture.fr/datamusee/query";
$desc["dataset"] = "datamusee";
$desc["graph"] = "http://givingsense.eu/datamusee/onto/events";
$desc["comment"] = "Graphe servant de test à l'aspiration de données sur des événements. Un dataset spécifique va être constitué. ";
return self::minGraphDescription($desc);
}
/**
@Route("/onto/sameAs")
*/
public function sameAs()
{
$desc = array();
$desc["endpoint"] = "https://kg.grains-de-culture.fr/datamusee/query";
$desc["dataset"] = "datamusee";
$desc["graph"] = "http://givingsense.eu/datamusee/onto/sameAs";
$desc["comment"] = "Graphe destiné à stocker les relations d'identité entre des entités utiles à Data&Musée. Par exemple, 'http://fr.dbpedia.org/resource/Paris' est identique à 'https://www.wikidata.org/entity/Q90'";
return self::minGraphDescription($desc);
}
/**
@Route("/onto/contextgraph18022019")
*/
public function contextgraph()
{
$desc = array();
$desc["endpoint"] = "https://kg.grains-de-culture.fr/datamusee/query";
$desc["dataset"] = "datamusee";
$desc["graph"] = "http://givingsense.eu/datamusee/onto/contextgraph18022019";
$desc["comment"] = "Graphe de contexte de Paris Musées, issu de fr-DBpedia; données liées aux directement ou indirectement aux musées de Paris Musées. ";
return self::minGraphDescription($desc);
}
/**
@Route("/onto/joconde18022019")
*/
public function joconde()
{
$desc = array();
$desc["endpoint"] = "https://kg.grains-de-culture.fr/datamusee/query";
$desc["dataset"] = "datamusee";
$desc["graph"] = "http://givingsense.eu/datamusee/onto/joconde18022019";
$desc["comment"] = "Représentation en graphe de connaissances par transcription de la base Joconde. ";
return self::minGraphDescription($desc);
}
/**
@Route("/onto/datatourisme")
*/
public function datatourisme()
{
$desc = array();
$desc["endpoint"] = "https://kg.grains-de-culture.fr/datamusee/query";
$desc["dataset"] = "datamusee";
$desc["graph"] = "http://givingsense.eu/datamusee/onto/datatourisme";
$desc["comment"] = "Extrait de la base DataTourisme; données issues des offices de tourisme français; extrait pour prise en main du contenu. ";
return self::minGraphDescription($desc);
}
/**
@Route("/onto/geonames")
*/
public function geonames()
{
$desc = array();
$desc["endpoint"] = "https://kg.grains-de-culture.fr/datamusee/query";
$desc["dataset"] = "datamusee";
$desc["graph"] = "http://givingsense.eu/datamusee/onto/geonames";
$desc["comment"] = "Extrait de la base geonames; données sur les entités géographiques françaises. ";
return self::minGraphDescription($desc);
}
function minGraphDescription($desc)
{
$desc["triplestore"] = "https://kg.grains-de-culture.fr/";
return $this->render("graph/dmminimalgraph.html.twig", [
'descstruct' => $desc,
'entitytype' => "Graphe",
]);
}
/**
@Route("/onto/billetterieExtraitPM")
*/
public function ontoTech()
{
return new Response(
'<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8"></head><body>Graphe à usage technique interne. Pas de description publique.</body></html>'
);
}
/**
@Route("/onto")
*/
public function onto()
{
return new Response(
'<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8"></head><body>Base du déréférencement des URIs créées pour le projet Data&Musée</body></html>'
);
}
function contribStructurer($description)
{
$descstruct = array();
$descstruct["predicates"] = array();
$descstruct["questions"] = array();
$descstruct["reponses"] = array();
$descstruct["possiblevalues"] = array();
$lienQuestionAnswer = array();
$labelQuestion = array();
foreach ($description["results"]["bindings"] as $item) {
$predicate = $item["p"]["value"];
if (!in_array($predicate, $descstruct["predicates"], TRUE)) {
array_push($descstruct["predicates"], $predicate);
}
if ($item["p"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/contribution/hasQuestion")
{
if ($item["q"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/question/hasLabel")
{
if ($item["v"]["xml:lang"]==="fr")
{
$labelQuestion[$item["o"]["value"]] = $item["v"]["value"];
}
}
}
if ($item["p"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/contribution/hasAnswer") {
if (array_key_exists("pv", $item))
{
if ($item["pv"]["xml:lang"]==="fr")
{
$labelReponses[$item["o"]["value"]] = $item["pv"]["value"]; // idreponse -> valeur reponse
}
} elseif ($item["q"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/answer/hasValue")
{
$labelReponses[$item["o"]["value"]] = $item["v"]["value"]; // idreponse -> valeur reponse
}
if ($item["q"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/answer/belongQuestion")
{
$lienQuestionAnswer[$item["v"]["value"]] = $item["o"]["value"]; // uriquestion->urireponse
}
}
if ($item["p"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/contribution/hasAppli") {
if ($item["q"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/application/appName") {
$descstruct["appli"] = $item["o"]["value"];
$descstruct["appliname"] = $item["v"]["value"];
}
if ($item["q"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/application/clientName") {
$descstruct["clientname"] = $item["v"]["value"];
}
if ($item["q"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/application/hasId") {
$descstruct["idappli"] = $item["v"]["value"];
}
}
}
foreach ($lienQuestionAnswer as $idquestion => $idreponse) {
if (array_key_exists($idquestion, $lienQuestionAnswer) )
{
if ($labelReponses[$lienQuestionAnswer[$idquestion]]==="-1")
{
$strrep = "Pas de réponse"; $urirep = "";
}
else
{
$strrep= $labelReponses[$lienQuestionAnswer[$idquestion]]; $urirep = $lienQuestionAnswer[$idquestion];
}
$rep = [ "uriquestion" => $idquestion, "question" => $labelQuestion[$idquestion], "urireponse" => $urirep, "reponse" => $strrep ];
}
else
{
$rep = [ "uriquestion" => $idquestion, "question" => $labelQuestion[$idquestion], "urireponse" => "", "reponse" => "" ];
}
array_push($descstruct["questions"], $rep);
}
return $descstruct;
}
function questionStructurer($description)
{
$descstruct = array();
$descstruct["predicates"] = array();
$descstruct["labels"] = array();
$descstruct["reponses"] = array();
$descstruct["category"] = "??";
$descstruct["uriquestion"] = "??";
$descstruct["question"] = "??";
foreach ($description["results"]["bindings"] as $item) {
$predicate = $item["p"]["value"];
if (!in_array($predicate, $descstruct["predicates"], TRUE)) {
array_push($descstruct["predicates"], $predicate);
}
if ($item["p"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/question/hasLabel") {
array_push($descstruct["labels"], ["lang"=> $item["o"]["xml:lang"], "label"=> $item["o"]["value"] ]);
}
if ($item["p"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/question/hasPossibleValue") {
$descstruct["posval"] = $item["o"]["value"];
if ($item["q"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/possibleValue/hasLabel") {
array_push($descstruct["reponses"], [ "label" =>$item["v"]["value"], "lang"=>$item["v"]["xml:lang"]]);
}
}
}
return $descstruct;
}
function appliStructurer($description)
{
$descstruct = array();
$descstruct["predicates"] = array();
$descstruct["reponses"] = array();
$descstruct["possiblevalues"] = array();
// $descstruct["category"] = "??";
//$descstruct["uriquestion"] = "??";
//$descstruct["question"] = "??";
foreach ($description["results"]["bindings"] as $item) {
$predicate = $item["p"]["value"];
if (!in_array($predicate, $descstruct["predicates"], TRUE)) {
array_push($descstruct["predicates"], $predicate);
}
}
return $descstruct;
}
function answerStructurer($description)
{
$descstruct = array();
$descstruct["predicates"] = array();
$descstruct["reponses"] = array();
$descstruct["possiblevalues"] = array();
foreach ($description["results"]["bindings"] as $item) {
$predicate = $item["p"]["value"];
if (!in_array($predicate, $descstruct["predicates"], TRUE)) {
array_push($descstruct["predicates"], $predicate);
}
if ($item["p"]["value"]==="http://www.w3.org/1999/02/22-rdf-syntax-ns#type") {
$descstruct["typelink"] = $item["o"]["value"];
}
if ($item["p"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/answer/belongQuestion") {
if ($item["q"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/question/hasLabel")
{
if ($item["v"]["xml:lang"]==="fr")
{
$descstruct["question"] = $item["v"]["value"];
$descstruct["uriquestion"] = $item["o"]["value"];
}
}
if ($item["q"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/question/hasType")
{
$descstruct["category"] = $item["v"]["value"];
}
}
if ($item["p"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/answer/hasPossibleValue") {
if ($item["q"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/possibleValue/hasLabel") {
array_push($descstruct["reponses"], ["lang"=> $item["v"]["xml:lang"], "label"=> $item["v"]["value"] ]);
}
}
}
return $descstruct;
}
function posvalStructurer($description)
{
$descstruct = array();
$descstruct["predicates"] = array();
$descstruct["labels"] = array();
$descstruct["possiblevalues"] = array();
foreach ($description["results"]["bindings"] as $item) {
$predicate = $item["p"]["value"];
if (!in_array($predicate, $descstruct["predicates"], TRUE)) {
array_push($descstruct["predicates"], $predicate);
}
if ($item["p"]["value"]==="http://www.w3.org/1999/02/22-rdf-syntax-ns#type") {
$descstruct["typelink"] = $item["o"]["value"];
}
if ($item["p"]["value"]==="http://givingsense.eu/datamusee/onto/livredor/possibleValue/hasLabel") {
array_push($descstruct["labels"], ["lang"=> $item["o"]["xml:lang"], "label"=> $item["o"]["value"] ]);
}
}
return $descstruct;
}
function entityLivredorDisplay($entityid)
{
// exemple: http://givingsense.eu/datamusee/onto/livredor/ANSW_5ad8ad19d1c52ba751ccab5c
// ici, je devrais récupérer le type de l'entité et choisir un template en fonction du type
// mais pour l'instant (16/6/2019) Tuan n'a pas mis de type sur les entités
// donc je vais ma baser sur la chaîne avant _ dans l'entityid
$templateSelector = array(
"CONTRIB"=> [
"template" => 'onto/dmlivredorcontrib.html.twig' ,
"typestring"=>'Contribution à un sondage',
"endpoint" => "https://kg.grains-de-culture.fr/livredor/sparql",
"sparql"=> "SELECT * WHERE { graph ?g { <__uri__> ?p ?o . OPTIONAL {?o ?q ?v . OPTIONAL { ?o <http://givingsense.eu/datamusee/onto/livredor/answer/hasPossibleValue> ?a . ?a <http://givingsense.eu/datamusee/onto/livredor/possibleValue/hasLabel> ?pv }}}}",
"structurer" => "contribStructurer"
],
"POSVAL"=> [
"template" => 'onto/dmlivredorposval.html.twig' ,
"typestring"=>'Valeurs possibles en réponse à une question',
"endpoint" => "https://kg.grains-de-culture.fr/livredor/sparql",
"sparql"=> "SELECT * WHERE { graph ?g { <__uri__> ?p ?o . OPTIONAL {?o ?q ?v }}}",
"structurer" => "posvalStructurer"
],
"ANSW"=> [
"template" => 'onto/dmlivredoransw.html.twig' ,
"typestring"=>'Réponse à une question',
"endpoint" => "https://kg.grains-de-culture.fr/livredor/sparql",
"sparql"=> "SELECT * WHERE { graph ?g { <__uri__> ?p ?o . OPTIONAL {?o ?q ?v }. }}",
"structurer" => "answerStructurer"
],
"APP"=> [
"template" => 'onto/dmlivredorappli.html.twig' ,
"typestring"=>'Application',
"endpoint" => "https://kg.grains-de-culture.fr/livredor/sparql",
//"sparql"=> "SELECT * WHERE { graph ?g { <__uri__> ?p ?o . OPTIONAL {?o ?q ?v }. OPTIONAL { ?v ?l ?w }}}",
"sparql"=> "SELECT * WHERE { graph ?g { <__uri__> ?p ?o . OPTIONAL {?o ?q ?v }. }}",
"structurer" => "appliStructurer"
],
"QUEST"=> [
"template" => 'onto/dmlivredorquest.html.twig' ,
"typestring"=>'Question',
"endpoint" => "https://kg.grains-de-culture.fr/livredor/sparql",
"sparql"=> "SELECT * WHERE { graph ?g { <__uri__> ?p ?o . OPTIONAL {?o ?q ?v }. }}",
"structurer" => "questionStructurer"
]);
$entitytype = strtok($entityid, "_");
$uri = "http://givingsense.eu/datamusee/onto/livredor/".$entityid;
$auth = "student:igr2018%"; //$username . ":" . $password;
$requestURL = self::getAnswerDescription($templateSelector[$entitytype]["endpoint"],
$templateSelector[$entitytype]["sparql"],
$uri);
$description = json_decode(self::request($requestURL, $auth), true);
$descstruct = $this->{$templateSelector[$entitytype]["structurer"]}($description);
$descstruct["jsonarray"] = $description;
$descstruct["url"] = $requestURL;
$descstruct["uri"] = $uri;
$descstruct["entityid"] = $entityid;
$descstruct["entitytype"] = $templateSelector[$entitytype]["typestring"];
return $this->render($templateSelector[$entitytype]["template"], [
'descstruct' => $descstruct,
'entitytype' => $templateSelector[$entitytype]["typestring"],
]);
// 'description' => self::printArray($description),
}
/**
@Route("/onto/livredor/{entityid}")
*/
public function livredor($entityid)
{
// exemple: http://givingsense.eu/datamusee/onto/livredor/ANSW_5ad8ad19d1c52ba751ccab5c
// ici, je devrais récupérer le type de l'entité et choisir un template en fonction du type
// mais pour l'instant (16/6/2019) Tuan n'a pas mis de type sur les entités
// donc je vais ma baser sur la chaîne avant _ dans l'entityid
return self::entityLivredorDisplay($entityid);
}
}