<s> import unittest <EOL> from rdflib . namespace import Namespace , RDF , RDFS <EOL> from rdflib import plugin <EOL> from rdflib . term import URIRef <EOL> from rdflib . store import Store <EOL> from cStringIO import StringIO <EOL> from rdflib . graph import Graph <EOL> from rdflib . graph import ReadOnlyGraphAggregate <EOL> from rdflib . graph import ConjunctiveGraph <EOL> testGraph1N3 = """<STR_LIT>""" <EOL> testGraph2N3 = """<STR_LIT>""" <EOL> testGraph3N3 = """<STR_LIT>""" <EOL> sparqlQ = """<STR_LIT>""" <EOL> sparqlQ2 = """<STR_LIT>""" <EOL> sparqlQ3 = """<STR_LIT>""" <EOL> class GraphAggregates1 ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> memStore = plugin . get ( '<STR_LIT>' , Store ) ( ) <EOL> self . graph1 = Graph ( memStore ) <EOL> self . graph2 = Graph ( memStore ) <EOL> self . graph3 = Graph ( memStore ) <EOL> for n3Str , graph in [ ( testGraph1N3 , self . graph1 ) , <EOL> ( testGraph2N3 , self . graph2 ) , <EOL> ( testGraph3N3 , self . graph3 ) ] : <EOL> graph . parse ( StringIO ( n3Str ) , format = '<STR_LIT>' ) <EOL> self . G = ReadOnlyGraphAggregate ( [ self . graph1 , self . graph2 , self . graph3 ] ) <EOL> def testAggregateRaw ( self ) : <EOL> assert len ( list ( self . G . triples ( ( None , RDF . type , None ) ) ) ) == <NUM_LIT:4> <EOL> assert len ( list ( self . G . triples ( ( URIRef ( "<STR_LIT>" ) , None , None ) ) ) ) == <NUM_LIT:2> <EOL> assert len ( list ( self . G . triples ( ( None , URIRef ( "<STR_LIT>" ) , None ) ) ) ) == <NUM_LIT:3> <EOL> assert len ( self . G ) == <NUM_LIT:8> <EOL> for g in self . G . contexts ( ) : <EOL> assert isinstance ( g , Graph ) <EOL> assert ( URIRef ( "<STR_LIT>" ) , RDF . type , RDFS . Resource ) in self . G <EOL> barPredicates = [ URIRef ( "<STR_LIT>" ) , RDFS . isDefinedBy ] <EOL> assert len ( list ( self . G . triples_choices ( ( URIRef ( "<STR_LIT>" ) , barPredicates , None ) ) ) ) == <NUM_LIT:2> <EOL> class GraphAggregates2 ( unittest . TestCase ) : <EOL> known_issue = True <EOL> sparql = True <EOL> def setUp ( self ) : <EOL> memStore = plugin . get ( '<STR_LIT>' , Store ) ( ) <EOL> self . graph1 = Graph ( memStore , URIRef ( "<STR_LIT>" ) ) <EOL> self . graph2 = Graph ( memStore , URIRef ( "<STR_LIT>" ) ) <EOL> self . graph3 = Graph ( memStore , URIRef ( "<STR_LIT>" ) ) <EOL> for n3Str , graph in [ ( testGraph1N3 , self . graph1 ) , <EOL> ( testGraph2N3 , self . graph2 ) , <EOL> ( testGraph3N3 , self . graph3 ) ] : <EOL> graph . parse ( StringIO ( n3Str ) , format = '<STR_LIT>' ) <EOL> self . graph4 = Graph ( memStore , RDFS ) <EOL> self . graph4 . parse ( RDFS . uri ) <EOL> self . G = ConjunctiveGraph ( memStore ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
