Repository: RDFLib/rdflib

Issue:
5.0.0: test suit is failing
```
======================================================================
FAIL: test.test_sparql_service.test_service
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/tkloczko/rpmbuild/BUILD/rdflib-5.0.0/test/test_sparql_service.py", line 20, in test_service
    assert len(results) == 2
AssertionError:
-------------------- >> begin captured logging << --------------------
urllib3.connectionpool: DEBUG: Starting new HTTP connection (1): dbpedia.org:80
urllib3.connectionpool: DEBUG: http://dbpedia.org:80 "GET /sparql?query=+select+%3FdbpHypernym+%3FdbpComment%0A++++where%0A++++%7B%0A++++%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FJohn_Lilburne%3E%0A++++++++%3Chttp%3A%2F%2Fpurl.org%2Flinguistics%2Fgold%2Fhypernym%3E+%3FdbpHypernym+%3B%0A++++++++%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23comment%3E+%3FdbpComment+.%0A%0A++++%7D+&output=json HTTP/1.1" 200 136
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: test.test_sparql_service.test_service_with_bind
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/tkloczko/rpmbuild/BUILD/rdflib-5.0.0/test/test_sparql_service.py", line 42, in test_service_with_bind
    assert len(results) == 2
AssertionError:
-------------------- >> begin captured logging << --------------------
urllib3.connectionpool: DEBUG: Starting new HTTP connection (1): dbpedia.org:80
urllib3.connectionpool: DEBUG: http://dbpedia.org:80 "GET /sparql?query=+select+%3FdbpHypernym+%3FdbpComment+%3FdbpDeathPlace%0A++++where%0A++++%7B%0A++++%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FJohn_Lilburne%3E%0A++++++++%3Chttp%3A%2F%2Fpurl.org%2Flinguistics%2Fgold%2Fhypernym%3E+%3FdbpHypernym+%3B%0A++++++++%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23comment%3E+%3FdbpComment+%3B%0A++++++++%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FdeathPlace%3E+%3FdbpDeathPlace+.%0A%0A++++%7D+VALUES+%28%3FdbpDeathPlace%29+%7B%28%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FEltham%3E%29%7D&output=json HTTP/1.1" 200 153
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: test.test_sparql_service.test_service_with_values
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/tkloczko/rpmbuild/BUILD/rdflib-5.0.0/test/test_sparql_service.py", line 64, in test_service_with_values
    assert len(results) == 2
AssertionError:
-------------------- >> begin captured logging << --------------------
urllib3.connectionpool: DEBUG: Starting new HTTP connection (1): dbpedia.org:80
urllib3.connectionpool: DEBUG: http://dbpedia.org:80 "GET /sparql?query=+select+%3FdbpHypernym+%3FdbpComment+%3FdbpDeathPlace%0A++++where%0A++++%7B%0A++++%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FJohn_Lilburne%3E%0A++++++++%3Chttp%3A%2F%2Fpurl.org%2Flinguistics%2Fgold%2Fhypernym%3E+%3FdbpHypernym+%3B%0A++++++++%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23comment%3E+%3FdbpComment+%3B%0A++++++++%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FdeathPlace%3E+%3FdbpDeathPlace+.%0A%0A++++%7D+VALUES+%28%3FdbpHypernym+%3FdbpDeathPlace%29+%7B%28%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FLeveller%3E+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FLondon%3E%29%7D&output=json HTTP/1.1" 200 153
urllib3.connectionpool: DEBUG: Starting new HTTP connection (1): dbpedia.org:80
urllib3.connectionpool: DEBUG: http://dbpedia.org:80 "GET /sparql?query=+select+%3FdbpHypernym+%3FdbpComment+%3FdbpDeathPlace%0A++++where%0A++++%7B%0A++++%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FJohn_Lilburne%3E%0A++++++++%3Chttp%3A%2F%2Fpurl.org%2Flinguistics%2Fgold%2Fhypernym%3E+%3FdbpHypernym+%3B%0A++++++++%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23comment%3E+%3FdbpComment+%3B%0A++++++++%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FdeathPlace%3E+%3FdbpDeathPlace+.%0A%0A++++%7D+VALUES+%28%3FdbpHypernym+%3FdbpDeathPlace%29+%7B%28%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FLeveller%3E+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FEltham%3E%29%7D&output=json HTTP/1.1" 200 153
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 3231 tests in 28.250s

FAILED (failures=3, skipped=91)
Test failed: <unittest.runner.TextTestResult run=3231 errors=0 failures=3>
error: Test failed: <unittest.runner.TextTestResult run=3231 errors=0 failures=3>
```


