Something went wrong on our end
-
alangrafu authored
- Added debug flag, when `true` returns in page SPARQL query as well as results array Right now, when http://example.org uses data with namespace http://another.com - Every time a SELECT is executed, it will change http://another.com to http://example.org. - This is not the case for DESCRIBE/CONSTRUCT - N-Triples, Turtle and RDF/XML versions works fine so far Problems: - No description for new URI in http://example.org - Not clear how to link URI in http://exampler.org to http://another.com. Suggestion: `<http://example.org/abc> owl:sameAs <http://another.com/abc>` . It is no clear __when__ to do it
alangrafu authored- Added debug flag, when `true` returns in page SPARQL query as well as results array Right now, when http://example.org uses data with namespace http://another.com - Every time a SELECT is executed, it will change http://another.com to http://example.org. - This is not the case for DESCRIBE/CONSTRUCT - N-Triples, Turtle and RDF/XML versions works fine so far Problems: - No description for new URI in http://example.org - Not clear how to link URI in http://exampler.org to http://another.com. Suggestion: `<http://example.org/abc> owl:sameAs <http://another.com/abc>` . It is no clear __when__ to do it
Queries.php 1.68 KiB
<?
class Queries{
public static function uriExist($uri, $e){
$q = "SELECT * WHERE{
{<$uri> ?p1 ?o1}
UNION
{?s1 <$uri> ?o2}
UNION
{?s2 ?p2 <$uri>}
}LIMIT 1";
$r = $e->query($q);
if(sizeof($r['results']['bindings'])>0){
return true;
}
return false;
}
public static function getClass($uri, $e){
$q = "SELECT DISTINCT ?class ?inst WHERE{
{
<$uri> a ?class .
}UNION{
?inst a <$uri> .
}
} LIMIT 1";
try{
$r = $e->query($q);
}catch (Exception $ex){
echo $ex->getMessage();
}
if(sizeof($r['results']['bindings'])>0){
return $r['results']['bindings'][0]['class']['value'];
}
return NULL;
}
public static function getMetadata($uri, $format, $e){
global $conf;
$q = <<<QUERY
SELECT uri, doc, format FROM document WHERE
(uri = "$uri" AND format = "$format") OR doc = "$uri"
LIMIT 1
QUERY;
$r = $e->query($q);
if(sizeof($r) > 0){
$u = $r[0]['uri'];
$p = $r[0]['doc'];
$f = $r[0]['format'];
return array($u, $p, $f);
}else{
return NULL;
}
}
public static function createPage($uri, $localUri, $contentType, $e){
global $conf;
$ext = 'html';
$inserts = "";
foreach($conf['http_accept'] as $extension => $f){
$page = $localUri.".".$extension;
foreach($f as $v){
if($contentType == $v){
$returnPage = $localUri.".".$extension;
}
if($inserts != ""){
$inserts .= "UNION ";
}
$inserts .= "SELECT '$uri', '$page', '$v' \n";
if($v == $contentType){
$ext = $extension;
}
}
}
$q = <<<QUERY
INSERT INTO document (uri, doc, format) $inserts
QUERY;
$r = $e->write($q);
return $returnPage;
}
}
?>