PHP code example of byjg / anydataset-sparql
1. Go to this page and download the library: Download byjg/anydataset-sparql library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
byjg / anydataset-sparql example snippets
$sparqlEndpoint = 'http://dbpedia.org/sparql';
$namespace = [
'dbo' => 'http://dbpedia.org/ontology/',
'dbp' => 'http://dbpedia.org/property/'
];
$dataset = new \ByJG\AnyDataset\Semantic\SparQLDataset($sparqlEndpoint, $namespace);
$iterator = $dataset->getIterator("select distinct ?Concept where {[] a ?Concept} LIMIT 5");
foreach ($iterator as $row) {
echo $row->get("Concept");
echo $row->get("Concept.type");
}