Skip to content

Commit

Permalink
Merge pull request #47 from kg-construct/additional-test-cases
Browse files Browse the repository at this point in the history
Good for me too, thx @chrdebru.
  • Loading branch information
frmichel authored Apr 9, 2024
2 parents dbae34c + 9ced2af commit 28e9e64
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test-cases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@
- RMLTC-CC-0007-NES: list of bags (nested containers and collections)
- RMLTC-CC-0008-ROMa: RDF list whose members are generated by a referencing object-map
- RMLTC-CC-0008-ROMb: RDF list whose members are generated by a referencing object-map with default join condition
- RMLTC-CC-0009-DUP-List: RDF list that contains duplicates (should test correct behavior of multi-valued expression maps)
- RMLTC-CC-0009-DUP-Bag: RDF bag that contains duplicates (should test correct behavior of multi-valued expression maps)
- RMLTC-CC-0010-List: Combining graph maps and gather maps
26 changes: 26 additions & 0 deletions test-cases/RMLTC-CC-0009-DUP-Bag/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"id": "a",
"values": [
"1",
"1",
"1"
]
},
{
"id": "b",
"values": [
"2",
"2",
"6"
]
},
{
"id": "c",
"values": [
"7",
"8",
"9"
]
}
]
15 changes: 15 additions & 0 deletions test-cases/RMLTC-CC-0009-DUP-Bag/default.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
_:nc808fbd2e11a4baa939c61c8210b5909b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> .
_:nc808fbd2e11a4baa939c61c8210b5909b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> "2" .
_:nc808fbd2e11a4baa939c61c8210b5909b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> .
_:nc808fbd2e11a4baa939c61c8210b5909b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> .
_:nc808fbd2e11a4baa939c61c8210b5909b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_3> "9" .
_:nc808fbd2e11a4baa939c61c8210b5909b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> "1" .
<http://example.com/base/e/b> <http://example.com/ns#with> _:nc808fbd2e11a4baa939c61c8210b5909b2 .
_:nc808fbd2e11a4baa939c61c8210b5909b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "1" .
<http://example.com/base/e/c> <http://example.com/ns#with> _:nc808fbd2e11a4baa939c61c8210b5909b3 .
<http://example.com/base/e/a> <http://example.com/ns#with> _:nc808fbd2e11a4baa939c61c8210b5909b1 .
_:nc808fbd2e11a4baa939c61c8210b5909b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "2" .
_:nc808fbd2e11a4baa939c61c8210b5909b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "7" .
_:nc808fbd2e11a4baa939c61c8210b5909b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_3> "6" .
_:nc808fbd2e11a4baa939c61c8210b5909b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_3> "1" .
_:nc808fbd2e11a4baa939c61c8210b5909b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> "8" .
27 changes: 27 additions & 0 deletions test-cases/RMLTC-CC-0009-DUP-Bag/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@prefix rml: <http://w3id.org/rml/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix ex: <http://example.com/ns#>.
@base <http://example.com/>.

<#TM> a rml:TriplesMap;
rml:logicalSource [
rml:source _:b738439 ;
rml:referenceFormulation rml:JSONPath ;
rml:iterator "$.*" ;
] ;

rml:subjectMap [
rml:template "e/{$.id}" ;
] ;

rml:predicateObjectMap [
rml:predicate ex:with ;
rml:objectMap [
rml:gather ( [ rml:reference "$.values.*" ; ] ) ;
rml:gatherAs rdf:Bag ;
] ;
] ;
.

_:b738439 a rml:RelativePathSource ;
rml:path "data.json" .
26 changes: 26 additions & 0 deletions test-cases/RMLTC-CC-0009-DUP-List/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"id": "a",
"values": [
"1",
"1",
"1"
]
},
{
"id": "b",
"values": [
"2",
"2",
"6"
]
},
{
"id": "c",
"values": [
"7",
"8",
"9"
]
}
]
23 changes: 23 additions & 0 deletions test-cases/RMLTC-CC-0009-DUP-List/default.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<http://example.com/base/e/a> <http://example.com/ns#with> _:n988e0f11d19c486fa3b3255f94c9b3bab1 .
_:n988e0f11d19c486fa3b3255f94c9b3bab1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1" .
_:n988e0f11d19c486fa3b3255f94c9b3bab1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:n988e0f11d19c486fa3b3255f94c9b3bab2 .
_:n988e0f11d19c486fa3b3255f94c9b3bab2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1" .
_:n988e0f11d19c486fa3b3255f94c9b3bab2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:n988e0f11d19c486fa3b3255f94c9b3bab3 .
_:n988e0f11d19c486fa3b3255f94c9b3bab3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1" .
_:n988e0f11d19c486fa3b3255f94c9b3bab3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .

