WORLDS FAMOUST PAGE ON THE INTERNET
- Startseite
- Demos
-
loadStatementsFromURI(
new LibRDF_Parser('rdfxml'),
'http://richard.cyganiak.de/foaf.rdf');
// Create a SPARQL query
$query = new LibRDF_Query("
PREFIX foaf:
SELECT ?name1 ?name2
WHERE
{
?person1 foaf:knows ?person2 .
?person1 foaf:name ?name1 .
?person2 foaf:name ?name2 .
}
", null, 'sparql');
// Execute the query. The results of a SPARQL SELECT provide
// array access by using the variables used in the query as keys:
$results = $query->execute($model);
foreach ($results as $result) {
echo $result['name1'] . " knows " . $result['name2'] . "\n";
}
?>