Skip to content

Instantly share code, notes, and snippets.

@jctoledo
Created September 26, 2013 15:14
Show Gist options
  • Save jctoledo/6715600 to your computer and use it in GitHub Desktop.
Save jctoledo/6715600 to your computer and use it in GitHub Desktop.
<?php
function get_void_dataset_uri(){
GLOBAL $cmd_pre;
GLOBAL $cmd_post;
$q = "select ?x where {?w <http://rdfs.org/ns/void#inDataset> ?x.}LIMIT 1";
$cmd = $cmd_pre.$q.$cmd_post;
$out = "";
try{
$out = execute_isql_command($cmd);
}catch(Exception $e){
echo 'iSQL error: '.$e->getMessage();
return null;
}
$sr = explode("Type HELP; for help and EXIT; to exit.\n", $out);
$sr2 = explode("\n\n", $sr[1]);
$r = trim($sr2[0]);
if(strlen($r)){
return $r;
}else{
throw new Exception("Could not find a valid dataset uri! Terminating program.");
exit;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment