Skip to content

Commit bfa4249

Browse files
elsdvleeDylanVanAsschepmaria
authored
Test cases (#59)
## What's changed <!-- Give a concise description of the change --> Adapting and extending the test cases ## Change checklist - [x] updated ontology, where necessary - [x] updated shapes, where necessary - [x] added or updated test cases, where necessary - [x] any TODOs have been turned into trackable issues and referenced where necessary ## Issue reference <!-- For example: --> <!-- Fixes #{ISSUE}. --> <!-- Resolves #{ISSUE}. --> --------- Co-authored-by: Dylan Van Assche <[email protected]> Co-authored-by: Pano Maria <[email protected]>
1 parent 4c6d4d9 commit bfa4249

File tree

150 files changed

+7895
-1738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+7895
-1738
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
- name: Run tests
2727
run: |
2828
cd shapes
29-
python3 tests.py
29+
python3 tests.py -vvv

shapes/lv.ttl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ rmlsh:LogicalViewShape a sh:NodeShape ;
4646
sh:path rml:field ;
4747
sh:minCount 1 ;
4848
sh:nodeKind sh:BlankNodeOrIRI ;
49-
sh:xone (
49+
sh:or (
5050
[ sh:node rmlsh:ExpressionFieldShape ]
5151
[ sh:node rmlsh:IterableFieldShape ]
5252
)
@@ -114,7 +114,7 @@ rmlsh:FieldShape a sh:NodeShape ;
114114
""" ;
115115
sh:path rml:field ;
116116
sh:nodeKind sh:BlankNodeOrIRI ;
117-
sh:xone (
117+
sh:or (
118118
[ sh:node rmlsh:ExpressionFieldShape ]
119119
[ sh:node rmlsh:IterableFieldShape ]
120120
)
@@ -154,7 +154,7 @@ rmlsh:ExpressionFieldShape a sh:NodeShape ;
154154
sh:path rml:field ;
155155
sh:nodeKind sh:BlankNodeOrIRI ;
156156
## Disabled due to shape recursion. This is covered by rmlsh:FieldShape
157-
# sh:xone (
157+
# sh:or (
158158
# [ sh:node rmlsh:ExpressionFieldShape ]
159159
# [ sh:node rmlsh:IterableFieldShape ]
160160
# )
@@ -197,7 +197,6 @@ rmlsh:IterableFieldShape a sh:NodeShape ;
197197
sh:path rml:field ;
198198
sh:minCount 1 ;
199199
sh:nodeKind sh:BlankNodeOrIRI ;
200-
sh:node rmlsh:ExpressionFieldShape ;
201200
] .
202201

203202
rmlsh:LogicalViewJoinShape a sh:NodeShape ;
@@ -246,7 +245,7 @@ rmlsh:LogicalViewJoinShape a sh:NodeShape ;
246245
sh:path rml:field ;
247246
sh:minCount 1 ;
248247
sh:nodeKind sh:BlankNodeOrIRI ;
249-
sh:xone (
248+
sh:or (
250249
[ sh:node rmlsh:ExpressionFieldShape ]
251250
[ sh:node rmlsh:IterableFieldShape ]
252251
)

test-cases/RMLLVTC0001/README.md renamed to test-cases/RMLLVTC0000a/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## RMLLVTC0001
1+
## RMLLVTC0000a
22

3-
**Title**: Expression Field
3+
**Title**: Logical view on JSON source
44

5-
**Description**: Test expression field
5+
**Description**: Test a view on a hierarchical source
66

77
**Error expected?** No
88

@@ -62,7 +62,7 @@
6262
:triplesMapPerson a rml:TriplesMap ;
6363
rml:logicalSource :jsonView ;
6464
rml:subjectMap [
65-
rml:template "http://example.org/people/{name}" ;
65+
rml:template "http://example.org/person/{name}" ;
6666
] ;
6767
rml:predicateObjectMap [
6868
rml:predicate :hasName ;
@@ -75,8 +75,8 @@
7575

7676
**Output**
7777
```
78-
<http://example.org/people/alice> <http://example.org/hasName> "alice" .
79-
<http://example.org/people/bob> <http://example.org/hasName> "bob" .
78+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
79+
<http://example.org/person/bob> <http://example.org/hasName> "bob" .
8080
8181
```
8282

test-cases/RMLLVTC0001/mapping.ttl renamed to test-cases/RMLLVTC0000a/mapping.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
:triplesMapPerson a rml:TriplesMap ;
2222
rml:logicalSource :jsonView ;
2323
rml:subjectMap [
24-
rml:template "http://example.org/people/{name}" ;
24+
rml:template "http://example.org/person/{name}" ;
2525
] ;
2626
rml:predicateObjectMap [
2727
rml:predicate :hasName ;

test-cases/RMLLVTC0000a/output.nq

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
2+
<http://example.org/person/bob> <http://example.org/hasName> "bob" .

test-cases/RMLLVTC0000b/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
## RMLLVTC0000b
2+
3+
**Title**: Logical view on CSV source
4+
5+
**Description**: Test a view on a tabular source
6+
7+
**Error expected?** No
8+
9+
**Input**
10+
```
11+
name,birthyear
12+
alice,1995
13+
bob,1999
14+
tobias,2005
15+
16+
```
17+
18+
**Mapping**
19+
```
20+
@prefix rml: <http://w3id.org/rml/> .
21+
@prefix : <http://example.org/> .
22+
23+
:csvSource a rml:LogicalSource ;
24+
rml:source [
25+
a rml:RelativePathSource , rml:Source ;
26+
rml:root rml:MappingDirectory ;
27+
rml:path "people.csv" ;
28+
] ;
29+
rml:referenceFormulation rml:CSV .
30+
31+
:csvView a rml:LogicalView ;
32+
rml:viewOn :csvSource ;
33+
rml:field [
34+
a rml:ExpressionField ;
35+
rml:fieldName "name" ;
36+
rml:reference "name" ;
37+
] .
38+
39+
:triplesMapPerson a rml:TriplesMap ;
40+
rml:logicalSource :csvView ;
41+
rml:subjectMap [
42+
rml:template "http://example.org/person/{name}" ;
43+
] ;
44+
rml:predicateObjectMap [
45+
rml:predicate :hasName ;
46+
rml:objectMap [
47+
rml:reference "name" ;
48+
] ;
49+
] .
50+
51+
```
52+
53+
**Output**
54+
```
55+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
56+
<http://example.org/person/bob> <http://example.org/hasName> "bob" .
57+
<http://example.org/person/tobias> <http://example.org/hasName> "tobias" .
58+
```
59+

test-cases/RMLLVTC0000b/mapping.ttl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@prefix rml: <http://w3id.org/rml/> .
2+
@prefix : <http://example.org/> .
3+
4+
:csvSource a rml:LogicalSource ;
5+
rml:source [
6+
a rml:RelativePathSource , rml:Source ;
7+
rml:root rml:MappingDirectory ;
8+
rml:path "people.csv" ;
9+
] ;
10+
rml:referenceFormulation rml:CSV .
11+
12+
:csvView a rml:LogicalView ;
13+
rml:viewOn :csvSource ;
14+
rml:field [
15+
a rml:ExpressionField ;
16+
rml:fieldName "name" ;
17+
rml:reference "name" ;
18+
] .
19+
20+
:triplesMapPerson a rml:TriplesMap ;
21+
rml:logicalSource :csvView ;
22+
rml:subjectMap [
23+
rml:template "http://example.org/person/{name}" ;
24+
] ;
25+
rml:predicateObjectMap [
26+
rml:predicate :hasName ;
27+
rml:objectMap [
28+
rml:reference "name" ;
29+
] ;
30+
] .

test-cases/RMLLVTC0000b/output.nq

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
2+
<http://example.org/person/bob> <http://example.org/hasName> "bob" .
3+
<http://example.org/person/tobias> <http://example.org/hasName> "tobias" .

test-cases/RMLLVTC0000c/README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
## RMLLVTC0000c
2+
3+
**Title**: Logical View on Logical View
4+
5+
**Description**: Test a view on a logical view
6+
7+
**Error expected?** No
8+
9+
**Input**
10+
```
11+
{
12+
"people": [
13+
{
14+
"name": "alice",
15+
"items": [
16+
{
17+
"type": "sword",
18+
"weight": 1500
19+
},
20+
{
21+
"type": "shield",
22+
"weight": 2500
23+
}
24+
]
25+
},
26+
{
27+
"name": "bob",
28+
"items": [
29+
{
30+
"type": "flower",
31+
"weight": 15
32+
}
33+
]
34+
}
35+
]
36+
}
37+
38+
```
39+
40+
**Mapping**
41+
```
42+
@prefix rml: <http://w3id.org/rml/> .
43+
@prefix : <http://example.org/> .
44+
45+
:jsonSource a rml:LogicalSource ;
46+
rml:source [
47+
a rml:RelativePathSource , rml:Source ;
48+
rml:root rml:MappingDirectory ;
49+
rml:path "people.json" ;
50+
] ;
51+
rml:referenceFormulation rml:JSONPath ;
52+
rml:iterator "$.people[*]" .
53+
54+
:jsonView a rml:LogicalView ;
55+
rml:viewOn :jsonSource ;
56+
rml:field [
57+
a rml:ExpressionField ;
58+
rml:fieldName "name" ;
59+
rml:reference "$.name" ;
60+
] .
61+
62+
:jsonViewOnJsonView a rml:LogicalView ;
63+
rml:viewOn :jsonView ;
64+
rml:field [
65+
a rml:ExpressionField ;
66+
rml:fieldName "newName" ;
67+
rml:reference "name" ;
68+
] .
69+
70+
:triplesMapPerson a rml:TriplesMap ;
71+
rml:logicalSource :jsonViewOnJsonView ;
72+
rml:subjectMap [
73+
rml:template "http://example.org/person/{newName}" ;
74+
] ;
75+
rml:predicateObjectMap [
76+
rml:predicate :hasName ;
77+
rml:objectMap [
78+
rml:reference "newName" ;
79+
] ;
80+
] .
81+
82+
```
83+
84+
**Output**
85+
```
86+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
87+
<http://example.org/person/bob> <http://example.org/hasName> "bob" .
88+
89+
```
90+

test-cases/RMLLVTC0000c/mapping.ttl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@prefix rml: <http://w3id.org/rml/> .
2+
@prefix : <http://example.org/> .
3+
4+
:jsonSource a rml:LogicalSource ;
5+
rml:source [
6+
a rml:RelativePathSource , rml:Source ;
7+
rml:root rml:MappingDirectory ;
8+
rml:path "people.json" ;
9+
] ;
10+
rml:referenceFormulation rml:JSONPath ;
11+
rml:iterator "$.people[*]" .
12+
13+
:jsonView a rml:LogicalView ;
14+
rml:viewOn :jsonSource ;
15+
rml:field [
16+
a rml:ExpressionField ;
17+
rml:fieldName "name" ;
18+
rml:reference "$.name" ;
19+
] .
20+
21+
:jsonViewOnJsonView a rml:LogicalView ;
22+
rml:viewOn :jsonView ;
23+
rml:field [
24+
a rml:ExpressionField ;
25+
rml:fieldName "newName" ;
26+
rml:reference "name" ;
27+
] .
28+
29+
:triplesMapPerson a rml:TriplesMap ;
30+
rml:logicalSource :jsonViewOnJsonView ;
31+
rml:subjectMap [
32+
rml:template "http://example.org/person/{newName}" ;
33+
] ;
34+
rml:predicateObjectMap [
35+
rml:predicate :hasName ;
36+
rml:objectMap [
37+
rml:reference "newName" ;
38+
] ;
39+
] .

test-cases/RMLLVTC0000c/output.nq

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
2+
<http://example.org/person/bob> <http://example.org/hasName> "bob" .

test-cases/RMLLVTC0001/output.nq

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)