Discussion:

Patch:
diff --git a/rdflib/namespace.py b/rdflib/namespace.py
index f9bb86d4..aa1b4d0d 100644
--- a/rdflib/namespace.py
+++ b/rdflib/namespace.py
@@ -292,80 +292,53 @@ FOAF = ClosedNamespace(
     terms=[
         # all taken from http://xmlns.com/foaf/spec/
         "Agent",
-        "Document",
-        "Group",
-        "Image",
-        "LabelProperty",
-        "OnlineAccount",
-        "OnlineChatAccount",
-        "OnlineEcommerceAccount",
-        "OnlineGamingAccount",
-        "Organization",
         "Person",
-        "PersonalProfileDocument",
-        "Project",
-        "account",
-        "accountName",
-        "accountServiceHomepage",
-        "age",
-        "aimChatID",
-        "based_near",
-        "birthday",
-        "currentProject",
+        "name",
+        "title",
+        "img",
         "depiction",
         "depicts",
-        "dnaChecksum",
         "familyName",
-        "family_name",
-        "firstName",
-        "focus",
-        "fundedBy",
-        "geekcode",
-        "gender",
         "givenName",
-        "givenname",
-        "holdsAccount",
-        "homepage",
-        "icqChatID",
-        "img",
-        "interest",
-        "isPrimaryTopicOf",
-        "jabberID",
         "knows",
-        "lastName",
-        "logo",
+        "based_near",
+        "age",
         "made",
         "maker",
-        "mbox",
-        "mbox_sha1sum",
+        "primaryTopic",
+        "primaryTopicOf",
+        "Project",
+        "Organization",
+        "Group",
         "member",
-        "membershipClass",
-        "msnChatID",
-        "myersBriggs",
-        "name",
+        "Document",
+        "Image",
         "nick",
+        "mbox",
+        "homepage",
+        "weblog",
         "openid",
+        "jabberID",
+        "mbox_sha1sum",
+        "interest",
+        "topic_interest",
+        "topic",
         "page",
-        "pastProject",
-        "phone",
-        "plan",
-        "primaryTopic",
-        "publications",
+        "workplaceHomepage",
+        "workInfoHomepage",
         "schoolHomepage",
+        "publications",
+        "currentProject",
+        "pastProject",
+        "account",
+        "OnlineAccount",
+        "accountName",
+        "accountServiceHomepage",
+        "PersonalProfileDocument",
+        "tipjar",
         "sha1",
-        "skypeID",
-        "status",
-        "surname",
-        "theme",
         "thumbnail",
-        "tipjar",
-        "title",
-        "topic",
-        "topic_interest",
-        "weblog",
-        "workInfoHomepage",
-        "workplaceHomepage",
-        "yahooChatID"
+        "logo",
     ],
 )
 GEO = ClosedNamespace(


Test patch:
diff --git a/test/test_namespace.py b/test/test_namespace.py
index 8d4f7fd6..2706467f 100644
--- a/test/test_namespace.py
+++ b/test/test_namespace.py
@@ -101,10 +101,13 @@ class NamespacePrefixTest(unittest.TestCase):
         def add_not_in_namespace(s):
             return FOAF[s]
 
-        # a non-existent FOAF property
+        # a blatantly non-existent FOAF property
         self.assertRaises(KeyError, add_not_in_namespace, "blah")
 
-        # a property name within the FOAF namespace
+        # a deprecated FOAF property
+        self.assertRaises(KeyError, add_not_in_namespace, "firstName")
+
+        # a property name within the core FOAF namespace
         self.assertEqual(
             add_not_in_namespace("givenName"),
             URIRef("http://xmlns.com/foaf/0.1/givenName"),
diff --git a/test/test_sparql_service.py b/test/test_sparql_service.py
index ea1af413..7bfe8e4c 100644
--- a/test/test_sparql_service.py
+++ b/test/test_sparql_service.py
@@ -7,18 +7,20 @@ from . import helper
 
 def test_service():
     g = Graph()
-    q = """select ?dbpHypernym ?dbpComment
+    q = """select ?sameAs ?dbpComment
     where
     { service <http://DBpedia.org/sparql>
     { select ?dbpHypernym ?dbpComment
     where
     {
     <http://dbpedia.org/resource/John_Lilburne>
-        <http://purl.org/linguistics/gold/hypernym> ?dbpHypernym ;
+        <http://www.w3.org/2002/07/owl#sameAs> ?sameAs ;
         <http://www.w3.org/2000/01/rdf-schema#comment> ?dbpComment .
 
     } }  } limit 2"""
     results = helper.query_with_retry(g, q)
+    print(results.vars)
+    print(results.bindings)
     assert len(results) == 2
 
     for r in results:
@@ -27,17 +29,17 @@ def test_service():
 
 def test_service_with_bind():
     g = Graph()
-    q = """select ?dbpHypernym ?dbpComment ?dbpDeathPlace
+    q = """select ?sameAs ?dbpComment ?subject
     where
-    { bind (<http://dbpedia.org/resource/Eltham> as ?dbpDeathPlace)
+    { bind (<http://dbpedia.org/resource/Category:1614_births> as ?subject)
       service <http://DBpedia.org/sparql>
-    { select ?dbpHypernym ?dbpComment ?dbpDeathPlace
+    { select ?sameAs ?dbpComment ?subject
     where
     {
     <http://dbpedia.org/resource/John_Lilburne>
-        <http://purl.org/linguistics/gold/hypernym> ?dbpHypernym ;
+        <http://www.w3.org/2002/07/owl#sameAs> ?sameAs ;
         <http://www.w3.org/2000/01/rdf-schema#comment> ?dbpComment ;
-        <http://dbpedia.org/ontology/deathPlace> ?dbpDeathPlace .
+        <http://purl.org/dc/terms/subject> ?subject .
 
     } }  } limit 2"""
     results = helper.query_with_retry(g, q)
@@ -49,17 +51,17 @@ def test_service_with_bind():
 
 def test_service_with_values():
     g = Graph()
-    q = """select ?dbpHypernym ?dbpComment ?dbpDeathPlace
+    q = """select ?sameAs ?dbpComment ?subject
     where
-    { values (?dbpHypernym ?dbpDeathPlace) {(<http://dbpedia.org/resource/Leveller> <http://dbpedia.org/resource/London>) (<http://dbpedia.org/resource/Leveller> <http://dbpedia.org/resource/Eltham>)}
+    { values (?sameAs ?subject) {(<http://de.dbpedia.org/resource/John_Lilburne> <http://dbpedia.org/resource/Category:1614_births>) (<https://global.dbpedia.org/id/4t6Fk> <http://dbpedia.org/resource/Category:Levellers>)}
       service <http://DBpedia.org/sparql>
-    { select ?dbpHypernym ?dbpComment ?dbpDeathPlace
+    { select ?sameAs ?dbpComment ?subject
     where
     {
     <http://dbpedia.org/resource/John_Lilburne>
-        <http://purl.org/linguistics/gold/hypernym> ?dbpHypernym ;
+        <http://www.w3.org/2002/07/owl#sameAs> ?sameAs ;
         <http://www.w3.org/2000/01/rdf-schema#comment> ?dbpComment ;
-        <http://dbpedia.org/ontology/deathPlace> ?dbpDeathPlace .
+        <http://purl.org/dc/terms/subject> ?subject .
 
     } }  } limit 2"""
     results = helper.query_with_retry(g, q)
@@ -126,7 +128,7 @@ def test_service_with_implicit_select_and_allcaps():
     {
       SERVICE <http://dbpedia.org/sparql>
       {
-        ?s <http://purl.org/linguistics/gold/hypernym> <http://dbpedia.org/resource/Leveller> .
+        ?s <http://www.w3.org/2002/07/owl#sameAs> ?sameAs .
       }
     } LIMIT 3"""
     results = helper.query_with_retry(g, q)