Beispiel #1
0
 if (sizeof($Keywords) > 1) {
     $query = $prefixs . $sparql->getArticlesByKeywords($Keywords, $title);
     $response = $http->sparqlQuery($query);
     $json = json_decode($response, true);
     $ArticlesByKeywords = $json["results"]["bindings"];
     $id = 1;
     // per ogni articolo estrae titolo,id, insieme di keyword in comune e insieme di topic in comune, crea un oggetto e lo inserisce in un array di articoli
     if (sizeof($ArticlesByKeywords) > 1) {
         foreach ($ArticlesByKeywords as $t) {
             $arrayKeyword = array();
             $arrayTopic = array();
             $art[$t["title_value"]["value"]] = new Article();
             $art[$t["title_value"]["value"]]->setId($t["title_value"]["value"]);
             $art[$t["title_value"]["value"]]->setTitle($t["title_value"]["value"]);
             $id++;
             $query = $prefixs . $sparql->getEqualsKeywordByArticle($t["title_value"]["value"], $Keywords);
             $response = $http->sparqlQuery($query);
             $json = json_decode($response, true);
             $equalsKeywords = $json["results"]["bindings"];
             if (sizeof($equalsKeywords) > 0) {
                 foreach ($equalsKeywords as $ek) {
                     $arrayKeyword[$ek["t"]["value"]] = $ek["r"]["value"];
                 }
             }
             if (sizeof($topics) > 0) {
                 $query = $prefixs . $sparql->getEqualsTopicByArticle($t["title_value"]["value"], $topics);
                 $response = $http->sparqlQuery($query);
                 $json = json_decode($response, true);
                 $equalsTopics = $json["results"]["bindings"];
                 foreach ($equalsTopics as $top) {
                     array_push($arrayTopic, $top["topicValue"]["value"]);