Skip to content

Commit 5539673

Browse files
committed
Add URDNA2015 test manifest-urdna2015#test059 and fix bnode regex.
1 parent e29a8d9 commit 5539673

File tree

4 files changed

+66
-3
lines changed

4 files changed

+66
-3
lines changed

ld/serialize_nquads.go

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,47 @@ func escape(str string) string {
132132
}
133133

134134
const (
135-
wso = "[ \\t]*"
136-
iri = "(?:<([^>]*)>)"
137-
bnode = "(_:(?:[A-Za-z][A-Za-z0-9]*))"
135+
wso = "[ \\t]*"
136+
iri = "(?:<([^:]+:[^>]*)>)"
137+
138+
// https://www.w3.org/TR/turtle/#grammar-production-BLANK_NODE_LABEL
139+
140+
pnCharsBase = "A-Z" + "a-z" +
141+
"\u00C0-\u00D6" +
142+
"\u00D8-\u00F6" +
143+
"\u00F8-\u02FF" +
144+
"\u0370-\u037D" +
145+
"\u037F-\u1FFF" +
146+
"\u200C-\u200D" +
147+
"\u2070-\u218F" +
148+
"\u2C00-\u2FEF" +
149+
"\u3001-\uD7FF" +
150+
"\uF900-\uFDCF" +
151+
"\uFDF0-\uFFFD"
152+
// TODO:
153+
//"\u10000-\uEFFFF"
154+
155+
pnCharsU = pnCharsBase + "_"
156+
157+
pnChars = pnCharsU +
158+
"0-9" +
159+
"-" +
160+
"\u00B7" +
161+
"\u0300-\u036F" +
162+
"\u203F-\u2040"
163+
164+
blankNodeLabel = "(_:" +
165+
"(?:[" + pnCharsU + "0-9])" +
166+
"(?:(?:[" + pnChars + ".])*(?:[" + pnChars + "]))?" +
167+
")"
168+
169+
// '(_:' +
170+
// '(?:[' + PN_CHARS_U + '0-9])' +
171+
// '(?:(?:[' + PN_CHARS + '.])*(?:[' + PN_CHARS + ']))?' +
172+
// ')';
173+
174+
bnode = blankNodeLabel
175+
138176
plain = "\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\""
139177
datatype = "(?:\\^\\^" + iri + ")"
140178
language = "(?:@([a-z]+(?:-[a-zA-Z0-9]+)*))"

ld/testdata/test059-in.nq

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<urn:ex:s> <urn:ex:p> <urn:ex:o> <urn:ex:g> .
2+
_:s <urn:ex:p> _:o _:g .
3+
_:s_ <urn:ex:p> _:o_ _:g_ .
4+
_:s_s <urn:ex:p> _:o_o _:g_g .
5+
_:s0 <urn:ex:p> _:o0 _:g0 .
6+
_:0s <urn:ex:p> _:0o _:0g .
7+
_:s-0 <urn:ex:p> _:o-0 _:g-0 .
8+
_:_ <urn:ex:p> <urn:ex:o> <urn:ex:g> .

ld/testdata/test059-urdna2015.nq

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<urn:ex:s> <urn:ex:p> <urn:ex:o> <urn:ex:g> .
2+
_:c14n0 <urn:ex:p> <urn:ex:o> <urn:ex:g> .
3+
_:c14n1 <urn:ex:p> _:c14n3 _:c14n2 .
4+
_:c14n10 <urn:ex:p> _:c14n12 _:c14n11 .
5+
_:c14n13 <urn:ex:p> _:c14n15 _:c14n14 .
6+
_:c14n16 <urn:ex:p> _:c14n18 _:c14n17 .
7+
_:c14n4 <urn:ex:p> _:c14n6 _:c14n5 .
8+
_:c14n7 <urn:ex:p> _:c14n9 _:c14n8 .

ld/testdata/urdna2015-manifest.jsonld

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,15 @@
555555
"approval": "rdft:Proposed",
556556
"action": "test058-in.nq",
557557
"result": "test058-urdna2015.nq"
558+
},
559+
{
560+
"id": "manifest-urdna2015#test059",
561+
"type": "rdfn:Urdna2015EvalTest",
562+
"name": "n-quads parsing",
563+
"comment": null,
564+
"approval": "rdft:Proposed",
565+
"action": "test059-in.nq",
566+
"result": "test059-urdna2015.nq"
558567
}
559568
]
560569
}

0 commit comments

Comments
 (0)