|
From: <php...@li...> - 2010-01-22 10:43:30
|
Hi,
> Here is the Java Code I want to transform to PHP code with PHP/Java
Bridge:
Quick and dirty translation:
<?php require_once("java/Java.inc");
$here=getcwd();
java_autoload("$here/d2r-server-0.7/lib;$here/ARQ-2.8.2/lib");
use de\fuberlin\wiwiss\d2rq\ModelD2RQ as ModelD2RQ;
use com\hp\hpl\jena\query\QueryFactory as QueryFactory;
use com\hp\hpl\jena\query\QueryExecutionFactory as QueryExecutionFactory;
try {
class PruebaSPARQL {
public static function test() {
global $here;
$m = new ModelD2RQ("$here/mapping-iswc.n3");
$sparql = "SELECT * WHERE {}";
$q = QueryFactory::create($sparql);
$rs = QueryExecutionFactory::create($q, $m)->execSelect();
while (java_is_true(rs.hasNext())) {
$row = $rs->nextSolution();
echo "Carrera: " . $row->getLiteral("carrera")->getString();
}
}
}
pruebaSPARQL::test();
} catch (Exception $e) {
echo "exception:$e";
}
?>
Regards,
Jost Boekemeier
|