示例#1
0
 def test_query2(self):
     with open(join(EXAMPLES, "query2.json")) as query_file:
         q = load(query_file)
     result = apply(q, self.g)
     expected = Graph()
     expected.load(join(EXAMPLES, "query2.result.ttl"), format="turtle")
     assert isomorphic(result.graph, expected), result.graph.serialize(format="turtle")
示例#2
0
 def test_query1(self):
     with open(join(EXAMPLES, "query1.json")) as query_file:
         q = load(query_file)
     results = apply(q, self.g)
     assert_items_equal(results.bindings, [
         {
             #V("p"): U("http://example.org/bob"),
             V("n"): L("Bob"),
         },
         {
             #V("p"): B("charlie"),
             V("n"): L("Charlie"),
         },
         {
             #V("p"): U("http://example.org/dan"),
             V("n"): L("Dan"),
         },
     ])