html_tag_helpers.php not found. Queries into GraphDB


#1

Good day,

I have downloaded Easyrdf, the release of the 2020-07-14 from here https://www.easyrdf.org/downloads and installed it.

When I try to view example ListOfCountries.php for example, I have this error message:

Warning : require_once(C:\xampp\htdocs\websemantique\ex1/html_tag_helpers.php): failed to open stream: No such file or directory in C:\xampp\htdocs\websemantique\ex1\index5.php on line 20

Fatal error : require_once(): Failed opening required ‘C:\xampp\htdocs\websemantique\ex1/html_tag_helpers.php’ (include_path=‘C:\xampp\php\PEAR’) in C:\xampp\htdocs\websemantique\ex1\index5.php on line 20
This file html_tag_helpers.php is not present on the directory structure.
As attachment you’ll see pictures of my directory structure and also the PHP file containing ListOfCountries.php code.

Also I have installed GraphDB database and would like to know how from Easyrdf I could make some queries into the database.

<?php

    //require_once realpath(__DIR__.'/..')."/vendor/autoload.php";
	require_once('C:\xampp\htdocs\websemantique\ex1\vendor\autoload.php');
    require_once __DIR__."/html_tag_helpers.php";

    // Setup some additional prefixes for DBpedia
    \EasyRdf\RdfNamespace::set('dbc', 'http://dbpedia.org/resource/Category:');
    \EasyRdf\RdfNamespace::set('dbpedia', 'http://dbpedia.org/resource/');
    \EasyRdf\RdfNamespace::set('dbo', 'http://dbpedia.org/ontology/');
    \EasyRdf\RdfNamespace::set('dbp', 'http://dbpedia.org/property/');

    $sparql = new \EasyRdf\Sparql\Client('http://dbpedia.org/sparql');
?>
<html>
<head>
  <title>EasyRdf Basic Sparql Example</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>EasyRdf Basic Sparql Example</h1>

<h2>List of countries</h2>
<ul>
<?php
    $result = $sparql->query(
        'SELECT * WHERE {'.
        '  ?country rdf:type dbo:Country .'.
        '  ?country rdfs:label ?label .'.
        '  ?country dct:subject dbc:Member_states_of_the_United_Nations .'.
        '  FILTER ( lang(?label) = "en" )'.
        '} ORDER BY ?label'
    );
    foreach ($result as $row) {
        echo "<li>".link_to($row->label, $row->country)."</li>\n";
    }
?>
</ul>
<p>Total number of countries: <?= $result->numRows() ?></p>

</body>
</html>

Thank you


#2

I have responded to this query on the EasyRdf mailing list:
https://groups.google.com/g/easyrdf/c/Cr8MYBuQzLw/m/sCl7zQDACQAJ


#3

Thanks! @cProg please do not cross-post at multiple places in the future and don’t bother users on their private email. You approached many channels at the same time, this is a waste of time for everyone.


#4

The problem answer seems to be in this error line.

The path should be C:\xampp\htdocs\websemantique\ex1\html_tag_helpers.php with only backslashes.

Have you tried your code with require_once __DIR__."\html_tag_helpers.php"; instead of require_once __DIR__."/html_tag_helpers.php";?