I want to connect Fuseki Server to PHP following the instructions from Ontology and the Web . But I received an error while executing : "Didn't even see a sparql element, is this really an endpoint?" What changes should I make in the sparqllib.php file to access my fuseki server?
Any help would be appreciated. Thanks in advance.
Edit:
The code for accessing the tripplestore:
<?php
require_once( "sparqllib.php" );
$db = sparql_connect( "http://localhost:3030" );
if( !$db ) { print sparql_errno() . ": " . sparql_error(). "\n"; exit; }
sparql_ns( "foaf","http://xmlns.com/foaf/0.1/" );
sparql_ns("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
sparql_ns("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
$sparql = "PREFIX : <http://localhost/soy_test1#>
SELECT ?P WHERE { ?PlantDescriptor :hasType ?P }";
$result = sparql_query( $sparql );
$fields = sparql_field_array( $result );
print "<p>Number of rows: ".sparql_num_rows( $result )." results.</p>";
print "<table class='example_table'>";
print "<tr>";
foreach( $fields as $field )
{
print "<th>$field</th>";
}
print "</tr>";
while( $row = sparql_fetch_array( $result ) )
{
print "<tr>";
foreach( $fields as $field )
{
print "<td>$row[$field]</td>";
}
print "</tr>";
}
print "</table>";
Thanks in advance.