Working with NamedGraphSets:
<?php //get a GraphSet from the ModelFactory // Create a new NamedGraphsMem //create Quads //add Quads to the GraphSet. Thee needed NamedGraphs will be created automatically //add a NamedGraph to the Set //Is the Graph "http://graph1" part of the GraphSet? //remove 'http://graph2' from the set //Is the Graph "http://graph2" part of the GraphSet? //creat basic statement //get a Graph from the Set and add a basic statement //remove Quad5 //get an iterator over all Quads //get an iterator over all Quads in 'http://graph3' //how many Quads are in the whole GraphSet //does the GraphSet contain the Quad (http://graph4, http://subject4, http://predicate4, http://object4) ? |
Output:
Is the Graph "http://graph1" part of the GraphSet?
bool(true)
Is the Graph "http://graph2" part of the GraphSet?
bool(false)
All Quads:
GraphName(http://graph3) Triple(Resource("http://subject1"), Resource("http://predicate1"), Resource("http://object1"))
GraphName(http://graph3) Triple(Resource("http://subject2"), Resource("http://predicate2"), Resource("http://object2"))
GraphName(http://graph4) Triple(Resource("http://subject3"), Resource("http://predicate3"), Resource("http://object3"))
GraphName(http://graph4) Triple(Resource("http://subject4"), Resource("http://predicate4"), Resource("http://object4"))
All Quads in http://graph3:
GraphName(http://graph3) Triple(Resource("http://subject1"), Resource("http://predicate1"), Resource("http://object1"))
GraphName(http://graph3) Triple(Resource("http://subject2"), Resource("http://predicate2"), Resource("http://object2"))
How many Quads are in the whole GraphSet?
4
Does the GraphSet contain the Quad (http://graph4, http://subject4, http://predicate4, http://object4) ?
bool(true)