$entityID = "character/" . $_POST['charNum'];
    } else {
        $queryAuto1 = $query . "\n" . 'SELECT DISTINCT ?id WHERE { { GRAPH ?g {?id a omb:Character}} {GRAPH <' . $graphAuto . '> { ?id ?p ?o } } } ORDER BY ?id LIMIT 1' . "\n";
        $rAuto = $s->query($queryAuto1);
        //print("<p>Result: '" . $rAuto[0]['id'] . "'</p>");
        $entityID = "character/" . array_pop(explode("/", $rAuto['result']['rows'][0]['id']));
        //print("<p>Result: '" . $entityID . "'</p>");
    }
}
$queryAuto2 = $query . "\n" . 'SELECT ?p ?o WHERE { GRAPH <' . $graphAuto . '> { <' . $graphAuto . $entityID . '> ?p ?o } }' . "\n";
$rAuto = $s->query($queryAuto2);
$rUser = null;
if (isset($userID)) {
    $queryUser2 = $query . "\n" . 'SELECT ?p ?o WHERE { GRAPH <' . $graphUser . '> { <' . $graphUser . $entityID . '> ?p ?o } }' . "\n";
    $rUser = $s->query($queryUser2);
    $err = $s->getErrors();
    if ($err) {
        print_r($err);
        throw new Exception(print_r($err, true));
    }
}
$involved_count = 0;
$aka_count = 0;
$shadow_count = 0;
$loc_in_count = 0;
$part_of_count = 0;
$adj_to_count = 0;
foreach ($rAuto['result']['rows'] as $result) {
    //print("<p>Checking property: " . $result['p'] . "</p>");
    switch ($result['p']) {
        case "http://xmlns.com/foaf/0.1/name":
Beispiel #2
0
 static function insert($turtle, $graph, $endpoint)
 {
     $sp_write = new FourStore_StorePlus($endpoint, false);
     $q = "INSERT DATA {  \n\t\t\t\t\t\tGRAPH <" . $graph . "> {    \n\t\t\t\t\t\t{$turtle}\n\t\t    \t\t}}";
     $res = @$sp_write->query($q, 'raw');
     $err = $sp_write->getErrors();
     if ($err) {
         throw new Exception(self::buildMessage($err));
     }
     if (!$res) {
         $msg = "Query insert new triples return: False without errors";
         throw new Exception($msg);
     }
 }