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 @@ ...@@ -29,7 +29,7 @@
"symfony/config": "^4.0", "symfony/config": "^4.0",
"symfony/yaml": "^4.0", "symfony/yaml": "^4.0",
"twig/twig": "^2.4", "twig/twig": "^2.4",
"conjecto/easyrdf": "^0.9" "easyrdf/easyrdf": "^0.9.1"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^7.1", "phpunit/phpunit": "^7.1",
......
...@@ -25,15 +25,14 @@ class QueryHydrator ...@@ -25,15 +25,14 @@ class QueryHydrator
* *
* @return array * @return array
* *
* @throws \EasyRdf\Exception * @throws \EasyRdf_Exception
*/ */
public function generate(array $arguments, $astFields, $sparqlResult = '') public function generate(array $arguments, $astFields, $sparqlResult = '')
{ {
$this->initEasyRdf();
/** @var resource[] $listRes */ /** @var resource[] $listRes */
$listRes = []; $listRes = [];
if ($sparqlResult) { if ($sparqlResult) {
$graph = new Graph(); $graph = new \EasyRdf_Graph();
$graph->parse($sparqlResult); $graph->parse($sparqlResult);
//$type = SparqlUtils::expandUri($entryPoint); //$type = SparqlUtils::expandUri($entryPoint);
...@@ -67,7 +66,7 @@ class QueryHydrator ...@@ -67,7 +66,7 @@ class QueryHydrator
$tabResult['_uri'] = $res->getUri(); $tabResult['_uri'] = $res->getUri();
continue; continue;
} }
$property = new Resource(SparqlUtils::expandUri($fieldName)); $property = new \EasyRdf_Resource(SparqlUtils::expandUri($fieldName));
if ($field->hasFields()) { if ($field->hasFields()) {
$tabResult[$fieldName] = []; $tabResult[$fieldName] = [];
...@@ -78,12 +77,12 @@ class QueryHydrator ...@@ -78,12 +77,12 @@ class QueryHydrator
} else { } else {
if ($res && $res->hasProperty($property)) { if ($res && $res->hasProperty($property)) {
$tabResult[$fieldName] = []; $tabResult[$fieldName] = [];
/** @var \EasyRDF\Resource $res */ /** @var \EasyRdf_Resource $res */
$propertyValues = $res->all($property); $propertyValues = $res->all($property);
foreach ($propertyValues as $value) { foreach ($propertyValues as $value) {
if ($value instanceof Literal) { if ($value instanceof \EasyRdf_Literal) {
$tabResult[$fieldName][] = $value->getValue(); $tabResult[$fieldName][] = $value->getValue();
} elseif ($value instanceof Resource) { } elseif ($value instanceof \EasyRdf_Resource) {
if (!$value->isBNode()) { if (!$value->isBNode()) {
$tabResult[$fieldName][] = $value->getUri(); $tabResult[$fieldName][] = $value->getUri();
} }
...@@ -139,9 +138,4 @@ class QueryHydrator ...@@ -139,9 +138,4 @@ class QueryHydrator
return $tab; 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