<http://example.com/base/e/b> <http://example.com/ns#with> _:n988e0f11d19c486fa3b3255f94c9b3bab4 .
_:n988e0f11d19c486fa3b3255f94c9b3bab4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2" .
_:n988e0f11d19c486fa3b3255f94c9b3bab4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:n988e0f11d19c486fa3b3255f94c9b3bab5 .
_:n988e0f11d19c486fa3b3255f94c9b3bab5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2" .
_:n988e0f11d19c486fa3b3255f94c9b3bab5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:n988e0f11d19c486fa3b3255f94c9b3bab6 .
_:n988e0f11d19c486fa3b3255f94c9b3bab6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "6" .
_:n988e0f11d19c486fa3b3255f94c9b3bab6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .

<http://example.com/base/e/c> <http://example.com/ns#with> _:n988e0f11d19c486fa3b3255f94c9b3bab7 .
_:n988e0f11d19c486fa3b3255f94c9b3bab7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "7" .
_:n988e0f11d19c486fa3b3255f94c9b3bab7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:n988e0f11d19c486fa3b3255f94c9b3bab8 .
_:n988e0f11d19c486fa3b3255f94c9b3bab8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "8" .
_:n988e0f11d19c486fa3b3255f94c9b3bab8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:n988e0f11d19c486fa3b3255f94c9b3bab9 .
_:n988e0f11d19c486fa3b3255f94c9b3bab9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "9" .
_:n988e0f11d19c486fa3b3255f94c9b3bab9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
27 changes: 27 additions & 0 deletions test-cases/RMLTC-CC-0009-DUP-List/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@prefix rml: <http://w3id.org/rml/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix ex: <http://example.com/ns#>.
@base <http://example.com/>.

<#TM> a rml:TriplesMap;
rml:logicalSource [
rml:source _:b738439 ;
rml:referenceFormulation rml:JSONPath ;
rml:iterator "$.*" ;
] ;

rml:subjectMap [
rml:template "e/{$.id}" ;
] ;

rml:predicateObjectMap [
rml:predicate ex:with ;
rml:objectMap [
rml:gather ( [ rml:reference "$.values.*" ; ] ) ;
rml:gatherAs rdf:List ;
] ;
] ;
.

_:b738439 a rml:RelativePathSource ;
rml:path "data.json" .
23 changes: 23 additions & 0 deletions test-cases/RMLTC-CC-0010-List/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"id": "a",
"graph": "1",
"values": [
"1"
]
},
{
"id": "a",
"graph": "2",
"values": [
"2"
]
},
{
"id": "a",
"graph": "1",
"values": [
"3"
]
}
]
9 changes: 9 additions & 0 deletions test-cases/RMLTC-CC-0010-List/default.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
_:genid1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1" <http://example.com/base/g/1> .
_:genid1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:genid2 <http://example.com/base/g/1> .
_:genid2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "3" <http://example.com/base/g/1> .
_:genid2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.com/base/g/1> .
<http://example.com/base/e/a> <http://example.com/ns#with> _:genid1 <http://example.com/base/g/1> .

_:genidx1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2" <http://example.com/base/g/2> .
_:genidx1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.com/base/g/2> .
<http://example.com/base/e/a> <http://example.com/ns#with> _:genidx1 <http://example.com/base/g/2> .
28 changes: 28 additions & 0 deletions test-cases/RMLTC-CC-0010-List/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@prefix rml: <http://w3id.org/rml/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix ex: <http://example.com/ns#>.
@base <http://example.com/>.

<#TM> a rml:TriplesMap;
rml:logicalSource [
rml:source _:b738439 ;
rml:referenceFormulation rml:JSONPath ;
rml:iterator "$.*" ;
] ;

rml:subjectMap [
rml:template "e/{$.id}" ;
] ;

rml:predicateObjectMap [
rml:graphMap [ rml:template "g/{$.graph}" ; ] ;
rml:predicate ex:with ;
rml:objectMap [
rml:gather ( [ rml:reference "$.values.*" ; ] ) ;
rml:gatherAs rdf:List ;
] ;
] ;
.

_:b738439 a rml:RelativePathSource ;
rml:path "data.json" .

0 comments on commit 28e9e64

Please sign in to comment.