Skip to content

Commit

Permalink
Merge pull request #860 from white-gecko/feature/unquoteAndUriquoteDa…
Browse files Browse the repository at this point in the history
…tatype

Fix #859. Unquote and Uriquote Literal Datatype.
  • Loading branch information
gromgull authored Oct 27, 2018
2 parents d7f6b99 + 48275ba commit 99c23be
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rdflib/plugins/parsers/ntriples.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ def literal(self):
else:
lang = None
if dtype:
dtype = dtype
dtype = unquote(dtype)
dtype = uriquote(dtype)
dtype = URI(dtype)
else:
dtype = None
if lang and dtype:
Expand Down
1 change: 1 addition & 0 deletions test/nt/quote-01.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://ar.dbpedia.org/resource/\u0625\u0643\u0634\u0627\u0641_\u0645\u062B\u0627\u0646\u064A> <http://ar.dbpedia.org/property/meshnumber> "12.74"^^<http://dbpedia.org/datatype/nicaraguanC\u00F3rdoba> .
1 change: 1 addition & 0 deletions test/nt/quote-02.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://ar.dbpedia.org/resource/إكشاف_مثاني> <http://ar.dbpedia.org/property/meshnumber> "12.74"^^<http://dbpedia.org/datatype/nicaraguanCórdoba> .
11 changes: 11 additions & 0 deletions test/test_nt_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@

class NTTestCase(unittest.TestCase):

def testIssue859(self):
graphA = Graph()
graphB = Graph()
graphA.parse("test/nt/quote-01.nt", format="ntriples")
graphB.parse("test/nt/quote-02.nt", format="ntriples")
for subjectA,predicateA,objA in graphA:
for subjectB,predicateB,objB in graphB:
self.assertEqual(subjectA, subjectB)
self.assertEqual(predicateA, predicateB)
self.assertEqual(objA, objB)

def testIssue78(self):
g = Graph()
g.add((URIRef("foo"), URIRef("foo"), Literal(u"R\u00E4ksm\u00F6rg\u00E5s")))
Expand Down

0 comments on commit 99c23be

Please sign in to comment.