$state=$this->db->query("select keyword.keyword,count(*) from keyword left join metadata on keyword.id=metadata.id where keyword.keytype='place' and metadata.source='0595169a-279e-4b95-819f-129d0ba4280d' group by keyword.keyword order by count desc");
$k1=$state->fetchAll();
$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join metadata m on k.id=m.id where k.keytype='theme' and m.source='0595169a-279e-4b95-819f-129d0ba4280d' group by k.keyword order by count(k.keyword) desc");
$k2=$state->fetchAll();
$state=$this->db->query("select keyword.keyword,count(*) from keyword left join metadata on keyword.id=metadata.id where keyword.keytype='temporal' and metadata.source='0595169a-279e-4b95-819f-129d0ba4280d' group by keyword.keyword order by count desc");
$sql=$this->db->quoteInto('select count(id) from keyword where keyword=?',$key);
$state=$this->db->query($sql);
$row=$state->fetchAll();
$sum=$row[0]['count'];
$sql="select uuid,title,id,description from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and id in (select id from keyword where keyword='".$key."') order by timebegin limit ? offset ?";
$row=$this->db->fetchAll("select count(*) from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and ".$where);
$sum=$row[0]['count'];
$sql="select uuid,title,id,description from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and ".$where." order by timebegin limit ? offset ?";
$rows=$this->db->fetchAll("select id,uuid,description,title,timebegin,timeend from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and timebegin is not null order by timebegin");
$state=$this->db->query("select count(*) from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and id in (select id from keyword where keytype='".$type."' and keyword='".$keyword."')");
$sql="select uuid,title from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and id in (select id from keyword where keytype='".$type."' and keyword='".$keyword."') order by timebegin limit ? offset ?";