EasyRdf memory exhausted

74 Views Asked by At

I am using EasyRdf library using linked movie database. On first try it gave error maximum memory utilization then I set memory limit to 999G which exhausted my pc. Following is my code and URL to use database file.

linked Movie database link(https://data.world/linked-data/linkedmdb) used locally after download.

    $query1 =file_get_contents(Yii::getAlias('@app').'\web\rdfs\linkedmovies1.txt');     
    $foaf = new \EasyRdf\Sparql\Client($url);
    $result =  $foaf->query($query1);
    echo "<pre>";
    print_r($result);

Need some hint to execute this.

1

There are 1 best solutions below

1
On

EasyRdf was not designed to handle large datasets in-memory. It was intended to help with the formatting and display of data on a webpage, after the dataset had been narrowed down by some other means.

I just tried loading linkedmdb-18-05-2009-dump.nt into Fuseki. It didn't like some of the triples - I had to replace <http://data.linkedmdb.org/country/iso alpha2> with <http://data.linkedmdb.org/country/iso#alpha2> using my text editor. After that it loaded fine.

I wrote a SPARQL query to find all the films that Tom Hanks has acted in, ordered by label:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX lmdb: <http://data.linkedmdb.org/movie/>

SELECT ?film ?label
WHERE {
  ?film a lmdb:film .
  ?film rdfs:label ?label .
  ?film lmdb:actor <http://data.linkedmdb.org/actor/28255> .
}
ORDER BY ?label

And then I wrote the following PHP script to test querying the Linked Movie DataBase dataset that was loaded into Fuseki:

<?php

require_once realpath(__DIR__.'/..')."/vendor/autoload.php";

$SPARQL_QUERY = file_get_contents('lmdb_query.txt');
$SPARQL_ENDPOINT = 'http://127.0.0.1:3030/ds/sparql';

$sparql = new \EasyRdf\Sparql\Client($SPARQL_ENDPOINT);
$results = $sparql->query($SPARQL_QUERY);

print "<table>\n";
foreach ($results as $row) {
  print "<tr> <td>$row->film</td> <td>$row->label</td> </tr>\n";
}
print "</table>\n";