2017 © Pedro PelĂĄez
 

library php-cayley

PHP Wrapper for the Google's Cayley graph database REST interface.

image

mcuadros/php-cayley

PHP Wrapper for the Google's Cayley graph database REST interface.

  • Tuesday, April 12, 2016
  • by mcuadros
  • Repository
  • 6 Watchers
  • 15 Stars
  • 39 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 1 Versions
  • 3 % Grown

The README.md

php-cayley Build Status

PHP Wrapper for the Google's Cayley graph database REST interface., (*1)

Cayley is an open-source graph inspired by the graph database behind Freebase and Google's Knowledge Graph. Its goal is to be a part of the developer's toolbox where Linked Data and graph-shaped data (semantic webs, social networks, etc) in general are concerned., (*2)

The Cayley's default query language is called Gremlin based on JavaScript. php-cayley is a replica of this Gremlin Javascript API in PHP, all the methods and patterns from Gremlin are applicable to this library., (*3)

Requirements

  • php >=5.5.0
  • guzzlehttp/guzzle ~6.0

Installation

The recommended way to install php-cayley is through composer. You can see the package information on Packagist., (*4)

{
    "require": {
        "mcuadros/php-cayley": "dev-master"
    }
}

Usage

Basic example

$cayley = new Cayley\Client();
$query = $cayley->graph()->vertex('Humphrey Bogart')->all();
$result = $cayley->query($query);
print_r($result);

Morphism example

$cayley = new Cayley\Client();

$filmToActor = $cayley->graph()
    ->morphism()
    ->out('/film/film/starring')
    ->out('/film/performance/actor');

$query = $cayley->graph()
    ->vertex()
    ->has('name', 'Casablanca')
    ->follow($filmToActor)
    ->out('name')
    ->all();

$starring = $cayley->query($query);
foreach($starring as $actor) {
    var_dump($actor['id']);
}

These examples are based on the data contained in the example database 30kmoviedata.nq.gz, (*5)

For more information please read Gremlin Javascript API documentation., (*6)

Tests

Tests are in the tests folder. To run them, you need PHPUnit. Example:, (*7)

$ phpunit --configuration phpunit.xml.dist

License

MIT, see LICENSE, (*8)

The Versions

12/04 2016

dev-master

9999999-dev http://github.com/mcuadros/php-cayley

PHP Wrapper for the Google's Cayley graph database REST interface.

  Sources   Download

MIT

The Requires

 

The Development Requires