Skip to content

Commit

Permalink
test-cases: RMLTC0024*-CSV: add invalid template test cases (#137)
Browse files Browse the repository at this point in the history
* test-cases: RMLTC0024*-CSV: add invalid template test cases

Contributes to #79

* shapes: tests: add expected failures for invalid templates
  • Loading branch information
DylanVanAssche authored Jan 19, 2025
1 parent 2a61c20 commit b56b79e
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 1 deletion.
4 changes: 3 additions & 1 deletion shapes/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def test_validation_rules(self, path: str) -> None:
print(f'Testing validation with: {path}')
if 'RMLTC0004b' in path or 'RMLTC0007h' in path or \
'RMLTC0012c' in path or 'RMLTC0012d' in path or \
'RMLTC0015b' in path:
'RMLTC0015b' in path or 'RMLTC0024a' in path or \
'RMLTC0024b' in path or 'RMLTC0024c' in path or \
'RMLTC0024d' in path:
with self.assertRaises(Exception):
self._validate_rules(path)
else:
Expand Down
15 changes: 15 additions & 0 deletions test-cases/RMLTC0024a-CSV/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [ a rml:LogicalSource;
rml:referenceFormulation rml:CSV;
rml:source [ a rml:RelativePathSource;
rml:root rml:MappingDirectory;
rml:path "student.csv"
]
];
rml:subjectMap [
rml:template "http://example.com/{NON_EXISTING_COLUMN}"
rml:class foaf:Person;
] .
2 changes: 2 additions & 0 deletions test-cases/RMLTC0024a-CSV/student.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name
Venus
15 changes: 15 additions & 0 deletions test-cases/RMLTC0024b-CSV/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [ a rml:LogicalSource;
rml:referenceFormulation rml:CSV;
rml:source [ a rml:RelativePathSource;
rml:root rml:MappingDirectory;
rml:path "student.csv"
]
];
rml:subjectMap [
rml:template "http://example.com/{{Name}}"
rml:class foaf:Person;
] .
2 changes: 2 additions & 0 deletions test-cases/RMLTC0024b-CSV/student.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{Name}
Venus
15 changes: 15 additions & 0 deletions test-cases/RMLTC0024c-CSV/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [ a rml:LogicalSource;
rml:referenceFormulation rml:CSV;
rml:source [ a rml:RelativePathSource;
rml:root rml:MappingDirectory;
rml:path "student.csv"
]
];
rml:subjectMap [
rml:template "http://example.com/{N\ame}"
rml:class foaf:Person;
] .
2 changes: 2 additions & 0 deletions test-cases/RMLTC0024c-CSV/student.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
N\ame
Venus
15 changes: 15 additions & 0 deletions test-cases/RMLTC0024d-CSV/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [ a rml:LogicalSource;
rml:referenceFormulation rml:CSV;
rml:source [ a rml:RelativePathSource;
rml:root rml:MappingDirectory;
rml:path "student.csv"
]
];
rml:subjectMap [
rml:template "http://example.com/{Name\}"
rml:class foaf:Person;
] .
2 changes: 2 additions & 0 deletions test-cases/RMLTC0024d-CSV/student.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name
Venus
15 changes: 15 additions & 0 deletions test-cases/RMLTC0024e-CSV/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [ a rml:LogicalSource;
rml:referenceFormulation rml:CSV;
rml:source [ a rml:RelativePathSource;
rml:root rml:MappingDirectory;
rml:path "student.csv"
]
];
rml:subjectMap [
rml:template "http://example.com/{\\{Name\\}}";
rml:class foaf:Person;
] .
2 changes: 2 additions & 0 deletions test-cases/RMLTC0024e-CSV/output.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<http://example.com/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

2 changes: 2 additions & 0 deletions test-cases/RMLTC0024e-CSV/student.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{Name}
Venus
15 changes: 15 additions & 0 deletions test-cases/RMLTC0024f-CSV/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [ a rml:LogicalSource;
rml:referenceFormulation rml:CSV;
rml:source [ a rml:RelativePathSource;
rml:root rml:MappingDirectory;
rml:path "student.csv"
]
];
rml:subjectMap [
rml:template "http://example.com/{N\\\ame}";
rml:class foaf:Person;
] .
2 changes: 2 additions & 0 deletions test-cases/RMLTC0024f-CSV/output.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<http://example.com/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

2 changes: 2 additions & 0 deletions test-cases/RMLTC0024f-CSV/student.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
N\ame
Venus

0 comments on commit b56b79e

Please sign in to comment.