2017 © Pedro Peláez
 

library phpsesame

Php sesame interface

image

labxxi/phpsesame

Php sesame interface

  • Tuesday, May 27, 2014
  • by labxxi
  • Repository
  • 1 Watchers
  • 2 Stars
  • 74 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

=========, (*1)

phpsesame

Fork of the alex latchford sesame interface https://github.com/alexlatchford/phpSesame. Inspired by the work of Julian Klotz https://github.com/julianklotz/phpSesame.git, and Andreas Thalhammer https://github.com/athalhammer/phpSesame.git, (*2)

Requirements

  • PHP 5+ <http://php.net/>_ - (There shouldn't be any subversion dependencies, but I haven't checked thoroughly)
  • HTTP_Request2 <http://pear.php.net/package/HTTP_Request2>_
  • semsol/ARC2 <https://github.com/semsol/arc2> library, available here on github, is strongly recommended to parse results or generate rdf.

Examples

I am assuming at this point you have installed and configured Sesame, have a repository set up and the REST API functioning correctly. If not then please consult the Sesame documentation <http://www.openrdf.org/doc/sesame2/users/>_., (*3)

Using the Library

To get the library up and running all you need is::, (*4)

require_once "path/to/phpSesame/phpSesame.php";

$sesame = array('url' => 'http://localhost:8080/openrdf-sesame', 'repository' => 'exampleRepo', 'charset' => 'UTF-8');
$store = new phpSesame($sesame['url'], $sesame['repository'],  $sesame['charset']);

You can change the repository you are working on at any time by calling::, (*5)

$store->setRepository("newRepo");

Charset param is used for both content type and accept headers params. You can set them specifically by calling::, (*6)

    $store->setAcceptCharset();
    $store->setContentCharset();

Querying a Store

The simplest way to query a store is::, (*7)

$sparql = "PREFIX foaf:<http://xmlns.com/foaf/0.1/>
SELECT ?s ?o WHERE { ?s foaf:name ?o } LIMIT 100";
$resultFormat = phpSesame::SPARQL_XML; // The expected return type, will return a phpSesame_SparqlRes object (Optional)
$lang = "sparql"; // Can also choose SeRQL (Optional)
$infer = true; // Can also choose to explicitly disallow inference. (Optional)

$result = $store->query($sparql, $resultFormat, $lang, $infer);

Using ARC2 for results::, (*8)

    $parser = ARC2::getSPARQLXMLResultParser();
    $parser->parse('', $result);
    foreach($parser->getRows() as $row) {
            echo "Subject: " . $row['s'] . ", Object: " . $row['o'] . ".";
    }

Documentation will be updated with new features examples soon., (*9)

The Versions

27/05 2014

dev-master

9999999-dev

Php sesame interface

  Sources   Download

W3C

The Requires

  • php >=5.3.0

 

by Pipet Mathieu

rdf sparql sesame

27/05 2014

v2.0.0

2.0.0.0

Php sesame interface

  Sources   Download

W3C

The Requires

  • php >=5.3.0

 

by Pipet Mathieu

rdf sparql sesame

17/04 2014

v1.0.0

1.0.0.0

Php sesame interface

  Sources   Download

W3C

The Requires

  • php >=5.3.0

 

by Pipet Mathieu

rdf sparql sesame