madbob/sparqler

SPARQL object-relational mapping

dev-master 2021-12-05 11:53 UTC

This package is auto-updated.

Last update: 2021-12-05 11:53:40 UTC


README

A SPARQL ORM built on EasyRDF.

Sparqler is a PHP "Object Relational Mapping" to query SPARQL endpoints with an object-oriented interface. It is built on top of EasyRDF, the most popular RDF PHP library around, and uses (mostly) the same classes.

Install

composer require madbob/sparqler

Usage

First of all, you need to init the client.

require('vendor/autoload.php');
use MadBob\Sparqler\Client;

$config = [
    'host' => 'http://localhost:8890/sparql-auth',
    'graph' => 'urn:sparql:tests:insert:informative',
];

$client = new Client($config);

The $config array must/can have the following keys:

  • host: SPARQL endpoint you want to query
  • graph: if defined, all queries are executed on the named graph
  • auth: an optional associative array to access authenticated SPARQL endpoints
  • namespaces: associative array of RDF namespaces you want to use, in the form ['prefix' => 'uri']. If omitted, the default namespaces defined by EasyRDF are kept