Assert.assertNotNull(graph);
}
@Test
public void testUnionGraph() throws Exception{
TcProvider provider = getInstance();
UriRef type = new UriRef("http://www.w3.org/2000/01/rdf-schema#type");
UriRef name = new UriRef("http://schema.org/name");
UriRef personType = new UriRef("http://schema.org/Person");
UriRef companyType = new UriRef("http://schema.org/Company");
UriRef worksFor = new UriRef("http://schema.org/works-for");
//create a graph with persons
MGraph persons = new SimpleMGraph();
UriRef tim = new UriRef("http://people.org/tim.johnson");
persons.add(new TripleImpl(tim, type, personType));
persons.add(new TripleImpl(tim, name, new PlainLiteralImpl("Tim Johnson")));
UriRef john = new UriRef("http://people.org/john.swenson");
persons.add(new TripleImpl(john, type, personType));
persons.add(new TripleImpl(john, name, new PlainLiteralImpl("John Swenson")));
provider.createGraph(new UriRef("urn:persons"), persons.getGraph());
//create a MGraph with data about persons
MGraph orgdata = provider.createMGraph(new UriRef("urn:orgdata"));
UriRef talinor = new UriRef("http://company.org/talinor");
orgdata.add(new TripleImpl(talinor, type, companyType));
orgdata.add(new TripleImpl(talinor, name, new PlainLiteralImpl("Talinor Inc.")));
orgdata.add(new TripleImpl(john, worksFor, talinor));
UriRef kondalor = new UriRef("http://company.org/kondalor");
orgdata.add(new TripleImpl(kondalor, type, companyType));
orgdata.add(new TripleImpl(kondalor, name, new PlainLiteralImpl("Kondalor Ges.m.b.H.")));
orgdata.add(new TripleImpl(tim, worksFor, kondalor));
//now get the union graph
Graph data = provider.getGraph(UNION_GRAPH_NAME);
Assert.assertNotNull(data);
//CLEREZZA-714: getTriples need to correctly return the UnionGraph
data = (Graph)provider.getTriples(UNION_GRAPH_NAME);
Assert.assertNotNull(data);
//NOTE: Jena TDB does not support getSize for the union graph
// int expectedTripleCount = persons.size()+orgdata.size();
// Assert.assertEquals("Uniongraph has "+data.size()
// +" triples (expected "+expectedTripleCount+")",