From 9b6866379aed7865dd85343a6b930b476461428c Mon Sep 17 00:00:00 2001 From: aayush17002 <32807623+aayush17002@users.noreply.github.com> Date: Sun, 10 May 2020 13:26:39 +0530 Subject: Updating namespace.py to solve issue #801 Added acceptance clause for "%" in Allowed name chars. --- rdflib/namespace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdflib/namespace.py b/rdflib/namespace.py index 78f71c22..9f09763c 100644 --- a/rdflib/namespace.py +++ b/rdflib/namespace.py @@ -618,7 +618,7 @@ class NamespaceManager(object): NAME_START_CATEGORIES = ["Ll", "Lu", "Lo", "Lt", "Nl"] SPLIT_START_CATEGORIES = NAME_START_CATEGORIES + ['Nd'] NAME_CATEGORIES = NAME_START_CATEGORIES + ["Mc", "Me", "Mn", "Lm", "Nd"] -ALLOWED_NAME_CHARS = [u"\u00B7", u"\u0387", u"-", u".", u"_", u":"] +ALLOWED_NAME_CHARS = [u"\u00B7", u"\u0387", u"-", u".", u"_", u":", u"%"] # http://www.w3.org/TR/REC-xml-names/#NT-NCName -- cgit v1.2.1 From 5f8ce6bf2b92281d4436669a5d888502d1e57e40 Mon Sep 17 00:00:00 2001 From: aayush17002 <32807623+aayush17002@users.noreply.github.com> Date: Sun, 10 May 2020 13:46:15 +0530 Subject: Test file for testing issue #801 Test file to increase the scope of n amespaces. --- test/test_issue801 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/test_issue801 diff --git a/test/test_issue801 b/test/test_issue801 new file mode 100644 index 00000000..b71a55da --- /dev/null +++ b/test/test_issue801 @@ -0,0 +1,23 @@ + """ +Issue 715 - path query chaining issue +Some incorrect matches were found when using oneOrMore ('+') and +zeroOrMore ('*') property paths and specifying neither the +subject or the object. +""" + +from rdflib import Namespace, Graph, BNode, Literal +import unittest + +class TestIssue801(unittest.TestCase): + + def test_issue_801(self): + g = Graph() + example = Namespace('http://example.org/') + g.bind('', example) + node = BNode() + g.add((node, example['first%20name'], Literal('John'))) + print(g.serialize(format="turtle").decode()) + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.1 From ff70fa518475cd86bcc6297a33b4f6076164f953 Mon Sep 17 00:00:00 2001 From: aayush17002 <32807623+aayush17002@users.noreply.github.com> Date: Mon, 25 May 2020 12:06:58 +0530 Subject: Deleting test_issue801 Deleting test_issue801 --- test/test_issue801 | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 test/test_issue801 diff --git a/test/test_issue801 b/test/test_issue801 deleted file mode 100644 index b71a55da..00000000 --- a/test/test_issue801 +++ /dev/null @@ -1,23 +0,0 @@ - """ -Issue 715 - path query chaining issue -Some incorrect matches were found when using oneOrMore ('+') and -zeroOrMore ('*') property paths and specifying neither the -subject or the object. -""" - -from rdflib import Namespace, Graph, BNode, Literal -import unittest - -class TestIssue801(unittest.TestCase): - - def test_issue_801(self): - g = Graph() - example = Namespace('http://example.org/') - g.bind('', example) - node = BNode() - g.add((node, example['first%20name'], Literal('John'))) - print(g.serialize(format="turtle").decode()) - - -if __name__ == "__main__": - unittest.main() -- cgit v1.2.1 From d3f49e7303b8b021de7c76340a479501e5eb6a7b Mon Sep 17 00:00:00 2001 From: aayush17002 <32807623+aayush17002@users.noreply.github.com> Date: Mon, 25 May 2020 12:11:38 +0530 Subject: Updating test file for issue #801 Updated test file to test issue 801 --- test/test_issue801.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/test_issue801.py diff --git a/test/test_issue801.py b/test/test_issue801.py new file mode 100644 index 00000000..f139a0c1 --- /dev/null +++ b/test/test_issue801.py @@ -0,0 +1,20 @@ + """ +Issue 801 - Problem with prefixes created for URIs containing %20 +""" + +from rdflib import Namespace, Graph, BNode, Literal +import unittest + +class TestIssue801(unittest.TestCase): + + def test_issue_801(self): + g = Graph() + example = Namespace('http://example.org/') + g.bind('', example) + node = BNode() + g.add((node, example['first%20name'], Literal('John'))) + print(g.serialize(format="turtle").decode()) + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.1 From 98efc528ed73eada219d906b74f906134739cff7 Mon Sep 17 00:00:00 2001 From: aayush17002 <32807623+aayush17002@users.noreply.github.com> Date: Mon, 25 May 2020 12:45:18 +0530 Subject: Handling error in issue #801 Added assertions for testing issue #801 --- test/test_issue801.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_issue801.py b/test/test_issue801.py index f139a0c1..112016d5 100644 --- a/test/test_issue801.py +++ b/test/test_issue801.py @@ -1,4 +1,4 @@ - """ +""" Issue 801 - Problem with prefixes created for URIs containing %20 """ @@ -13,7 +13,8 @@ class TestIssue801(unittest.TestCase): g.bind('', example) node = BNode() g.add((node, example['first%20name'], Literal('John'))) - print(g.serialize(format="turtle").decode()) + self.assertEqual(g.serialize(format="turtle").decode().split("\n")[-3] == '[] :first%20name "John" .', True) + print (g.serialize(format="turtle").decode()) if __name__ == "__main__": -- cgit v1.2.1 From 12a1d8d06ea3050e3bdd3eaadf7957c8d34e70aa Mon Sep 17 00:00:00 2001 From: aayush17002 <32807623+aayush17002@users.noreply.github.com> Date: Mon, 25 May 2020 17:08:56 +0530 Subject: Updated test for #801 as per latest comment Removed print statement Reformatting assert statement --- test/test_issue801.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/test_issue801.py b/test/test_issue801.py index 112016d5..25fc7434 100644 --- a/test/test_issue801.py +++ b/test/test_issue801.py @@ -13,9 +13,8 @@ class TestIssue801(unittest.TestCase): g.bind('', example) node = BNode() g.add((node, example['first%20name'], Literal('John'))) - self.assertEqual(g.serialize(format="turtle").decode().split("\n")[-3] == '[] :first%20name "John" .', True) - print (g.serialize(format="turtle").decode()) - + self.assertEqual(g.serialize(format="turtle").decode().split("\n")[-3], + '[] :first%20name "John" .') if __name__ == "__main__": unittest.main() -- cgit v1.2.1 From 63a825f2210345e49e2ef0eff103c83eed067be8 Mon Sep 17 00:00:00 2001 From: aayush17002 <32807623+aayush17002@users.noreply.github.com> Date: Tue, 26 May 2020 12:41:45 +0530 Subject: Updating namespace.py to solve issue #801 #1044 --- test/test_issue801.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/test_issue801.py b/test/test_issue801.py index 25fc7434..ae27f346 100644 --- a/test/test_issue801.py +++ b/test/test_issue801.py @@ -1,7 +1,6 @@ """ Issue 801 - Problem with prefixes created for URIs containing %20 """ - from rdflib import Namespace, Graph, BNode, Literal import unittest -- cgit v1.2.1