$stateQuery = $query . "\n" . 'SELECT DISTINCT ?id WHERE { { GRAPH ?g {?id a omt:State-Of-Being}} {GRAPH <' . $graphMeta . '> { ?id ?p ?o } } } ORDER BY ?id' . "\n"; //print($stateQuery); $s = new FourStore_StorePlus('http://contextus.net:7000/sparql/'); $graph = array(); $autoCharsToBeIgnored = array(); $rUser = $s->query($queryUser); foreach ($rUser['result']['rows'] as $result) { addTripleToGraph($graph, makeTriple($result['s'], $result['p'], $result['o'])); if ($result['p'] == 'http://purl.org/ontomedia/core/expression#is-shadow-of') { $autoCharsToBeIgnored[] = $result['o']; } } $rAuto = $s->query($queryAuto); foreach ($rAuto['result']['rows'] as $result) { if (!in_array($result['s'], $autoCharsToBeIgnored)) { addTripleToGraph($graph, makeTriple($result['s'], $result['p'], $result['o'])); } } header('Cache-Control: no-store'); printXMLHeaders(); ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>A Midsummer Night's Dream: Character Editor</title> <link rel="stylesheet" href="fourstore_editor.css" type="text/css" media="all" title="Default styles" /> <script type="text/javascript" src="triples.js"></script> <script type="text/javascript"> var controlsToSetup = []; controlsToSetup[0] = 'is'; var entityType = 'http://purl.org/ontomedia/ext/common/being#Character'; <?php
foreach ($adds as $add) { $add = trim($add); if ($add == '') { continue; } list($s, $p, $o) = explode('|', $add, 3); addTripleToGraph($userGraph, makeTriple($s, $p, $o)); } foreach ($changes as $change) { $change = trim($change); if ($change == '') { continue; } list($s, $p, $o, $originalO) = explode('|', $change, 4); deleteTripleFromGraph($userGraph, makeTriple($s, $p, $originalO)); addTripleToGraph($userGraph, makeTriple($s, $p, $o)); // if ($_POST['saveType'] == 'character') // { // $originalS = $s; // $s = str_replace($autoGraphURL, $userGraphURL, $s); // // if ($s != $originalS) // { // addTripleToGraph($userGraph, makeTriple($s, 'a' , 'http://purl.org/ontomedia/ext/common/being#Character')); // addTripleToGraph($userGraph, makeTriple($s, 'http://purl.org/ontomedia/core/expression#is-shadow-of' , $originalS)); // } // // deleteTripleFromGraph($userGraph, makeTriple($s, $p, $originalO)); // addTripleToGraph($userGraph, makeTriple($s, $p, $o)); // } // else if ($_POST['saveType'] == 'location')
$i = 1; while (array_search($graphAuto . 'character/' . $i, $chars) !== false || array_search($graphUser . 'character/' . $i, $chars) !== false) { $i++; } $potentialNewEntity = $graphUser . 'character/' . $i; addTripleToGraph($graph, makeTriple($potentialNewEntity, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://purl.org/ontomedia/ext/common/being#Character")); } else { $i = 1; //$potentialLocationEntity = ""; //while($potentialLocationEntity == "") if ($newType == "loc") { while (array_search($graphAuto . 'location/' . $i, $locs) !== false || array_search($graphUser . 'location/' . $i, $locs) !== false) { $i++; } $potentialNewEntity = $graphUser . 'location/' . $i; addTripleToGraph($graph, makeTriple($potentialNewEntity, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://purl.org/ontomedia/core/space#Space")); } } header('Cache-Control: no-store'); printXMLHeaders(); ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>A Midsummer Night's Dream: Entity Creator</title> <link rel="stylesheet" href="fourstore_editor.css" type="text/css" media="all" title="Default styles" /> <script type="text/javascript" src="triples.js"></script> <script type="text/javascript"> var controlsToSetup = []; controlsToSetup[0] = 'is'; controlsToSetup[1] = 'isShadowOf'; var classControlsToSetup = [];