def test_extract_prefix(self):
     sparql_network = SPARQLNetwork()
     uri_to_prefix = {
         'http://www.w3.org/1999/02/22-rdf-syntax-ns#type': 'rdf',
         'http://kelvinlawrence.net/air-routes/class/Airport': 'class',
         'http://kelvinlawrence.net/air-routes/resource/24': 'resource',
         'http://www.w3.org/2000/01/rdf-schema#': 'rdfs'
     }
     for k in uri_to_prefix:
         prefix = sparql_network.extract_prefix(k)
         self.assertEqual(uri_to_prefix[k], prefix)
 def test_extract_conflicting_prefix(self):
     sparql_network = SPARQLNetwork()
     uri_to_prefix = {
         'http://kelvinlawrence.net/air-routes/resource/24': 'resource',
         'http://kelvinlawrence.net/class/resource/24': 'resource-2',
         'http://example/resource/24': 'resource-3',
         'http://example.org/index.html#section2': 'index.html',
         # this is invalid uri syntax but Neptune allows it.
         'http://example.org/index.html#section2#point1': 'index.html',
         'http://example.org/index.html#/user/orders/1': 'index.html'
     }
     for k in uri_to_prefix:
         prefix = sparql_network.extract_prefix(k)
         self.assertEqual(uri_to_prefix[k], prefix)