Commit 43345b3f authored by Blaise de Carné 's avatar Blaise de Carné

fix EasyRdf version

parent 6b5218da
Pipeline #49296 passed with stage
in 14 seconds
......@@ -29,7 +29,7 @@
"symfony/config": "^4.0",
"symfony/yaml": "^4.0",
"twig/twig": "^2.4",
"conjecto/easyrdf": "^0.9"
"easyrdf/easyrdf": "^0.9.1"
},
"require-dev": {
"phpunit/phpunit": "^7.1",
......
......@@ -25,15 +25,14 @@ class QueryHydrator
*
* @return array
*
* @throws \EasyRdf\Exception
* @throws \EasyRdf_Exception
*/
public function generate(array $arguments, $astFields, $sparqlResult = '')
{
$this->initEasyRdf();
/** @var resource[] $listRes */
$listRes = [];
if ($sparqlResult) {
$graph = new Graph();
$graph = new \EasyRdf_Graph();
$graph->parse($sparqlResult);
//$type = SparqlUtils::expandUri($entryPoint);
......@@ -67,7 +66,7 @@ class QueryHydrator
$tabResult['_uri'] = $res->getUri();
continue;
}
$property = new Resource(SparqlUtils::expandUri($fieldName));
$property = new \EasyRdf_Resource(SparqlUtils::expandUri($fieldName));
if ($field->hasFields()) {
$tabResult[$fieldName] = [];
......@@ -78,12 +77,12 @@ class QueryHydrator
} else {
if ($res && $res->hasProperty($property)) {
$tabResult[$fieldName] = [];
/** @var \EasyRDF\Resource $res */
/** @var \EasyRdf_Resource $res */
$propertyValues = $res->all($property);
foreach ($propertyValues as $value) {
if ($value instanceof Literal) {
if ($value instanceof \EasyRdf_Literal) {
$tabResult[$fieldName][] = $value->getValue();
} elseif ($value instanceof Resource) {
} elseif ($value instanceof \EasyRdf_Resource) {
if (!$value->isBNode()) {
$tabResult[$fieldName][] = $value->getUri();
}
......@@ -139,9 +138,4 @@ class QueryHydrator
return $tab;
}
private function initEasyRdf()
{
Literal::setDatatypeMapping('xsd:int', 'EasyRdf\Literal\Integer');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment