Example #1
0
 def test_create_sparql_insert_row_literal(self):
     row = bibframe.create_sparql_insert_row(bibframe.BF.title,
                                             rdflib.Literal("Test Title"))
     self.assertEqual(row, """<> bf:title "Test Title" .\n""")
     row = bibframe.create_sparql_insert_row(
         bibframe.BF.title, rdflib.Literal(""" The "Best" Test Title"""))
     self.assertEqual(row,
                      """<> bf:title ''' The "Best" Test Title''' .\n""")
Example #2
0
 def test_create_sparql_insert_row_literal(self):
     row = bibframe.create_sparql_insert_row(
         bibframe.BF.title,
         rdflib.Literal("Test Title"))
     self.assertEqual(
         row,
         """<> bf:title "Test Title" .\n""")
     row = bibframe.create_sparql_insert_row(
         bibframe.BF.title,
         rdflib.Literal(""" The "Best" Test Title"""))
     self.assertEqual(
         row,
         """<> bf:title ''' The "Best" Test Title''' .\n""")
Example #3
0
 def test_create_sparql_insert_row_invalid_urlref(self):
     invalid_url_row = bibframe.create_sparql_insert_row(
         bibframe.BF.instanceOf, rdflib.URIRef('http://catalog/Work 678'))
     self.assertEqual(invalid_url_row,
                      """<> bf:instanceOf "http://catalog/Work 678" .\n""")
     # This test case comes from loading graph at
     # http://bibframe.org/resources/sample-lc-2/bibframe.rdf
     invalid_loc_row = bibframe.create_sparql_insert_row(
         bibframe.BF.classificationValue,
         rdflib.URIRef(
             'http://id.loc.gov/authorities/classification/HF3224.6 R36'))
     self.assertEqual(
         invalid_loc_row,
         """<> bf:classificationValue "http://id.loc.gov/authorities/classification/HF3224.6 R36" .\n"""
     )
Example #4
0
 def test_create_sparql_insert_row_invalid_urlref(self):
     invalid_url_row =  bibframe.create_sparql_insert_row(
         bibframe.BF.instanceOf,
         rdflib.URIRef('http://catalog/Work 678'))
     self.assertEqual(
         invalid_url_row,
         """<> bf:instanceOf "http://catalog/Work 678" .\n""")
     # This test case comes from loading graph at
     # http://bibframe.org/resources/sample-lc-2/bibframe.rdf
     invalid_loc_row = bibframe.create_sparql_insert_row(
         bibframe.BF.classificationValue,
         rdflib.URIRef('http://id.loc.gov/authorities/classification/HF3224.6 R36'))
     self.assertEqual(
         invalid_loc_row,
         """<> bf:classificationValue "http://id.loc.gov/authorities/classification/HF3224.6 R36" .\n""")
Example #5
0
 def test_create_sparql_insert_row_bnode(self):
     row = bibframe.create_sparql_insert_row(
         bibframe.BF.provider,
         rdflib.BNode("67788999"))
     self.assertEqual(
         row,
         """<> bf:provider "BNODE:67788999" .\n""")
Example #6
0
 def test_create_sparql_insert_row_valid_urlref(self):
     valid_url_row = bibframe.create_sparql_insert_row(
         bibframe.BF.instanceOf,
         rdflib.URIRef('http://localhost/Work/678'))
     self.assertEqual(
         valid_url_row,
         """<> bf:instanceOf <http://localhost/Work/678> .\n""")
Example #7
0
 def test_create_sparql_insert_row_bnode(self):
     row = bibframe.create_sparql_insert_row(bibframe.BF.provider,
                                             rdflib.BNode("67788999"))
     self.assertEqual(row, """<> bf:provider "BNODE:67788999" .\n""")
Example #8
0
 def test_create_sparql_insert_row_valid_urlref(self):
     valid_url_row = bibframe.create_sparql_insert_row(
         bibframe.BF.instanceOf, rdflib.URIRef('http://localhost/Work/678'))
     self.assertEqual(
         valid_url_row,
         """<> bf:instanceOf <http://localhost/Work/678> .\n""")