Exemplo n.º 1
0
function countAnnotations()
{
    $query = "SELECT ?ann\n\t\t\tFROM <http://vitali.web.cs.unibo.it/raschietto/graph/ltw1516>\n\t\t\tWHERE{\n\t\t\t\t?ann <http://www.w3.org/ns/oa#hasBody> ?body.\n\t\t\t\t?body \t<http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?exp;\n\t\t\t\t\t\t<http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> ?predicate;\n\t\t\t\t\t\t<http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?cite.\n\t\t\t}";
    $result = DirectSELECT($query);
    $array = json_decode($result)->results->bindings;
    $final = 0;
    foreach ($array as $val) {
        $temp = (int) strrev((int) strrev($val->ann->value));
        if ($temp > $final) {
            $final = $temp;
        }
    }
    return $final + 1;
}
Exemplo n.º 2
0
<?php

ob_start();
require_once "utils.php";
//$data = json_decode(file_get_contents("php://input")) ;
$user = $_GET['user'];
$pass = $_GET['password'];
$pass = md5($pass);
$query = "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX vcard: <http://www.w3.org/2006/vcard/ns#>\nPREFIX schema: <http://schema.org/>  \nSELECT ?person ?name ?email ?pass\nFROM <" . GetGraph . ">\nWHERE\n{?person foaf:openid \"{$user}\";\n\nvcard:hasKey \"{$pass}\";\nfoaf:name ?name;\nschema:email ?email.\n}";
$result = DirectSELECT($query);
$r = json_decode($result)->results->bindings;
if (count($r) == 0) {
    echo "Dati di login non corretti!";
} else {
    $person = json_decode($result)->results->bindings[0]->person->value;
    $email = json_decode($result)->results->bindings[0]->email->value;
    $name = json_decode($result)->results->bindings[0]->name->value;
    setcookie("email", $email, time() + 86400, "/");
    setcookie("name", $name, time() + 86400, "/");
    setcookie("person", $person, time() + 86400, "/");
    echo '';
}
ob_end_flush();