Skip to content

Commit

Permalink
Merge pull request #1220 from RDFLib/foaf_fix
Browse files Browse the repository at this point in the history
fix foaf ClosedNamespace
  • Loading branch information
white-gecko committed Jan 28, 2021
2 parents 8e3c771 + 07c72de commit 3b7f0ed
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 37 deletions.
91 changes: 59 additions & 32 deletions rdflib/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,53 +292,80 @@ def term(self, name):
terms=[
# all taken from http://xmlns.com/foaf/spec/
"Agent",
"Document",
"Group",
"Image",
"LabelProperty",
"OnlineAccount",
"OnlineChatAccount",
"OnlineEcommerceAccount",
"OnlineGamingAccount",
"Organization",
"Person",
"name",
"title",
"img",
"PersonalProfileDocument",
"Project",
"account",
"accountName",
"accountServiceHomepage",
"age",
"aimChatID",
"based_near",
"birthday",
"currentProject",
"depiction",
"depicts",
"dnaChecksum",
"familyName",
"family_name",
"firstName",
"focus",
"fundedBy",
"geekcode",
"gender",
"givenName",
"givenname",
"holdsAccount",
"homepage",
"icqChatID",
"img",
"interest",
"isPrimaryTopicOf",
"jabberID",
"knows",
"based_near",
"age",
"lastName",
"logo",
"made",
"maker",
"primaryTopic",
"primaryTopicOf",
"Project",
"Organization",
"Group",
"mbox",
"mbox_sha1sum",
"member",
"Document",
"Image",
"membershipClass",
"msnChatID",
"myersBriggs",
"name",
"nick",
"mbox",
"homepage",
"weblog",
"openid",
"jabberID",
"mbox_sha1sum",
"interest",
"topic_interest",
"topic",
"page",
"workplaceHomepage",
"workInfoHomepage",
"schoolHomepage",
"publications",
"currentProject",
"pastProject",
"account",
"OnlineAccount",
"accountName",
"accountServiceHomepage",
"PersonalProfileDocument",
"tipjar",
"phone",
"plan",
"primaryTopic",
"publications",
"schoolHomepage",
"sha1",
"skypeID",
"status",
"surname",
"theme",
"thumbnail",
"logo",
"tipjar",
"title",
"topic",
"topic_interest",
"weblog",
"workInfoHomepage",
"workplaceHomepage",
"yahooChatID"
],
)
GEO = ClosedNamespace(
Expand Down
7 changes: 2 additions & 5 deletions test/test_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,10 @@ def test_closed_namespace(self):
def add_not_in_namespace(s):
return FOAF[s]

# a blatantly non-existent FOAF property
# a non-existent FOAF property
self.assertRaises(KeyError, add_not_in_namespace, "blah")

# a deprecated FOAF property
self.assertRaises(KeyError, add_not_in_namespace, "firstName")

# a property name within the core FOAF namespace
# a property name within the FOAF namespace
self.assertEqual(
add_not_in_namespace("givenName"),
URIRef("http://xmlns.com/foaf/0.1/givenName"),
Expand Down

0 comments on commit 3b7f0ed

Please sign in to comment.