示例#1
0
 def test_graph_sparql(self):
     config = {
         'store': {
             'query': 'http://localhost:3030/gk-test/query',
             'update': 'http://localhost:3030/gk-test/update'
         }
     }
     graph = Graph(config=config)
     assert graph.store is not None, graph.store
     assert 'SPARQLUpdateStore' in repr(graph.store), graph.store
     assert graph.buffered is True, graph.buffered
示例#2
0
def make_test_graph(buffered=False):
    from jsongraph.graph import Graph
    config = {
        'buffered': buffered,
        'schemas': {
            'persons': PERSON_URI,
            'organizations': ORG_URI
        }
    }
    if 'JSONGRAPH_TEST_SPARQL_QUERY' in os.environ:
        config['store'] = {
            'query': os.environ.get('JSONGRAPH_TEST_SPARQL_QUERY'),
            'update': os.environ.get('JSONGRAPH_TEST_SPARQL_UPDATE')
        }
    return Graph(config=config, resolver=resolver)
示例#3
0
 def test_invalid_store_config(self):
     Graph(config={'store': {'update': 6, 'query': 'huhu'}})
示例#4
0
 def test_invalid_schema_config(self):
     Graph(config={'schemas': 5})
示例#5
0
 def test_graph_unconfigured(self):
     graph = Graph()
     assert graph.base_uri is not None
     assert graph.resolver is not None
示例#6
0
 def test_graph(self):
     graph = Graph()
     assert 'github.io' in graph.base_uri, graph.base_uri
     assert graph.get_schema({}) == {}, graph.get_schema({})
     assert 'github.io' in repr(graph), repr(graph)
     assert str(graph) in repr(graph), repr(graph)
示例#7
0
 def test_missing_schema(self):
     graph = Graph()
     graph.get_schema('foo')