Created
November 20, 2011 23:26
-
-
Save njh/1381151 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Store and retrieve data from a SPARQL 1.1 Graph Store | |
| * | |
| * This example adds a triple containing the current time into | |
| * a local graph store. It then fetches the whole graph out | |
| * and displays the contents. | |
| * | |
| * Note that you will a graph store, for example RedStore, | |
| * running on your local machine in order to test this example. | |
| * | |
| * @package EasyRdf | |
| * @copyright Copyright (c) 2009-2011 Nicholas J Humfrey | |
| * @license http://unlicense.org/ | |
| */ | |
| set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/'); | |
| require_once "EasyRdf.php"; | |
| ?> | |
| <html> | |
| <head> | |
| <title>GraphStore example</title> | |
| </head> | |
| <body> | |
| <?php | |
| // Use a local SPARQL 1.1 Graph Store (eg RedStore) | |
| $gs = new EasyRdf_GraphStore('http://localhost:9000/data/'); | |
| // Add the current time in a graph | |
| $graph1 = new EasyRdf_Graph(); | |
| $graph1->add('http://example.com/test', 'rdfs:label', 'Test'); | |
| $graph1->add('http://example.com/test', 'dc:date', time()); | |
| $gs->replace($graph1, 'http://example.com/OrganizacionInstances.rdf', 'rdfxml'); | |
| // Get the graph back out of the graph store and display it | |
| #$graph2 = $gs->get('http://example.com/OrganizacionInstances.rdf'); | |
| #print $graph2->dump(); | |
| ?> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment