Skip to content

Commit f86d900

Browse files
TheRazoraceDylanVanAssche
authored andcommitted
addition of new test case proposed in issue
1 parent 1af2e6b commit f86d900

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

test-cases/RMLTC0026b-JSON/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
## RMLTC0026a-JSON
2+
3+
**Title**: "Generation of triples from arrays"
4+
5+
**Description**: "Tests the generation of triples from array input data structures"
6+
7+
**Error expected?** No
8+
9+
**Input**
10+
```
11+
{
12+
"persons": [
13+
{"fname":"Bob","lname":"Smith","amounts":[30, 40, 50]}
14+
]
15+
}
16+
17+
```
18+
19+
**Mapping**
20+
```
21+
@prefix ex: <http://example.com/> .
22+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
23+
@prefix rml: <http://w3id.org/rml/> .
24+
25+
<http://example.com/base/TriplesMap1> a rml:TriplesMap;
26+
rml:logicalSource [ a rml:LogicalSource;
27+
rml:iterator "$.persons[*]";
28+
rml:referenceFormulation rml:JSONPath;
29+
rml:source [ a rml:RelativePathSource;
30+
rml:root rml:MappingDirectory;
31+
rml:path "persons.json"
32+
]
33+
];
34+
rml:predicateObjectMap [
35+
rml:objectMap [
36+
rml:reference "$.amounts"
37+
];
38+
rml:predicate ex:amount
39+
];
40+
rml:subjectMap [
41+
rml:template "http://example.com/Student/{$.fname}/{$.lname}"
42+
] .
43+
44+
```
45+
46+
**Output**
47+
```
48+
<http://example.com/Student/Bob/Smith> <http://example.com/amount> "30" .
49+
<http://example.com/Student/Bob/Smith> <http://example.com/amount> "40" .
50+
<http://example.com/Student/Bob/Smith> <http://example.com/amount> "50" .
51+
52+
```
53+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@prefix ex: <http://example.com/> .
2+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
3+
@prefix rml: <http://w3id.org/rml/> .
4+
5+
<http://example.com/base/TriplesMap1> a rml:TriplesMap;
6+
rml:logicalSource [ a rml:LogicalSource;
7+
rml:iterator "$.persons[*]";
8+
rml:referenceFormulation rml:JSONPath;
9+
rml:source [ a rml:RelativePathSource;
10+
rml:root rml:MappingDirectory;
11+
rml:path "persons.json"
12+
]
13+
];
14+
rml:predicateObjectMap [
15+
rml:objectMap [
16+
rml:reference "$.amounts"
17+
];
18+
rml:predicate ex:amount
19+
];
20+
rml:subjectMap [
21+
rml:template "http://example.com/Student/{$.fname}/{$.lname}"
22+
] .
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"persons": [
3+
{"fname":"Bob","lname":"Smith","amounts":[30, 40, 50]}
4+
]
5+
}

0 commit comments

Comments
 (0)