ubccr/ralph

A simple SPARQL client built on top of Guzzle.

0.5 2018-04-09 16:01 UTC

This package is not auto-updated.

Last update: 2024-04-10 22:54:51 UTC


README

RDF Abstraction Layer for PHP: A simple SPARQL client built on top of Guzzle.

Take a look at the list target in the Makefile for how to use make to manage the project.

An example of a query against the British Museum SPARQL endpoint:

$result = (new CCR\Sparql\SparqlClient(new GuzzleHttp\Client()));
    ->withEndpoint('http://collection.britishmuseum.org/sparql')
    ->withPrefix('crm', 'http://erlangen-crm.org/current/')
    ->withPrefix('fts', 'http://www.ontotext.com/owlim/fts#');
    ->query('
        SELECT DISTINCT ?obj
        {
            ?obj crm:P102_has_title ?title .
            ?title rdfs:label ?label .
            FILTER(STR(?label) = "Hoa Hakananai\'a")
        }
    ');
print_r($result);