Пример #1
0
 public function add_if_new($graph, $turtle)
 {
     // FIXME - should it be scoped by graph?
     $exists = $this->ask(FourStore_Namespace::to_sparql() . "ASK WHERE { {$turtle} }");
     if (!$exists) {
         return $this->add($graph, $turtle);
     }
 }
Пример #2
0
if (isset($_GET['idhash'])) {
    $userID = $_GET['idhash'];
} else {
    $userID = $_POST['idhash'];
}
require 'bc-fourstore-php/FourStore/FourStore_StorePlus.php';
require 'bc-fourstore-php/FourStore/Namespace.php';
require 'shakespeare_utilities.php';
FourStore_Namespace::addW3CNamespace();
FourStore_Namespace::add('omb', 'http://purl.org/ontomedia/ext/common/being#');
FourStore_Namespace::add('ome', 'http://purl.org/ontomedia/core/expression#');
FourStore_Namespace::add('omj', 'http://purl.org/ontomedia/ext/events/travel#');
FourStore_Namespace::add('loc', 'http://signage.ecs.soton.ac.uk/ontologies/location#');
FourStore_Namespace::add('foaf', 'http://xmlns.com/foaf/0.1/');
$query = FourStore_Namespace::to_sparql();
$graphAuto = 'http://contextus.net/resource/midsum_night_dream/auto/';
$graphUser = '******' . $userID . '/';
$s = new FourStore_StorePlus('http://contextus.net:7000/sparql/');
$entity = array();
$type = "Character";
if (isset($_POST['gotoLoc'])) {
    $entityID = "location/" . $_POST['locNum'];
    $type = "Space";
} else {
    if (isset($_POST['gotoChar'])) {
        $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>");