createGraph('http://graph2'); //create Quads $quad1= new Quad(new Resource('http://graph3'),new Resource('http://subject1'),new Resource('http://predicate1'),new Resource('http://object1')); $quad2= new Quad(new Resource('http://graph3'),new Resource('http://subject2'),new Resource('http://predicate2'),new Resource('http://object2')); $quad3= new Quad(new Resource('http://graph4'),new Resource('http://subject3'),new Resource('http://predicate3'),new Resource('http://object3')); $quad5= new Quad(new Resource('http://graph4'),new Resource('http://subject5'),new Resource('http://predicate5'),new Resource('http://object5')); //add Quads to the GraphSet. Thee needed NamedGraphs will be created automatically $graphset->addQuad($quad1); $graphset->addQuad($quad3); $graphset->addQuad($quad2); //add a NamedGraph to the Set $graphset->addNamedGraph($graph1); //Is the Graph "http://graph1" part of the GraphSet? echo 'Is the Graph "http://graph1" part of the GraphSet?
'; var_dump($graphset->containsNamedGraph('http://graph1')); echo'

'; //remove 'http://graph2' from the set $graphset->removeNamedGraph('http://graph2'); //Is the Graph "http://graph2" part of the GraphSet? echo 'Is the Graph "http://graph2" part of the GraphSet?
'; var_dump($graphset->containsNamedGraph('http://graph2')); echo'

'; //creat basic statement $statement=new Statement(new Resource('http://subject4'),new Resource('http://predicate4'),new Resource('http://object4')); //get a Graph from the Set and add a basic statement $graph4=&$graphset->getNamedGraph('http://graph4'); $graph4->add($statement); //remove Quad5 $graphset->removeQuad($quad5); //get an iterator over all Quads echo '

All Quads:
'; for($iterator = $graphset->findInNamedGraphs(null,null,null,null); $iterator->valid(); $iterator->next()) { $quad=$iterator->current(); echo $quad->toString().'
'; }; //get an iterator over all Quads in 'http://graph3' echo '

All Quads in http://graph3:
'; for($iterator = $graphset->findInNamedGraphs(new resource('http://graph3'),null,null,null); $iterator->valid(); $iterator->next()) { $quad=$iterator->current(); echo $quad->toString().'
'; }; //how many Quads are in the whole GraphSet echo '

How many Quads are in the whole GraphSet?
'; echo $graphset->countQuads(); //does the GraphSet contain the Quad (http://graph4, http://subject4, http://predicate4, http://object4) ? echo '

Does the GraphSet contain the Quad (http://graph4, http://subject4, http://predicate4, http://object4) ?
'; var_dump($graphset->containsQuad(new Resource('http://graph4'),new Resource('http://subject4'),new Resource('http://predicate4'),new Resource('http://object4'))); ?>