无法使用php ARC2从本地owl查询

时间:2017-05-11 13:32:42

标签: php semantic-web owl ontology arc2

我正在开发一个使用php(我使用ARC2库)的网站,它使用OWL作为后端,如mysql,但我无法查询并获得任何结果...请帮助:(

这是我正在尝试的完整代码......



<html>

<body>

  <?php
  /* ARC2 static class inclusion */ 
  include_once('arc2-master/ARC2.php');  
 
  $dbpconfig = array(
  "remote_store_endpoint" => "http://localhost/xml/owl/ArsenalFC.owl#",
   );
 
  $store = ARC2::getRemoteStore($dbpconfig); 
 
  if ($errs = $store->getErrors()) {
     echo "<h1>getRemoteSotre error<h1>" ;
  }
 
  $query = '
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX owl: <http://www.w3.org/2002/07/owl#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX ars: <http://localhost/xml/owl/ArsenalFC.owl#>
    SELECT ?subject ?object

      WHERE{ ?subject ars:managedBy ?object}';
  
  /* execute the query */
  $rows = $store->query($query, 'rows'); 
 
    if ($errs = $store->getErrors()) {
       echo "Query errors" ;
       print_r($errs);
    }
	 else{
 
    /* display the results in an HTML table */
    echo "<table border='1'>
    <thead>
        <th>Player</th>
        <th>Manager</th>
    </thead>";

    /* loop for each returned row */
    foreach( $rows as $row ) { 
    print "<tr><td>".$row['subject']."</td>
    <td>".$row['object']."</td></tr>";
    }
    echo "</table>";
	 }
  ?>
</body>

</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案