Skip to content

Commit b56b79e

Browse files
test-cases: RMLTC0024*-CSV: add invalid template test cases (#137)
* test-cases: RMLTC0024*-CSV: add invalid template test cases Contributes to #79 * shapes: tests: add expected failures for invalid templates
1 parent 2a61c20 commit b56b79e

File tree

15 files changed

+109
-1
lines changed

15 files changed

+109
-1
lines changed

shapes/tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ def test_validation_rules(self, path: str) -> None:
4747
print(f'Testing validation with: {path}')
4848
if 'RMLTC0004b' in path or 'RMLTC0007h' in path or \
4949
'RMLTC0012c' in path or 'RMLTC0012d' in path or \
50-
'RMLTC0015b' in path:
50+
'RMLTC0015b' in path or 'RMLTC0024a' in path or \
51+
'RMLTC0024b' in path or 'RMLTC0024c' in path or \
52+
'RMLTC0024d' in path:
5153
with self.assertRaises(Exception):
5254
self._validate_rules(path)
5355
else:

test-cases/RMLTC0024a-CSV/mapping.ttl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
2+
@prefix rml: <http://w3id.org/rml/> .
3+
4+
<http://example.com/base/TriplesMap1> a rml:TriplesMap;
5+
rml:logicalSource [ a rml:LogicalSource;
6+
rml:referenceFormulation rml:CSV;
7+
rml:source [ a rml:RelativePathSource;
8+
rml:root rml:MappingDirectory;
9+
rml:path "student.csv"
10+
]
11+
];
12+
rml:subjectMap [
13+
rml:template "http://example.com/{NON_EXISTING_COLUMN}"
14+
rml:class foaf:Person;
15+
] .

test-cases/RMLTC0024a-CSV/student.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Name
2+
Venus

test-cases/RMLTC0024b-CSV/mapping.ttl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
2+
@prefix rml: <http://w3id.org/rml/> .
3+
4+
<http://example.com/base/TriplesMap1> a rml:TriplesMap;
5+
rml:logicalSource [ a rml:LogicalSource;
6+
rml:referenceFormulation rml:CSV;
7+
rml:source [ a rml:RelativePathSource;
8+
rml:root rml:MappingDirectory;
9+
rml:path "student.csv"
10+
]
11+
];
12+
rml:subjectMap [
13+
rml:template "http://example.com/{{Name}}"
14+
rml:class foaf:Person;
15+
] .

test-cases/RMLTC0024b-CSV/student.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{Name}
2+
Venus

test-cases/RMLTC0024c-CSV/mapping.ttl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
2+
@prefix rml: <http://w3id.org/rml/> .
3+
4+
<http://example.com/base/TriplesMap1> a rml:TriplesMap;
5+
rml:logicalSource [ a rml:LogicalSource;
6+
rml:referenceFormulation rml:CSV;
7+
rml:source [ a rml:RelativePathSource;
8+
rml:root rml:MappingDirectory;
9+
rml:path "student.csv"
10+
]
11+
];
12+
rml:subjectMap [
13+
rml:template "http://example.com/{N\ame}"
14+
rml:class foaf:Person;
15+
] .

test-cases/RMLTC0024c-CSV/student.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
N\ame
2+
Venus

test-cases/RMLTC0024d-CSV/mapping.ttl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
2+
@prefix rml: <http://w3id.org/rml/> .
3+
4+
<http://example.com/base/TriplesMap1> a rml:TriplesMap;
5+
rml:logicalSource [ a rml:LogicalSource;
6+
rml:referenceFormulation rml:CSV;
7+
rml:source [ a rml:RelativePathSource;
8+
rml:root rml:MappingDirectory;
9+
rml:path "student.csv"
10+
]
11+
];
12+
rml:subjectMap [
13+
rml:template "http://example.com/{Name\}"
14+
rml:class foaf:Person;
15+
] .

test-cases/RMLTC0024d-CSV/student.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Name
2+
Venus

test-cases/RMLTC0024e-CSV/mapping.ttl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
2+
@prefix rml: <http://w3id.org/rml/> .
3+
4+
<http://example.com/base/TriplesMap1> a rml:TriplesMap;
5+
rml:logicalSource [ a rml:LogicalSource;
6+
rml:referenceFormulation rml:CSV;
7+
rml:source [ a rml:RelativePathSource;
8+
rml:root rml:MappingDirectory;
9+
rml:path "student.csv"
10+
]
11+
];
12+
rml:subjectMap [
13+
rml:template "http://example.com/{\\{Name\\}}";
14+
rml:class foaf:Person;
15+
] .

test-cases/RMLTC0024e-CSV/output.nq

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<http://example.com/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
2+

test-cases/RMLTC0024e-CSV/student.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{Name}
2+
Venus

test-cases/RMLTC0024f-CSV/mapping.ttl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
2+
@prefix rml: <http://w3id.org/rml/> .
3+
4+
<http://example.com/base/TriplesMap1> a rml:TriplesMap;
5+
rml:logicalSource [ a rml:LogicalSource;
6+
rml:referenceFormulation rml:CSV;
7+
rml:source [ a rml:RelativePathSource;
8+
rml:root rml:MappingDirectory;
9+
rml:path "student.csv"
10+
]
11+
];
12+
rml:subjectMap [
13+
rml:template "http://example.com/{N\\\ame}";
14+
rml:class foaf:Person;
15+
] .

test-cases/RMLTC0024f-CSV/output.nq

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<http://example.com/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
2+

test-cases/RMLTC0024f-CSV/student.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
N\ame
2+
Venus

0 commit comments

Comments
 (0)