freeze() public method

Graphite uses ARC2 to parse RDF, which isn't as fast as using a compiled library. I may add support for RAP or something similar. When Graphite loads a triple it indexes it by both subject & object, which also takes a little time. To address this issue, freeze and thaw go some way to help speed things up. freeze takes a graph object, including all the namespaces set with ns() and saves it to disk as a serialised PHP object, which is much faster to load then a large RDF file. It's ideal in a situation where you want to build a site from a single RDF document which is updated occasionally. This example is a command line script you can modify to load and freeze a graph.
public freeze ( $filename )
示例#1
0
#!/usr/bin/php
<?php 
# this is intended to be run on the command-line, but you could run it
# via the web if you wanted.
# you'll need to change all the paths.
require_once "../arc/ARC2.php";
require_once "../Graphite.php";
$graph = new Graphite();
$graph->ns("foo", "http://example.org/foons/");
$graph->load("mydata.rdf");
$graph->freeze("mydata.rdf.graphite");
# to use this graph from a script, use
# $graph = Graphite::thaw( "mydata.rdf.graphite" );