2017 © Pedro Peláez
 

library raffles

An embeddable RDF store supporting simple querying, searching, geo search and faceted browsing

image

kwijibo/raffles

An embeddable RDF store supporting simple querying, searching, geo search and faceted browsing

  • Wednesday, November 7, 2012
  • by kwijibo
  • Repository
  • 1 Watchers
  • 2 Stars
  • 23 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Raffles is a simple file-based RDF/Graph datastore written in PHP. It is written as a way to dynamically publish small datasets easily on PHP web hosting without using an external database., (*1)

Installation

composer create-project kwijibo/raffles raffles, (*2)

see Composer, (*3)

Creating a Store and Importing Data

    require 'Raffles/lib/rafflesstore.php';
    require_once 'Raffles/vendor/autoload.php';

    $data_dir = __DIR__ . '/data';
    $store = new RafflesStore($data_dir);
    $store->indexPredicates = array(
        'http://www.w3.org/1999/02/22-rdf-syntax-ns#type',
        'http://purl.org/dc/terms/creator',
        'http://purl.org/dc/terms/date',
    );
    // you can configure Raffles to only index specific predicates

    $store->addNamespacePrefix('library', 'http://purl.org/library/');
    // add prefixes you want to use in queries

Getting types of things in the Store

    $types = $store->getTypes();
    // array(
    // http://schema.org/Place => 321,
    // http://schema.org/Person => 456,
    //)

Getting Facets

    $dates = $store->getFacets('http://purl.org/dc/terms/date');

    // array ( "1560" => 4, "1562" => 12, "1570" => 31  )

Basic Path query language

rdf:type=foaf:Person (all things of type Person), (*4)

foaf:made/dct:date=1780 (anyone who made something in 1780), (*5)

    $limit=20;
    $offset=0;
    $results = $store->query("foaf:made/dct:date=1560", $limit, $offset);

Results are returned as a PHP associative array following the RDF JSON structure, (*6)

    array (
    S => array(
        P => array (  
          array(
              value => O, 
              type => literal|uri|bnode 
              [, lang=O_LANG ] 
              [, datatype=O_DATATYPE ]
            )
        )
     )
    $results = $store->search("Edinbu");

Running the tests

php specs/run.php, (*7)

License

This code is Public Domain. Use, copy, or change it freely, at your own risk., (*8)

The Versions

07/11 2012

dev-master

9999999-dev

An embeddable RDF store supporting simple querying, searching, geo search and faceted browsing

  Sources   Download

The Requires

 

by keith alexander