diff --git a/test-cases/RMLLVTC0001/README.md b/test-cases/RMLLVTC0001/README.md new file mode 100644 index 0000000..17f4f04 --- /dev/null +++ b/test-cases/RMLLVTC0001/README.md @@ -0,0 +1,82 @@ +## RMLLVTC0001 + +**Title**: + +**Description**: + +**Error expected?** No + +**Input** +``` +{ + "people": [ + { + "name": "alice", + "items": [ + { + "type": "sword", + "weight": 1500 + }, + { + "type": "shield", + "weight": 2500 + } + ] + }, + { + "name": "bob", + "items": [ + { + "type": "flower", + "weight": 15 + } + ] + } + ] +} + +``` + +**Mapping** +``` +@prefix rml: . +@prefix : . + +:jsonSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.json" ; + ] ; + rml:referenceFormulation rml:JSONPath ; + rml:iterator "$.people[*]" . + +:jsonView a rml:LogicalView ; + rml:viewOn :jsonSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "$.name" ; + ] . + +:triplesMapPerson a rml:TriplesMap ; + rml:logicalSource :jsonView ; + rml:subjectMap [ + rml:template "http://example.org/people/{name}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasName ; + rml:objectMap [ + rml:reference "name" ; + ] ; + ] . + +``` + +**Output** +``` + "alice" . + "bob" . + +``` + diff --git a/test-cases/RMLLVTC0002/README.md b/test-cases/RMLLVTC0002/README.md new file mode 100644 index 0000000..7e18a92 --- /dev/null +++ b/test-cases/RMLLVTC0002/README.md @@ -0,0 +1,132 @@ +## RMLLVTC0002 + +**Title**: + +**Description**: + +**Error expected?** No + +**Input** +``` +{ + "people": [ + { + "name": "alice", + "items": [ + { + "type": "sword", + "weight": 1500 + }, + { + "type": "shield", + "weight": 2500 + } + ] + }, + { + "name": "bob", + "items": [ + { + "type": "flower", + "weight": 15 + } + ] + } + ] +} + +``` + +**Mapping** +``` +@prefix rml: . +@prefix xsd: . +@prefix : . + +:jsonSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.json" ; + ] ; + rml:referenceFormulation rml:JSONPath ; + rml:iterator "$.people[*]" . + +:jsonView a rml:LogicalView ; + rml:viewOn :jsonSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "$.name" ; + ] ; + rml:field [ + a rml:IterableField ; + rml:fieldName "item" ; + rml:iterator "$.items[*]" ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "type" ; + rml:reference "$.type" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "weight" ; + rml:reference "$.weight" ; + ] ; + ] . + +:triplesMapPerson a rml:TriplesMap ; + rml:logicalSource :jsonView ; + rml:subjectMap [ + rml:template "http://example.org/person/{name}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasName ; + rml:objectMap [ + rml:reference "name" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasItem ; + rml:objectMap [ + rml:parentTriplesMap :triplesMapItem ; + ] ; + ] . + +:triplesMapItem a rml:TriplesMap ; + rml:logicalSource :jsonView ; + rml:subjectMap [ + rml:template "http://example.org/person/{name}/item/{item.type}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasName ; + rml:objectMap [ + rml:reference "item.type" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasWeight ; + rml:objectMap [ + rml:reference "item.weight" ; + rml:datatype xsd:integer ; + ] ; + ] . + +``` + +**Output** +``` + "alice" . + . + . + "bob" . + . + "sword" . + "1500"^^ . + "shield" . + "2500"^^ . + "flower" . + "15"^^ . + +``` + diff --git a/test-cases/RMLLVTC0003/README.md b/test-cases/RMLLVTC0003/README.md new file mode 100644 index 0000000..6998552 --- /dev/null +++ b/test-cases/RMLLVTC0003/README.md @@ -0,0 +1,191 @@ +## RMLLVTC0003 + +**Title**: + +**Description**: + +**Error expected?** No + +**Input** +``` +{ + "people": [ + { + "name": "alice", + "items": [ + { + "type": "sword", + "weight": 1500 + }, + { + "type": "shield", + "weight": 2500 + } + ] + }, + { + "name": "bob", + "items": [ + { + "type": "flower", + "weight": 15 + } + ] + } + ] +} + +``` + +**Input 1** +``` +name,birthyear +alice,1995 +bob,1999 +tobias,2005 + +``` + +**Mapping** +``` +@prefix rml: . +@prefix xsd: . +@prefix : . + +:jsonSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.json" ; + ] ; + rml:referenceFormulation rml:JSONPath ; + rml:iterator "$.people[*]" . + +:jsonView a rml:LogicalView ; + rml:viewOn :jsonSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "$.name" ; + ] ; + rml:field [ + a rml:IterableField ; + rml:fieldName "item" ; + rml:iterator "$.items[*]" ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "type" ; + rml:reference "$.type" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "weight" ; + rml:reference "$.weight" ; + ] ; + ] . + +:csvSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.csv" ; + ] ; + rml:referenceFormulation rml:CSV . + +:csvView a rml:LogicalView ; + rml:viewOn :csvSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "birthyear" ; + rml:reference "birthyear" ; + ] ; + rml:leftJoin [ + rml:parentLogicalView :jsonView ; + rml:joinCondition [ + rml:parent "name" ; + rml:child "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "item_type" ; + rml:reference "item.type" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "item_weight" ; + rml:reference "item.weight" ; + ] ; + ] . + + +:triplesMapPerson a rml:TriplesMap ; + rml:logicalSource :csvView ; + rml:subjectMap [ + rml:template "http://example.org/person/{name}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasName ; + rml:objectMap [ + rml:reference "name" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasBirthyear ; + rml:objectMap [ + rml:reference "birthyear" ; + rml:datatype xsd:gYear ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasItem ; + rml:objectMap [ + rml:parentTriplesMap :triplesMapItem ; + ] ; + ] . + +:triplesMapItem a rml:TriplesMap ; + rml:logicalSource :csvView ; + rml:subjectMap [ + rml:template "http://example.org/person/{name}/item/{item_type}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasType ; + rml:objectMap [ + rml:reference "item_type" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasWeight ; + rml:objectMap [ + rml:reference "item_weight" ; + rml:datatype xsd:integer ; + ] ; + ] . + +``` + +**Output** +``` + "alice" . + "1995"^^ . + . + . + "sword" . + "1500"^^ . + "shield" . + "2500"^^ . + "bob" . + "1999"^^ . + . + "flower" . + "15"^^ . + "tobias" . + "2005"^^ . + +``` + diff --git a/test-cases/RMLLVTC0004/README.md b/test-cases/RMLLVTC0004/README.md new file mode 100644 index 0000000..5a82b2f --- /dev/null +++ b/test-cases/RMLLVTC0004/README.md @@ -0,0 +1,188 @@ +## RMLLVTC0004 + +**Title**: + +**Description**: + +**Error expected?** No + +**Input** +``` +{ + "people": [ + { + "name": "alice", + "items": [ + { + "type": "sword", + "weight": 1500 + }, + { + "type": "shield", + "weight": 2500 + } + ] + }, + { + "name": "bob", + "items": [ + { + "type": "flower", + "weight": 15 + } + ] + } + ] +} + +``` + +**Input 1** +``` +name,birthyear +alice,1995 +bob,1999 +tobias,2005 + +``` + +**Mapping** +``` +@prefix rml: . +@prefix xsd: . +@prefix : . + +:jsonSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.json" ; + ] ; + rml:referenceFormulation rml:JSONPath ; + rml:iterator "$.people[*]" . + +:jsonView a rml:LogicalView ; + rml:viewOn :jsonSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "$.name" ; + ] ; + rml:field [ + a rml:IterableField ; + rml:fieldName "item" ; + rml:iterator "$.items[*]" ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "type" ; + rml:reference "$.type" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "weight" ; + rml:reference "$.weight" ; + ] ; + ] . + +:csvSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.csv" ; + ] ; + rml:referenceFormulation rml:CSV . + +:csvView a rml:LogicalView ; + rml:viewOn :csvSource ; + rml:field [ a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "birthyear" ; + rml:reference "birthyear" ; + ] ; + rml:innerJoin [ + rml:parentLogicalView :jsonView ; + rml:joinCondition [ + rml:parent "name" ; + rml:child "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "item_type" ; + rml:reference "item.type" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "item_weight" ; + rml:reference "item.weight" ; + ] ; + ] . + + +:triplesMapPerson a rml:TriplesMap ; + rml:logicalSource :csvView ; + rml:subjectMap [ + rml:template "http://example.org/person/{name}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasName ; + rml:objectMap [ + rml:reference "name" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasBirthyear ; + rml:objectMap [ + rml:reference "birthyear" ; + rml:datatype xsd:gYear ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasItem ; + rml:objectMap [ + rml:parentTriplesMap :triplesMapItem ; + ] ; + ] . + +:triplesMapItem a rml:TriplesMap ; + rml:logicalSource :csvView ; + rml:subjectMap [ + rml:template "http://example.org/person/{name}/item/{item_type}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasType ; + rml:objectMap [ + rml:reference "item_type" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasWeight ; + rml:objectMap [ + rml:reference "item_weight" ; + rml:datatype xsd:integer ; + ] ; + ] . + +``` + +**Output** +``` + "alice" . + "1995"^^ . + . + . + "sword" . + "1500"^^ . + "shield" . + "2500"^^ . + "bob" . + "1999"^^ . + . + "flower" . + "15"^^ . + +``` + diff --git a/test-cases/RMLLVTC0005/README.md b/test-cases/RMLLVTC0005/README.md new file mode 100644 index 0000000..ea6d169 --- /dev/null +++ b/test-cases/RMLLVTC0005/README.md @@ -0,0 +1,189 @@ +## RMLLVTC0005 + +**Title**: + +**Description**: + +**Error expected?** No + +**Input** +``` +{ + "people": [ + { + "name": "alice", + "items": [ + { + "type": "sword", + "weight": 1500 + }, + { + "type": "shield", + "weight": 2500 + } + ] + }, + { + "name": "bob", + "items": [ + { + "type": "flower", + "weight": 15 + } + ] + } + ] +} + +``` + +**Input 1** +``` +name,birthyear +alice,1995 +bob,1999 +tobias,2005 + +``` + +**Mapping** +``` +@prefix rml: . +@prefix xsd: . +@prefix : . + +:jsonSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.json" ; + ] ; + rml:referenceFormulation rml:JSONPath ; + rml:iterator "$.people[*]" . + +:jsonView a rml:LogicalView ; + rml:viewOn :jsonSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "$.name" ; + ] ; + rml:field [ + a rml:IterableField ; + rml:fieldName "item" ; + rml:iterator "$.items[*]" ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "type" ; + rml:reference "$.type" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "weight" ; + rml:reference "$.weight" ; + ] ; + ] . + +:csvSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.csv" ; + ] ; + rml:referenceFormulation rml:CSV . + +:csvView a rml:LogicalView ; + rml:viewOn :csvSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "birthyear" ; + rml:reference "birthyear" ; + ] ; + rml:innerJoin [ + rml:parentLogicalView :jsonView ; + rml:joinCondition [ + rml:parent "name" ; + rml:child "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "item_type" ; + rml:reference "item.type" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "item_weight" ; + rml:reference "item.weight" ; + ] ; + ] . + +:triplesMapPerson a rml:TriplesMap ; + rml:logicalSource :csvView ; + rml:subjectMap [ + rml:template "http://example.org/people/{name}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasName ; + rml:objectMap [ + rml:reference "name" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasBirthyear ; + rml:objectMap [ + rml:reference "birthyear" ; + rml:datatype xsd:gYear ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasItem ; + rml:objectMap [ + rml:parentTriplesMap :triplesMapItem ; + ] ; + ] . + +:triplesMapItem a rml:TriplesMap ; + rml:logicalSource :csvView ; + rml:subjectMap [ + rml:template "item_{#}_{item_type.#}" ; + rml:termType rml:BlankNode ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasType ; + rml:objectMap [ + rml:reference "item_type" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasWeight ; + rml:objectMap [ + rml:reference "item_weight" ; + rml:datatype xsd:integer ; + ] ; + ] . + +``` + +**Output** +``` + "alice" . + "1995"^^ . + _:item_0_0 . + _:item_0_1 . +_:item_0_0 "sword" . +_:item_0_0 "1500"^^ . +_:item_0_1 "shield" . +_:item_0_1 "2500"^^ . + "bob" . + "1999"^^ . + _:item_1_0 . +_:item_1_0 "flower" . +_:item_1_0 "15"^^ . + +``` + diff --git a/test-cases/RMLLVTC0006/README.md b/test-cases/RMLLVTC0006/README.md new file mode 100644 index 0000000..45d84c9 --- /dev/null +++ b/test-cases/RMLLVTC0006/README.md @@ -0,0 +1,83 @@ +## RMLLVTC0006 + +**Title**: + +**Description**: + +**Error expected?** No + +**Mapping** +``` +@prefix rml: . +@prefix xsd: . +@prefix : . + +:mixedCSVSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.csv" ; + ] ; + rml:referenceFormulation rml:CSV . + +:mixedCSVView a rml:LogicalView ; + rml:viewOn :mixedCSVSource ; + rml:field [ + a rml:ExpressionField; + rml:fieldName "name" ; + rml:reference "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "items" ; + rml:reference "items" ; + rml:field [ + a rml:IterableField ; + rml:referenceFormulation rml:JSONPath ; + rml:iterator "$[*]" ; + rml:fieldName "item" ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "type" ; + rml:reference "$.type" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "weight" ; + rml:reference "$.weight" ; + ] ; + ] ; + ] . + +:triplesMapItem a rml:TriplesMap ; + rml:logicalSource :mixedCSVView ; + rml:subjectMap [ + rml:template "http://example.org/item_{#}_{items.item.#}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasType ; + rml:objectMap [ + rml:reference "items.item.type" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasWeight ; + rml:objectMap [ + rml:reference "items.item.weight" ; + rml:datatype xsd:integer ; + ] ; + ] . + +``` + +**Output** +``` + "sword" . + "1500"^^ . + "shield" . + "2500"^^ . + "flower" . + "15"^^ . + +``` + diff --git a/test-cases/RMLLVTC0007/README.md b/test-cases/RMLLVTC0007/README.md new file mode 100644 index 0000000..69a189f --- /dev/null +++ b/test-cases/RMLLVTC0007/README.md @@ -0,0 +1,82 @@ +## RMLLVTC0007 + +**Title**: + +**Description**: + +**Error expected?** No + +**Mapping** +``` +@prefix rml: . +@prefix xsd: . +@prefix : . + +:mixedCSVSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.csv" ; + ] ; + rml:referenceFormulation rml:CSV . + +:mixedCSVView a rml:LogicalView ; + rml:viewOn :mixedCSVSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "item" ; + rml:reference "item" ; + rml:field [ + a rml:IterableField ; + rml:referenceFormulation rml:JSONPath ; + rml:iterator "$[*]" ; + rml:fieldName "itemJson" ; + rml:field [ + a rml:ExpressionField; + rml:fieldName "type" ; + rml:reference "$.type" ; ] ; + rml:field [ + a rml:ExpressionField; + rml:fieldName "weight" ; + rml:reference "$.weight" ; + ] ; + ] ; + ] . + +:triplesMapItem a rml:TriplesMap ; + rml:logicalSource :mixedCSVView ; + rml:subjectMap [ + rml:template "http://example.org/item_{#}_{item.#}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasType ; + rml:objectMap [ + rml:reference "item.itemJson.type" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasWeight ; + rml:objectMap [ + rml:reference "item.itemJson.weight" ; + rml:datatype xsd:integer ; + ] ; + ] . + +``` + +**Output** +``` + "sword" . + "1500"^^ . + "shield" . + "2500"^^ . + "flower" . + "15"^^ . + +``` + diff --git a/test-cases/RMLLVTC0008/README.md b/test-cases/RMLLVTC0008/README.md new file mode 100644 index 0000000..6ab25f7 --- /dev/null +++ b/test-cases/RMLLVTC0008/README.md @@ -0,0 +1,100 @@ +## RMLLVTC0008 + +**Title**: + +**Description**: + +**Error expected?** No + +**Input** +``` +{ + "people": [ + { + "name": "alice", + "items": "type,weight\nsword,1500\nshield,2500" + }, + { + "name": "bob", + "items": "type,weight\nflower,15" + } + ] +} + +``` + +**Mapping** +``` +@prefix rml: . +@prefix xsd: . +@prefix : . + +:mixedJSONSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.json" ; + ] ; + rml:referenceFormulation rml:JSONPath ; + rml:iterator "$.people[*]" . + +:mixedJSONView a rml:LogicalView ; + rml:viewOn :mixedJSONSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "$.name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "items" ; + rml:reference "$.items" ; + rml:field [ + a rml:IterableField ; + rml:referenceFormulation rml:CSV ; + rml:fieldName "item"; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "type" ; + rml:reference "type" ; + ] ; + rml:field [ + a rml:expressionField ; + rml:fieldName "weight" ; + rml:reference "weight" ; + ] ; + ] ; + ]. + +:triplesMapItem a rml:TriplesMap ; + rml:logicalSource :mixedJSONView ; + rml:subjectMap [ + rml:template "http://example.org/item_{#}_{items.item.#}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasType ; + rml:objectMap [ + rml:reference "items.item.type" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasWeight ; + rml:objectMap [ + rml:reference "items.item.weight" ; + rml:datatype xsd:integer ; + ] ; + ] . + +``` + +**Output** +``` + "sword" . + "1500"^^ . + "shield" . + "2500"^^ . + "flower" . + "15"^^ . + +``` + diff --git a/test-cases/RMLLVTC0009/README.md b/test-cases/RMLLVTC0009/README.md new file mode 100644 index 0000000..36ec467 --- /dev/null +++ b/test-cases/RMLLVTC0009/README.md @@ -0,0 +1,233 @@ +## RMLLVTC0009 + +**Title**: + +**Description**: + +**Error expected?** No + +**Input** +``` +{ + "people": [ + { + "name": "alice", + "items": [ + { + "type": "sword", + "weight": 1500 + }, + { + "type": "shield", + "weight": 2500 + } + ] + }, + { + "name": "bob", + "items": [ + { + "type": "flower", + "weight": 15 + } + ] + } + ] +} + +``` + +**Input 1** +``` +name,birthyear +alice,1995 +bob,1999 +tobias,2005 + +``` + +**Input 2** +``` +name,id +alice,123 +bob,456 +tobias,789 + +``` + +**Mapping** +``` +@prefix rml: . +@prefix xsd: . +@prefix : . + +:jsonSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.json" ; + ] ; + rml:referenceFormulation rml:JSONPath ; + rml:iterator "$.people[*]" . + +:jsonView a rml:LogicalView ; + rml:viewOn :jsonSource ; + rml:field [ a + rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "$.name" ; + ] ; + rml:field [ + a rml:IterableField ; + rml:fieldName "item" ; + rml:iterator "$.items[*]" ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "type" ; + rml:reference "$.type" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "weight" ; + rml:reference "$.weight" ; + ] ; + ] . + + :additionalCsvSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people2.csv" ; + ] ; + rml:referenceFormulation rml:CSV . + + :additionalCsvView a rml:LogicalView ; + rml:viewOn :additionalCsvSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "id" ; + rml:reference "id" ; + ] ; + . + +:csvSource a rml:LogicalSource ; + rml:source [ + a rml:RelativePathSource , rml:Source ; + rml:root rml:MappingDirectory ; + rml:path "people.csv" ; + ] ; + rml:referenceFormulation rml:CSV . + +:csvView a rml:LogicalView ; + rml:viewOn :csvSource ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "name" ; + rml:reference "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "birthyear" ; + rml:reference "birthyear" ; + ] ; + rml:leftJoin [ + rml:parentLogicalView :jsonView ; + rml:joinCondition [ + rml:parent "name" ; + rml:child "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "item_type" ; + rml:reference "item.type" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "item_weight" ; + rml:reference "item.weight" ; + ] ; + ] ; + rml:leftJoin [ + rml:parentLogicalView :additionalCsvView ; + rml:joinCondition [ + rml:parent "name" ; + rml:child "name" ; + ] ; + rml:field [ + a rml:ExpressionField ; + rml:fieldName "id" ; + rml:reference "id" ; + ] ; + ] . + +:triplesMapPerson a rml:TriplesMap ; + rml:logicalSource :csvView ; + rml:subjectMap [ + rml:template "http://example.org/people/{id}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasName ; + rml:objectMap [ + rml:reference "name" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasBirthyear ; + rml:objectMap [ + rml:reference "birthyear" ; + rml:datatype xsd:gYear ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasItem ; + rml:objectMap [ + rml:parentTriplesMap :triplesMapItem ; + ] ; + ] . + +:triplesMapItem a rml:TriplesMap ; + rml:logicalSource :csvView ; + rml:subjectMap [ + rml:template "http://example.org/item_{#}_{item_type.#}" ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasType ; + rml:objectMap [ + rml:reference "item_type" ; + ] ; + ] ; + rml:predicateObjectMap [ + rml:predicate :hasWeight ; + rml:objectMap [ + rml:reference "item_weight" ; + rml:datatype xsd:integer ; + ] ; + ] . + +``` + +**Output** +``` + "alice" . + "1995"^^ . + . + . + "sword" . + "1500"^^ . + "shield" . + "2500"^^ . + "bob" . + "1999"^^ . + . + "flower" . + "15"^^ . + "tobias" . + "2005"^^ . + +``` + diff --git a/test-cases/config.js b/test-cases/config.js new file mode 100644 index 0000000..291d43f --- /dev/null +++ b/test-cases/config.js @@ -0,0 +1,72 @@ +async function loadTurtle() { + //this is the function you call in 'preProcess', to load the highlighter + const worker = await new Promise(resolve => { + require(["core/worker"], ({ worker }) => resolve(worker)); + }); + const action = "highlight-load-lang"; + const langURL = + "https://cdn.jsdelivr.net/gh/redmer/highlightjs-turtle/src/languages/turtle.js"; + const propName = "hljsDefineTurtle"; // This funtion is defined in the highlighter being loaded + const lang = "turtle"; // this is the class you use to identify the language + worker.postMessage({ action, langURL, propName, lang }); + return new Promise(resolve => { + worker.addEventListener("message", function listener({ data }) { + const { action: responseAction, lang: responseLang } = data; + if (responseAction === action && responseLang === lang) { + worker.removeEventListener("message", listener); + resolve(); + } + }); + }); +} + +var respecConfig = { + // check https://respec.org/docs/ for the meaning of these keys + preProcess: [loadTurtle], + authors: [ + { + name: "Dylan Van Assche", + url: "https://dylanvanassche.be", + company: "IDLab – Ghent University – imec", + orcid: "0000-0002-7195-9935", + companyURL: "https://knows.idlab.ugent.be/" + } + ], + edDraftURI: "https://w3id.org/rml/lv/test-cases/", + editors: [ + { + name: "Dylan Van Assche", + url: "https://dylanvanassche.be", + company: "IDLab – Ghent University – imec", + orcid: "0000-0002-7195-9935", + companyURL: "https://knows.idlab.ugent.be/" + } + ], + formerEditors: [ + ], + github: "https://github.com/kg-construct/rml-io", + license: "w3c-software-doc", + localBiblio: { + "RML-Core": { + title: "RML-Core", + href: "https://w3id.org/rml/core/spec", + status: "Draft Community Group Report", + publisher: "W3C", + date: "07 August 2024", + }, + "RML-IO": { + title: "RML-IO", + href: "https://w3id.org/rml/io/spec", + status: "Draft Community Group Report", + publisher: "W3C", + date: "12 March 2024", + }, + }, + otherLinks: [], + shortName: "RML-LV-Testcases", + specStatus: "CG-DRAFT", + // W3C config + copyrightStart: "2024", + doJsonLd: true, + group: "kg-construct", +}; diff --git a/test-cases/descriptions.csv b/test-cases/descriptions.csv new file mode 100644 index 0000000..e5ce689 --- /dev/null +++ b/test-cases/descriptions.csv @@ -0,0 +1,15 @@ +RML ID,Title,Purpose,"Error +expected?",Input ,"Output +default","Output +1","Output +2","Output +3",Comment +RMLLVTC0001,,,no,,,,,, +RMLLVTC0002,,,no,,,,,, +RMLLVTC0003,,,no,,,,,, +RMLLVTC0004,,,no,,,,,, +RMLLVTC0005,,,no,,,,,, +RMLLVTC0006,,,no,,,,,, +RMLLVTC0007,,,no,,,,,, +RMLLVTC0008,,,no,,,,,, +RMLLVTC0009,,,no,,,,,, \ No newline at end of file diff --git a/test-cases/dev.html b/test-cases/dev.html new file mode 100644 index 0000000..ee16cac --- /dev/null +++ b/test-cases/dev.html @@ -0,0 +1,109 @@ + + + + + RML-LV: Test Cases + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ + +
+
+
+
+
+
+
+
+
+ + + + diff --git a/test-cases/docs/20250130/index.html b/test-cases/docs/20250130/index.html new file mode 100644 index 0000000..1015d9f --- /dev/null +++ b/test-cases/docs/20250130/index.html @@ -0,0 +1,1742 @@ + + + + + + +RML-LV: Test Cases + + + + + + + + + + + + + + +
+ +

RML-LV: Test Cases

+

+ Draft Community Group Report + +

+
+ +
Latest published version:
+ https://www.w3.org/RML-LV-Testcases/ +
+
Latest editor's draft:
https://w3id.org/rml/lv/test-cases/
+ + + + +
Editor:
+ Dylan Van Assche + + + + (IDLab – Ghent University – imec) +
+ +
Author:
+ Dylan Van Assche + + + + (IDLab – Ghent University – imec) +
+
Feedback:
+ GitHub kg-construct/rml-io + (pull requests, + new issue, + open issues) +
+ +
+ + +
+
+ + + +

Abstract

This document defines the RML-LV test cases to the determine the RML-LV specification conformance of tools.

+
+ +

Status of This Document

+ This specification was published by the + Knowledge Graph Construction Community Group. It is not a W3C Standard nor is it + on the W3C Standards Track. + + Please note that under the + W3C Community Contributor License Agreement (CLA) + there is a limited opt-out and other conditions apply. + + Learn more about + W3C Community and Business Groups. +

+ GitHub Issues are preferred for + discussion of this specification. + + +

+ +

1. Introduction

+

This document defines the RML-LV test cases, consisting of a collection of test case documents (input and expected output). +The purpose of the test cases is to determine the conformance of tools that execute RML rules to the RML-LV specification.

+
+ +

2. Data model

+

The test cases are semantically described for re-usability and shareability following the W3C Test case description. +Each test:Testcase as the following properties:

+
    +
  • dcterms:identifier: unique ID of the test case.
  • +
  • rmltest:hasError: if an error of the RML Processor is expected or not.
  • +
  • rmltest:input: One or more input data of the test case.
  • +
  • rmltest:output: One or more output data of the test case.
  • +
  • rmltest:inputFormat: the input data format.
  • +
  • rmltest:outputFormat: the output data format.
  • +
  • rmltest:mappingDocument: the RML mapping rules in Turtle.
  • +
+
+ +

3. Test cases

+

This section describes the RML-LV test cases. These descriptions are also available as RDF. +The files are available on GitHub in the folder test-cases. +Each test case is contained in a single folder, containing three types of files:

+
    +
  • Zero or more files containing the data sources, in the case of JSON, XML, CSV, or containing the SQL statements to create the necessary tables, in the case of MySQL, PostgreSQL, and SQL Server.
  • +
  • One file with the RML rules, called mapping.ttl, in the Turtle format.
  • +
  • Zero or more files with the expected RDF. No file is provided if an error is expected that must halt the generation of the RDF because of an error.
  • +
+
+ + +

4. RMLLVTC0001

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] .
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :jsonView ;
+  rml:subjectMap [
+    rml:template "http://example.org/people/{name}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/people/alice> <http://example.org/hasName> "alice" .
+<http://example.org/people/bob> <http://example.org/hasName> "bob" .
+
+
+

5. RMLLVTC0002

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] ;
+  rml:field [
+    a rml:IterableField ;
+    rml:fieldName "item" ;
+    rml:iterator "$.items[*]" ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "type" ;
+      rml:reference "$.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "weight" ;
+      rml:reference "$.weight" ;
+    ] ;
+  ] .
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :jsonView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasItem ;
+    rml:objectMap [
+      rml:parentTriplesMap :triplesMapItem ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :jsonView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}/item/{item.type}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "item.type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item.weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/sword> .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/shield> .
+<http://example.org/person/bob> <http://example.org/hasName> "bob" .
+<http://example.org/person/bob> <http://example.org/hasItem> <http://example.org/person/bob/item/flower> .
+<http://example.org/person/alice/item/sword> <http://example.org/hasName> "sword" .
+<http://example.org/person/alice/item/sword> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/alice/item/shield> <http://example.org/hasName> "shield" .
+<http://example.org/person/alice/item/shield> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/bob/item/flower> <http://example.org/hasName> "flower" .
+<http://example.org/person/bob/item/flower> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

6. RMLLVTC0003

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Input 1

+
name,birthyear
+alice,1995
+bob,1999
+tobias,2005
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] ;
+  rml:field [
+    a rml:IterableField ;
+    rml:fieldName "item" ;
+    rml:iterator "$.items[*]" ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "type" ;
+      rml:reference "$.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "weight" ;
+      rml:reference "$.weight" ;
+    ] ;
+  ] .
+
+:csvSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:csvView a rml:LogicalView ;
+  rml:viewOn :csvSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "birthyear" ;
+    rml:reference "birthyear" ;
+  ] ;
+  rml:leftJoin [
+    rml:parentLogicalView :jsonView ;
+    rml:joinCondition [
+      rml:parent "name" ;
+      rml:child "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_type" ;
+      rml:reference "item.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_weight" ;
+      rml:reference "item.weight" ;
+    ] ;
+  ] .
+
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasBirthyear ;
+    rml:objectMap [
+      rml:reference "birthyear" ;
+      rml:datatype xsd:gYear ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasItem ;
+    rml:objectMap [
+      rml:parentTriplesMap :triplesMapItem ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}/item/{item_type}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "item_type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item_weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
+<http://example.org/person/alice> <http://example.org/hasBirthyear> "1995"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/sword> .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/shield> .
+<http://example.org/person/alice/item/sword> <http://example.org/hasType> "sword" .
+<http://example.org/person/alice/item/sword> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/alice/item/shield> <http://example.org/hasType> "shield" .
+<http://example.org/person/alice/item/shield> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/bob> <http://example.org/hasName> "bob" .
+<http://example.org/person/bob> <http://example.org/hasBirthyear> "1999"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/person/bob> <http://example.org/hasItem> <http://example.org/person/bob/item/flower> .
+<http://example.org/person/bob/item/flower> <http://example.org/hasType> "flower" .
+<http://example.org/person/bob/item/flower> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/tobias> <http://example.org/hasName> "tobias" .
+<http://example.org/person/tobias> <http://example.org/hasBirthyear> "2005"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+
+
+

7. RMLLVTC0004

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Input 1

+
name,birthyear
+alice,1995
+bob,1999
+tobias,2005
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] ;
+  rml:field [
+    a rml:IterableField ;
+    rml:fieldName "item" ;
+    rml:iterator "$.items[*]" ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "type" ;
+      rml:reference "$.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "weight" ;
+      rml:reference "$.weight" ;
+    ] ;
+  ] .
+
+:csvSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:csvView a rml:LogicalView ;
+  rml:viewOn :csvSource ;
+  rml:field [ a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "birthyear" ;
+    rml:reference "birthyear" ;
+  ] ;
+  rml:innerJoin [
+    rml:parentLogicalView :jsonView ;
+    rml:joinCondition [
+      rml:parent "name" ;
+      rml:child "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_type" ;
+      rml:reference "item.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_weight" ;
+      rml:reference "item.weight" ;
+    ] ;
+  ] .
+
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasBirthyear ;
+    rml:objectMap [
+      rml:reference "birthyear" ;
+      rml:datatype xsd:gYear ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasItem ;
+    rml:objectMap [
+      rml:parentTriplesMap :triplesMapItem ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}/item/{item_type}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "item_type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item_weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
+<http://example.org/person/alice> <http://example.org/hasBirthyear> "1995"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/sword> .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/shield> .
+<http://example.org/person/alice/item/sword> <http://example.org/hasType> "sword" .
+<http://example.org/person/alice/item/sword> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/alice/item/shield> <http://example.org/hasType> "shield" .
+<http://example.org/person/alice/item/shield> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/bob> <http://example.org/hasName> "bob" .
+<http://example.org/person/bob> <http://example.org/hasBirthyear> "1999"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/person/bob> <http://example.org/hasItem> <http://example.org/person/bob/item/flower> .
+<http://example.org/person/bob/item/flower> <http://example.org/hasType> "flower" .
+<http://example.org/person/bob/item/flower> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

8. RMLLVTC0005

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Input 1

+
name,birthyear
+alice,1995
+bob,1999
+tobias,2005
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] ;
+  rml:field [
+    a rml:IterableField ;
+    rml:fieldName "item" ;
+    rml:iterator "$.items[*]" ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "type" ;
+      rml:reference "$.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "weight" ;
+      rml:reference "$.weight" ;
+    ] ;
+  ] .
+
+:csvSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:csvView a rml:LogicalView ;
+  rml:viewOn :csvSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "birthyear" ;
+    rml:reference "birthyear" ;
+  ] ;
+  rml:innerJoin [
+    rml:parentLogicalView :jsonView ;
+    rml:joinCondition [
+      rml:parent "name" ;
+      rml:child "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_type" ;
+      rml:reference "item.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_weight" ;
+      rml:reference "item.weight" ;
+    ] ;
+  ] .
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/people/{name}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasBirthyear ;
+    rml:objectMap [
+      rml:reference "birthyear" ;
+      rml:datatype xsd:gYear ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasItem ;
+    rml:objectMap [
+      rml:parentTriplesMap :triplesMapItem ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "item_{#}_{item_type.#}" ;
+    rml:termType rml:BlankNode ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "item_type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item_weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/people/alice> <http://example.org/hasName> "alice" .
+<http://example.org/people/alice> <http://example.org/hasBirthyear> "1995"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/people/alice> <http://example.org/hasItem> _:item_0_0 .
+<http://example.org/people/alice> <http://example.org/hasItem> _:item_0_1 .
+_:item_0_0 <http://example.org/hasType> "sword" .
+_:item_0_0 <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:item_0_1 <http://example.org/hasType> "shield" .
+_:item_0_1 <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/people/bob> <http://example.org/hasName> "bob" .
+<http://example.org/people/bob> <http://example.org/hasBirthyear> "1999"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/people/bob> <http://example.org/hasItem> _:item_1_0 .
+_:item_1_0 <http://example.org/hasType> "flower" .
+_:item_1_0 <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

9. RMLLVTC0006

+

Title:

+

Description:

+

Error expected? No

+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:mixedCSVSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:mixedCSVView a rml:LogicalView ;
+  rml:viewOn :mixedCSVSource ;
+  rml:field [
+    a rml:ExpressionField;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "items" ;
+    rml:reference "items" ;
+    rml:field [
+      a rml:IterableField ;
+      rml:referenceFormulation rml:JSONPath ;
+      rml:iterator "$[*]" ;
+      rml:fieldName "item" ;
+      rml:field [
+        a rml:ExpressionField ;
+        rml:fieldName "type" ;
+        rml:reference "$.type" ;
+      ] ;
+      rml:field [
+        a rml:ExpressionField ;
+        rml:fieldName "weight" ;
+        rml:reference "$.weight" ;
+      ] ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :mixedCSVView ;
+  rml:subjectMap [
+    rml:template "http://example.org/item_{#}_{items.item.#}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "items.item.type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "items.item.weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/item_0_0> <http://example.org/hasType> "sword" .
+<http://example.org/item_0_0> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_0_1> <http://example.org/hasType> "shield" .
+<http://example.org/item_0_1> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_1_0> <http://example.org/hasType> "flower" .
+<http://example.org/item_1_0> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

10. RMLLVTC0007

+

Title:

+

Description:

+

Error expected? No

+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:mixedCSVSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:mixedCSVView a rml:LogicalView ;
+  rml:viewOn :mixedCSVSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "item" ;
+    rml:reference "item" ;
+    rml:field [
+      a rml:IterableField ;
+      rml:referenceFormulation rml:JSONPath ;
+      rml:iterator "$[*]" ;
+      rml:fieldName "itemJson" ;
+      rml:field [
+        a rml:ExpressionField;
+        rml:fieldName "type" ;
+        rml:reference "$.type" ; ] ;
+      rml:field [
+        a rml:ExpressionField;
+        rml:fieldName "weight" ;
+        rml:reference "$.weight" ;
+      ] ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :mixedCSVView ;
+  rml:subjectMap [
+    rml:template "http://example.org/item_{#}_{item.#}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "item.itemJson.type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item.itemJson.weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/item_0_0> <http://example.org/hasType> "sword" .
+<http://example.org/item_0_0> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_1_0> <http://example.org/hasType> "shield" .
+<http://example.org/item_1_0> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_2_0> <http://example.org/hasType> "flower" .
+<http://example.org/item_2_0> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

11. RMLLVTC0008

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": "type,weight\nsword,1500\nshield,2500"
+    },
+    {
+      "name": "bob",
+      "items": "type,weight\nflower,15"
+    }
+  ]
+}
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:mixedJSONSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:mixedJSONView a rml:LogicalView ;
+  rml:viewOn :mixedJSONSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+    ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "items" ;
+    rml:reference "$.items" ;
+    rml:field [
+      a rml:IterableField ;
+      rml:referenceFormulation rml:CSV ;
+      rml:fieldName "item";
+      rml:field [
+        a rml:ExpressionField ;
+        rml:fieldName "type" ;
+        rml:reference "type" ;
+      ] ;
+      rml:field [
+        a rml:expressionField ;
+        rml:fieldName "weight" ;
+        rml:reference "weight" ;
+      ] ;
+    ] ;
+  ].
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :mixedJSONView ;
+  rml:subjectMap [
+    rml:template "http://example.org/item_{#}_{items.item.#}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "items.item.type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "items.item.weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/item_0_0> <http://example.org/hasType> "sword" .
+<http://example.org/item_0_0> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_0_1> <http://example.org/hasType> "shield" .
+<http://example.org/item_0_1> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_1_0> <http://example.org/hasType> "flower" .
+<http://example.org/item_1_0> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

12. RMLLVTC0009

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Input 1

+
name,birthyear
+alice,1995
+bob,1999
+tobias,2005
+
+

Input 2

+
name,id
+alice,123
+bob,456
+tobias,789
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [ a
+    rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] ;
+  rml:field [
+    a rml:IterableField ;
+    rml:fieldName "item" ;
+    rml:iterator "$.items[*]" ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "type" ;
+      rml:reference "$.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "weight" ;
+      rml:reference "$.weight" ;
+    ] ;
+  ] .
+
+  :additionalCsvSource a rml:LogicalSource ;
+    rml:source [
+      a rml:RelativePathSource , rml:Source ;
+      rml:root rml:MappingDirectory ;
+      rml:path "people2.csv" ;
+    ] ;
+    rml:referenceFormulation rml:CSV .
+
+  :additionalCsvView a rml:LogicalView ;
+    rml:viewOn :additionalCsvSource ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "name" ;
+      rml:reference "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "id" ;
+      rml:reference "id" ;
+    ] ;
+    .
+
+:csvSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:csvView a rml:LogicalView ;
+  rml:viewOn :csvSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "birthyear" ;
+    rml:reference "birthyear" ;
+  ] ;
+  rml:leftJoin [
+    rml:parentLogicalView :jsonView ;
+    rml:joinCondition [
+      rml:parent "name" ;
+      rml:child "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_type" ;
+      rml:reference "item.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_weight" ;
+      rml:reference "item.weight" ;
+    ] ;
+  ] ;
+  rml:leftJoin [
+    rml:parentLogicalView :additionalCsvView ;
+    rml:joinCondition [
+      rml:parent "name" ;
+      rml:child "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "id" ;
+      rml:reference "id" ;
+    ] ;
+  ] .
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/people/{id}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasBirthyear ;
+    rml:objectMap [
+      rml:reference "birthyear" ;
+      rml:datatype xsd:gYear ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasItem ;
+    rml:objectMap [
+      rml:parentTriplesMap :triplesMapItem ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/item_{#}_{item_type.#}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "item_type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item_weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/people/123> <http://example.org/hasName> "alice" .
+<http://example.org/people/123> <http://example.org/hasBirthyear> "1995"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/people/123> <http://example.org/hasItem> <http://example.org/item_0_0> .
+<http://example.org/people/123> <http://example.org/hasItem> <http://example.org/item_0_1> .
+<http://example.org/item_0_0> <http://example.org/hasType> "sword" .
+<http://example.org/item_0_0> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_0_1> <http://example.org/hasType> "shield" .
+<http://example.org/item_0_1> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/people/456> <http://example.org/hasName> "bob" .
+<http://example.org/people/456> <http://example.org/hasBirthyear> "1999"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/people/456> <http://example.org/hasItem> <http://example.org/item_1_0> .
+<http://example.org/item_1_0> <http://example.org/hasType> "flower" .
+<http://example.org/item_1_0> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/people/789> <http://example.org/hasName> "tobias" .
+<http://example.org/people/789> <http://example.org/hasBirthyear> "2005"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+
+
+ + + + + \ No newline at end of file diff --git a/test-cases/docs/index.html b/test-cases/docs/index.html new file mode 100644 index 0000000..1015d9f --- /dev/null +++ b/test-cases/docs/index.html @@ -0,0 +1,1742 @@ + + + + + + +RML-LV: Test Cases + + + + + + + + + + + + + + +
+ +

RML-LV: Test Cases

+

+ Draft Community Group Report + +

+
+ +
Latest published version:
+ https://www.w3.org/RML-LV-Testcases/ +
+
Latest editor's draft:
https://w3id.org/rml/lv/test-cases/
+ + + + +
Editor:
+ Dylan Van Assche + + + + (IDLab – Ghent University – imec) +
+ +
Author:
+ Dylan Van Assche + + + + (IDLab – Ghent University – imec) +
+
Feedback:
+ GitHub kg-construct/rml-io + (pull requests, + new issue, + open issues) +
+ +
+ + +
+
+ + + +

Abstract

This document defines the RML-LV test cases to the determine the RML-LV specification conformance of tools.

+
+ +

Status of This Document

+ This specification was published by the + Knowledge Graph Construction Community Group. It is not a W3C Standard nor is it + on the W3C Standards Track. + + Please note that under the + W3C Community Contributor License Agreement (CLA) + there is a limited opt-out and other conditions apply. + + Learn more about + W3C Community and Business Groups. +

+ GitHub Issues are preferred for + discussion of this specification. + + +

+ +

1. Introduction

+

This document defines the RML-LV test cases, consisting of a collection of test case documents (input and expected output). +The purpose of the test cases is to determine the conformance of tools that execute RML rules to the RML-LV specification.

+
+ +

2. Data model

+

The test cases are semantically described for re-usability and shareability following the W3C Test case description. +Each test:Testcase as the following properties:

+
    +
  • dcterms:identifier: unique ID of the test case.
  • +
  • rmltest:hasError: if an error of the RML Processor is expected or not.
  • +
  • rmltest:input: One or more input data of the test case.
  • +
  • rmltest:output: One or more output data of the test case.
  • +
  • rmltest:inputFormat: the input data format.
  • +
  • rmltest:outputFormat: the output data format.
  • +
  • rmltest:mappingDocument: the RML mapping rules in Turtle.
  • +
+
+ +

3. Test cases

+

This section describes the RML-LV test cases. These descriptions are also available as RDF. +The files are available on GitHub in the folder test-cases. +Each test case is contained in a single folder, containing three types of files:

+
    +
  • Zero or more files containing the data sources, in the case of JSON, XML, CSV, or containing the SQL statements to create the necessary tables, in the case of MySQL, PostgreSQL, and SQL Server.
  • +
  • One file with the RML rules, called mapping.ttl, in the Turtle format.
  • +
  • Zero or more files with the expected RDF. No file is provided if an error is expected that must halt the generation of the RDF because of an error.
  • +
+
+ + +

4. RMLLVTC0001

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] .
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :jsonView ;
+  rml:subjectMap [
+    rml:template "http://example.org/people/{name}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/people/alice> <http://example.org/hasName> "alice" .
+<http://example.org/people/bob> <http://example.org/hasName> "bob" .
+
+
+

5. RMLLVTC0002

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] ;
+  rml:field [
+    a rml:IterableField ;
+    rml:fieldName "item" ;
+    rml:iterator "$.items[*]" ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "type" ;
+      rml:reference "$.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "weight" ;
+      rml:reference "$.weight" ;
+    ] ;
+  ] .
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :jsonView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasItem ;
+    rml:objectMap [
+      rml:parentTriplesMap :triplesMapItem ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :jsonView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}/item/{item.type}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "item.type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item.weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/sword> .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/shield> .
+<http://example.org/person/bob> <http://example.org/hasName> "bob" .
+<http://example.org/person/bob> <http://example.org/hasItem> <http://example.org/person/bob/item/flower> .
+<http://example.org/person/alice/item/sword> <http://example.org/hasName> "sword" .
+<http://example.org/person/alice/item/sword> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/alice/item/shield> <http://example.org/hasName> "shield" .
+<http://example.org/person/alice/item/shield> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/bob/item/flower> <http://example.org/hasName> "flower" .
+<http://example.org/person/bob/item/flower> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

6. RMLLVTC0003

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Input 1

+
name,birthyear
+alice,1995
+bob,1999
+tobias,2005
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] ;
+  rml:field [
+    a rml:IterableField ;
+    rml:fieldName "item" ;
+    rml:iterator "$.items[*]" ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "type" ;
+      rml:reference "$.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "weight" ;
+      rml:reference "$.weight" ;
+    ] ;
+  ] .
+
+:csvSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:csvView a rml:LogicalView ;
+  rml:viewOn :csvSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "birthyear" ;
+    rml:reference "birthyear" ;
+  ] ;
+  rml:leftJoin [
+    rml:parentLogicalView :jsonView ;
+    rml:joinCondition [
+      rml:parent "name" ;
+      rml:child "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_type" ;
+      rml:reference "item.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_weight" ;
+      rml:reference "item.weight" ;
+    ] ;
+  ] .
+
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasBirthyear ;
+    rml:objectMap [
+      rml:reference "birthyear" ;
+      rml:datatype xsd:gYear ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasItem ;
+    rml:objectMap [
+      rml:parentTriplesMap :triplesMapItem ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}/item/{item_type}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "item_type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item_weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
+<http://example.org/person/alice> <http://example.org/hasBirthyear> "1995"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/sword> .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/shield> .
+<http://example.org/person/alice/item/sword> <http://example.org/hasType> "sword" .
+<http://example.org/person/alice/item/sword> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/alice/item/shield> <http://example.org/hasType> "shield" .
+<http://example.org/person/alice/item/shield> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/bob> <http://example.org/hasName> "bob" .
+<http://example.org/person/bob> <http://example.org/hasBirthyear> "1999"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/person/bob> <http://example.org/hasItem> <http://example.org/person/bob/item/flower> .
+<http://example.org/person/bob/item/flower> <http://example.org/hasType> "flower" .
+<http://example.org/person/bob/item/flower> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/tobias> <http://example.org/hasName> "tobias" .
+<http://example.org/person/tobias> <http://example.org/hasBirthyear> "2005"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+
+
+

7. RMLLVTC0004

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Input 1

+
name,birthyear
+alice,1995
+bob,1999
+tobias,2005
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] ;
+  rml:field [
+    a rml:IterableField ;
+    rml:fieldName "item" ;
+    rml:iterator "$.items[*]" ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "type" ;
+      rml:reference "$.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "weight" ;
+      rml:reference "$.weight" ;
+    ] ;
+  ] .
+
+:csvSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:csvView a rml:LogicalView ;
+  rml:viewOn :csvSource ;
+  rml:field [ a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "birthyear" ;
+    rml:reference "birthyear" ;
+  ] ;
+  rml:innerJoin [
+    rml:parentLogicalView :jsonView ;
+    rml:joinCondition [
+      rml:parent "name" ;
+      rml:child "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_type" ;
+      rml:reference "item.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_weight" ;
+      rml:reference "item.weight" ;
+    ] ;
+  ] .
+
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasBirthyear ;
+    rml:objectMap [
+      rml:reference "birthyear" ;
+      rml:datatype xsd:gYear ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasItem ;
+    rml:objectMap [
+      rml:parentTriplesMap :triplesMapItem ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/person/{name}/item/{item_type}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "item_type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item_weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/person/alice> <http://example.org/hasName> "alice" .
+<http://example.org/person/alice> <http://example.org/hasBirthyear> "1995"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/sword> .
+<http://example.org/person/alice> <http://example.org/hasItem> <http://example.org/person/alice/item/shield> .
+<http://example.org/person/alice/item/sword> <http://example.org/hasType> "sword" .
+<http://example.org/person/alice/item/sword> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/alice/item/shield> <http://example.org/hasType> "shield" .
+<http://example.org/person/alice/item/shield> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/person/bob> <http://example.org/hasName> "bob" .
+<http://example.org/person/bob> <http://example.org/hasBirthyear> "1999"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/person/bob> <http://example.org/hasItem> <http://example.org/person/bob/item/flower> .
+<http://example.org/person/bob/item/flower> <http://example.org/hasType> "flower" .
+<http://example.org/person/bob/item/flower> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

8. RMLLVTC0005

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Input 1

+
name,birthyear
+alice,1995
+bob,1999
+tobias,2005
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] ;
+  rml:field [
+    a rml:IterableField ;
+    rml:fieldName "item" ;
+    rml:iterator "$.items[*]" ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "type" ;
+      rml:reference "$.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "weight" ;
+      rml:reference "$.weight" ;
+    ] ;
+  ] .
+
+:csvSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:csvView a rml:LogicalView ;
+  rml:viewOn :csvSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "birthyear" ;
+    rml:reference "birthyear" ;
+  ] ;
+  rml:innerJoin [
+    rml:parentLogicalView :jsonView ;
+    rml:joinCondition [
+      rml:parent "name" ;
+      rml:child "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_type" ;
+      rml:reference "item.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_weight" ;
+      rml:reference "item.weight" ;
+    ] ;
+  ] .
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/people/{name}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasBirthyear ;
+    rml:objectMap [
+      rml:reference "birthyear" ;
+      rml:datatype xsd:gYear ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasItem ;
+    rml:objectMap [
+      rml:parentTriplesMap :triplesMapItem ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "item_{#}_{item_type.#}" ;
+    rml:termType rml:BlankNode ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "item_type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item_weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/people/alice> <http://example.org/hasName> "alice" .
+<http://example.org/people/alice> <http://example.org/hasBirthyear> "1995"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/people/alice> <http://example.org/hasItem> _:item_0_0 .
+<http://example.org/people/alice> <http://example.org/hasItem> _:item_0_1 .
+_:item_0_0 <http://example.org/hasType> "sword" .
+_:item_0_0 <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:item_0_1 <http://example.org/hasType> "shield" .
+_:item_0_1 <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/people/bob> <http://example.org/hasName> "bob" .
+<http://example.org/people/bob> <http://example.org/hasBirthyear> "1999"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/people/bob> <http://example.org/hasItem> _:item_1_0 .
+_:item_1_0 <http://example.org/hasType> "flower" .
+_:item_1_0 <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

9. RMLLVTC0006

+

Title:

+

Description:

+

Error expected? No

+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:mixedCSVSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:mixedCSVView a rml:LogicalView ;
+  rml:viewOn :mixedCSVSource ;
+  rml:field [
+    a rml:ExpressionField;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "items" ;
+    rml:reference "items" ;
+    rml:field [
+      a rml:IterableField ;
+      rml:referenceFormulation rml:JSONPath ;
+      rml:iterator "$[*]" ;
+      rml:fieldName "item" ;
+      rml:field [
+        a rml:ExpressionField ;
+        rml:fieldName "type" ;
+        rml:reference "$.type" ;
+      ] ;
+      rml:field [
+        a rml:ExpressionField ;
+        rml:fieldName "weight" ;
+        rml:reference "$.weight" ;
+      ] ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :mixedCSVView ;
+  rml:subjectMap [
+    rml:template "http://example.org/item_{#}_{items.item.#}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "items.item.type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "items.item.weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/item_0_0> <http://example.org/hasType> "sword" .
+<http://example.org/item_0_0> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_0_1> <http://example.org/hasType> "shield" .
+<http://example.org/item_0_1> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_1_0> <http://example.org/hasType> "flower" .
+<http://example.org/item_1_0> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

10. RMLLVTC0007

+

Title:

+

Description:

+

Error expected? No

+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:mixedCSVSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:mixedCSVView a rml:LogicalView ;
+  rml:viewOn :mixedCSVSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "item" ;
+    rml:reference "item" ;
+    rml:field [
+      a rml:IterableField ;
+      rml:referenceFormulation rml:JSONPath ;
+      rml:iterator "$[*]" ;
+      rml:fieldName "itemJson" ;
+      rml:field [
+        a rml:ExpressionField;
+        rml:fieldName "type" ;
+        rml:reference "$.type" ; ] ;
+      rml:field [
+        a rml:ExpressionField;
+        rml:fieldName "weight" ;
+        rml:reference "$.weight" ;
+      ] ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :mixedCSVView ;
+  rml:subjectMap [
+    rml:template "http://example.org/item_{#}_{item.#}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "item.itemJson.type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item.itemJson.weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/item_0_0> <http://example.org/hasType> "sword" .
+<http://example.org/item_0_0> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_1_0> <http://example.org/hasType> "shield" .
+<http://example.org/item_1_0> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_2_0> <http://example.org/hasType> "flower" .
+<http://example.org/item_2_0> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

11. RMLLVTC0008

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": "type,weight\nsword,1500\nshield,2500"
+    },
+    {
+      "name": "bob",
+      "items": "type,weight\nflower,15"
+    }
+  ]
+}
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:mixedJSONSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:mixedJSONView a rml:LogicalView ;
+  rml:viewOn :mixedJSONSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+    ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "items" ;
+    rml:reference "$.items" ;
+    rml:field [
+      a rml:IterableField ;
+      rml:referenceFormulation rml:CSV ;
+      rml:fieldName "item";
+      rml:field [
+        a rml:ExpressionField ;
+        rml:fieldName "type" ;
+        rml:reference "type" ;
+      ] ;
+      rml:field [
+        a rml:expressionField ;
+        rml:fieldName "weight" ;
+        rml:reference "weight" ;
+      ] ;
+    ] ;
+  ].
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :mixedJSONView ;
+  rml:subjectMap [
+    rml:template "http://example.org/item_{#}_{items.item.#}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "items.item.type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "items.item.weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/item_0_0> <http://example.org/hasType> "sword" .
+<http://example.org/item_0_0> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_0_1> <http://example.org/hasType> "shield" .
+<http://example.org/item_0_1> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_1_0> <http://example.org/hasType> "flower" .
+<http://example.org/item_1_0> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+
+
+

12. RMLLVTC0009

+

Title:

+

Description:

+

Error expected? No

+

Input

+
{
+  "people": [
+    {
+      "name": "alice",
+      "items": [
+        {
+          "type": "sword",
+          "weight": 1500
+        },
+        {
+          "type": "shield",
+          "weight": 2500
+        }
+      ]
+    },
+    {
+      "name": "bob",
+      "items": [
+        {
+          "type": "flower",
+          "weight": 15
+        }
+      ]
+    }
+  ]
+}
+
+

Input 1

+
name,birthyear
+alice,1995
+bob,1999
+tobias,2005
+
+

Input 2

+
name,id
+alice,123
+bob,456
+tobias,789
+
+

Mapping

+
@prefix rml: <http://w3id.org/rml/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix : <http://example.org/> .
+
+:jsonSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.json" ;
+  ] ;
+  rml:referenceFormulation rml:JSONPath ;
+  rml:iterator "$.people[*]" .
+
+:jsonView a rml:LogicalView ;
+  rml:viewOn :jsonSource ;
+  rml:field [ a
+    rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "$.name" ;
+  ] ;
+  rml:field [
+    a rml:IterableField ;
+    rml:fieldName "item" ;
+    rml:iterator "$.items[*]" ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "type" ;
+      rml:reference "$.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "weight" ;
+      rml:reference "$.weight" ;
+    ] ;
+  ] .
+
+  :additionalCsvSource a rml:LogicalSource ;
+    rml:source [
+      a rml:RelativePathSource , rml:Source ;
+      rml:root rml:MappingDirectory ;
+      rml:path "people2.csv" ;
+    ] ;
+    rml:referenceFormulation rml:CSV .
+
+  :additionalCsvView a rml:LogicalView ;
+    rml:viewOn :additionalCsvSource ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "name" ;
+      rml:reference "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "id" ;
+      rml:reference "id" ;
+    ] ;
+    .
+
+:csvSource a rml:LogicalSource ;
+  rml:source [
+    a rml:RelativePathSource , rml:Source ;
+    rml:root rml:MappingDirectory ;
+    rml:path "people.csv" ;
+  ] ;
+  rml:referenceFormulation rml:CSV .
+
+:csvView a rml:LogicalView ;
+  rml:viewOn :csvSource ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "name" ;
+    rml:reference "name" ;
+  ] ;
+  rml:field [
+    a rml:ExpressionField ;
+    rml:fieldName "birthyear" ;
+    rml:reference "birthyear" ;
+  ] ;
+  rml:leftJoin [
+    rml:parentLogicalView :jsonView ;
+    rml:joinCondition [
+      rml:parent "name" ;
+      rml:child "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_type" ;
+      rml:reference "item.type" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "item_weight" ;
+      rml:reference "item.weight" ;
+    ] ;
+  ] ;
+  rml:leftJoin [
+    rml:parentLogicalView :additionalCsvView ;
+    rml:joinCondition [
+      rml:parent "name" ;
+      rml:child "name" ;
+    ] ;
+    rml:field [
+      a rml:ExpressionField ;
+      rml:fieldName "id" ;
+      rml:reference "id" ;
+    ] ;
+  ] .
+
+:triplesMapPerson a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/people/{id}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasName ;
+    rml:objectMap [
+      rml:reference "name" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasBirthyear ;
+    rml:objectMap [
+      rml:reference "birthyear" ;
+      rml:datatype xsd:gYear ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasItem ;
+    rml:objectMap [
+      rml:parentTriplesMap :triplesMapItem ;
+    ] ;
+  ] .
+
+:triplesMapItem a rml:TriplesMap ;
+  rml:logicalSource :csvView ;
+  rml:subjectMap [
+    rml:template "http://example.org/item_{#}_{item_type.#}" ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasType ;
+    rml:objectMap [
+      rml:reference "item_type" ;
+    ] ;
+  ] ;
+  rml:predicateObjectMap [
+    rml:predicate :hasWeight ;
+    rml:objectMap [
+      rml:reference "item_weight" ;
+      rml:datatype xsd:integer ;
+    ] ;
+  ] .
+
+

Output

+
<http://example.org/people/123> <http://example.org/hasName> "alice" .
+<http://example.org/people/123> <http://example.org/hasBirthyear> "1995"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/people/123> <http://example.org/hasItem> <http://example.org/item_0_0> .
+<http://example.org/people/123> <http://example.org/hasItem> <http://example.org/item_0_1> .
+<http://example.org/item_0_0> <http://example.org/hasType> "sword" .
+<http://example.org/item_0_0> <http://example.org/hasWeight> "1500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/item_0_1> <http://example.org/hasType> "shield" .
+<http://example.org/item_0_1> <http://example.org/hasWeight> "2500"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/people/456> <http://example.org/hasName> "bob" .
+<http://example.org/people/456> <http://example.org/hasBirthyear> "1999"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+<http://example.org/people/456> <http://example.org/hasItem> <http://example.org/item_1_0> .
+<http://example.org/item_1_0> <http://example.org/hasType> "flower" .
+<http://example.org/item_1_0> <http://example.org/hasWeight> "15"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/people/789> <http://example.org/hasName> "tobias" .
+<http://example.org/people/789> <http://example.org/hasBirthyear> "2005"^^<http://www.w3.org/2001/XMLSchema#gYear> .
+
+
+ + + + + \ No newline at end of file diff --git a/test-cases/list.sh b/test-cases/list.sh new file mode 100755 index 0000000..12c3203 --- /dev/null +++ b/test-cases/list.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +for i in RML*; do + echo "
" +done diff --git a/test-cases/make-metadata.py b/test-cases/make-metadata.py new file mode 100755 index 0000000..689dba2 --- /dev/null +++ b/test-cases/make-metadata.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 + +import os +import sys +import glob +import csv + +def get_title_description(testcase: str): + with open ('descriptions.csv') as csvfile: + reader = csv.reader(csvfile) + for row in reader: + if row[0] == testcase: + return row[1], row[2] + +def main(spec: str): + with open ('metadata.csv', 'w') as csvfile: + writer = csv.writer(csvfile) + writer.writerow(['ID', 'title', 'description', 'specification', + 'mapping', 'input_format1', 'input_format2', + 'input_format3', 'output_format1', 'output_format2', + 'output_format3', 'input1', 'input2', 'input3', + 'output1', 'output2', 'output3', 'error']) + for testcase in glob.glob('RML*'): + title, description = get_title_description(testcase) + error = 'false' + input1 = '' + input2 = '' + input3 = '' + input_format1 = '' + input_format2 = '' + input_format3 = '' + output1 = '' + output2 = '' + output3 = '' + output_format1 = '' + output_format2 = '' + output_format3 = '' + + # Input file + if os.path.exists(os.path.join(testcase, 'people.json')): + input1 = 'people.json' + input_format1 = 'application/json' + + if os.path.exists(os.path.join(testcase, 'people.csv')): + input2 = 'people.csv' + input_format2 = 'text/csv' + + if os.path.exists(os.path.join(testcase, 'people2.csv')): + input3 = 'people2.csv' + input_format3 = 'text/csv' + + # Mapping file + if os.path.exists(os.path.join(testcase, 'mapping.ttl')): + mapping_file = 'mapping.ttl' + else: + raise ValueError('Mapping file missing!') + + # Output files + if os.path.exists(os.path.join(testcase, 'output.nq')): + output1 = 'output.nq' + output_format1 = 'application/n-quads' + else: + raise NotImplementedError('output1 is not known, but required') + + writer.writerow([testcase, title, description, spec, mapping_file, + input_format1, input_format2, input_format3, + output_format1, output_format2, output_format3, + input1, input2, input3, output1, output2, + output3, error]) + lines = [] + # Title and description + lines.append(f'## {testcase}\n\n') + lines.append(f'**Title**: {title}\n\n') + lines.append(f'**Description**: {description}\n\n') + if error == 'true': + error_html = 'Yes' + else: + error_html = 'No' + lines.append(f'**Error expected?** {error_html}\n\n') + + # Input + inputCount = '' + + for index, i in enumerate([input1, input2, input3]): + if not i: + break + + if 'http://w3id.org/rml/resources' in i: + input_html = f'**Input{inputCount}**\n [{i}]({i})\n\n' + else: + try: + with open(os.path.join(testcase, i)) as f: + input_html = f'**Input{inputCount}**\n```\n{f.read()}\n```\n\n' + except UnicodeDecodeError: + try: + with open(os.path.join(testcase, i), encoding='utf-16') as f: + input_html = f'**Input{inputCount}**\n```\n{f.read()}\n```\n\n' + except UnicodeDecodeError: + input_html = f'**Input{inputCount}**\n `{i}`\n\n' + + lines.append(input_html) + inputCount = f' {index + 1}' + + # Mapping + with open(os.path.join(testcase, mapping_file)) as f: + mapping_html = f'**Mapping**\n```\n{f.read()}\n```\n\n' + lines.append(mapping_html) + + # Output + outputCount = '' + if output2 or output3: + outputCount = ' 1' + + for index, i in enumerate([output1, output2, output3]): + if not i: + break + + if 'http://w3id.org/rml/resources' in i: + output_html = f'**Output{outputCount}**\n [{i}]({i})\n\n' + else: + try: + with open(os.path.join(testcase, i)) as f: + output_html = f'**Output{outputCount}**\n```\n{f.read()}\n```\n\n' + except UnicodeDecodeError: + try: + with open(os.path.join(testcase, i), encoding='utf-16') as f: + output_html = f'**Output{outputCount}**\n```\n{f.read()}\n```\n\n' + except UnicodeDecodeError: + output_html = f'**Output{outputCount}**\n `{i}`\n\n' + + lines.append(output_html) + outputCount = f' {index + 2}' + + + with open(os.path.join(testcase, 'README.md'), 'w') as f: + f.writelines(lines) + + +if __name__ == '__main__': + if len(sys.argv) != 2: + print('Usage: ./make-metadata.py ') + sys.exit(1) + main(sys.argv[1]) diff --git a/test-cases/manifest.rml.ttl b/test-cases/manifest.rml.ttl new file mode 100644 index 0000000..f4dd249 --- /dev/null +++ b/test-cases/manifest.rml.ttl @@ -0,0 +1,277 @@ +@prefix xsd: . +@prefix dcterms: . +@prefix rml: . +@prefix rmltest: . +@prefix test: . +@base . + +<#TriplesMapTestcase> + a rml:TriplesMap; + + rml:logicalSource [ + rml:source "metadata.csv"; + rml:referenceFormulation rml:CSV; + ]; + + rml:subjectMap [ + rml:reference "ID"; + rml:class test:TestCase; + ]; + + rml:predicateObjectMap [ + rml:predicate dcterms:identifier; + rml:objectMap [ + rml:reference "ID"; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:hasError; + rml:objectMap [ + rml:reference "error"; + rml:datatype xsd:boolean; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:mappingDocument; + rml:objectMap [ + rml:reference "mapping"; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:input; + rml:objectMap [ a rml:RefObjectMap; + rml:parentTriplesMap <#TriplesMapInput1>; + rml:joinCondition [ + rml:child "ID"; + rml:parent "ID"; + ]; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:input; + rml:objectMap [ a rml:RefObjectMap; + rml:parentTriplesMap <#TriplesMapInput2>; + rml:joinCondition [ + rml:child "ID"; + rml:parent "ID"; + ]; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:input; + rml:objectMap [ a rml:RefObjectMap; + rml:parentTriplesMap <#TriplesMapInput3>; + rml:joinCondition [ + rml:child "ID"; + rml:parent "ID"; + ]; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:output; + rml:objectMap [ a rml:RefObjectMap; + rml:parentTriplesMap <#TriplesMapOutput1>; + rml:joinCondition [ + rml:child "ID"; + rml:parent "ID"; + ]; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:output; + rml:objectMap [ a rml:RefObjectMap; + rml:parentTriplesMap <#TriplesMapOutput2>; + rml:joinCondition [ + rml:child "ID"; + rml:parent "ID"; + ]; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:output; + rml:objectMap [ a rml:RefObjectMap; + rml:parentTriplesMap <#TriplesMapOutput3>; + rml:joinCondition [ + rml:child "ID"; + rml:parent "ID"; + ]; + ]; + ]; +. + +<#TriplesMapInput1> + a rml:TriplesMap; + + rml:logicalSource [ + rml:source "metadata.csv"; + rml:referenceFormulation rml:CSV; + ]; + + rml:subjectMap [ + rml:template "{ID}/input/{input1}/"; + rml:class rmltest:Input; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:input; + rml:objectMap [ + rml:reference "input1"; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:inputFormat; + rml:objectMap [ + rml:reference "input_format1"; + ]; + ]; +. + +<#TriplesMapInput2> + a rml:TriplesMap; + + rml:logicalSource [ + rml:source "metadata.csv"; + rml:referenceFormulation rml:CSV; + ]; + + rml:subjectMap [ + rml:template "{ID}/input/{input2}/"; + rml:class rmltest:Input; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:input; + rml:objectMap [ + rml:reference "input2"; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:inputFormat; + rml:objectMap [ + rml:reference "input_format2"; + ]; + ]; +. + +<#TriplesMapInput3> + a rml:TriplesMap; + + rml:logicalSource [ + rml:source "metadata.csv"; + rml:referenceFormulation rml:CSV; + ]; + + rml:subjectMap [ + rml:template "{ID}/input/{input3}/"; + rml:class rmltest:Input; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:input; + rml:objectMap [ + rml:reference "input3"; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:inputFormat; + rml:objectMap [ + rml:reference "input_format3"; + ]; + ]; +. + +<#TriplesMapOutput1> + a rml:TriplesMap; + + rml:logicalSource [ + rml:source "metadata.csv"; + rml:referenceFormulation rml:CSV; + ]; + + rml:subjectMap [ + rml:template "{ID}/output/{output1}/"; + rml:class rmltest:Output; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:output; + rml:objectMap [ + rml:reference "output1"; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:outputFormat; + rml:objectMap [ + rml:reference "output_format1"; + ]; + ]; +. + +<#TriplesMapOutput2> + a rml:TriplesMap; + + rml:logicalSource [ + rml:source "metadata.csv"; + rml:referenceFormulation rml:CSV; + ]; + + rml:subjectMap [ + rml:template "{ID}/output/{output2}/"; + rml:class rmltest:Output; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:output; + rml:objectMap [ + rml:reference "output2"; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:outputFormat; + rml:objectMap [ + rml:reference "output_format2"; + ]; + ]; +. + +<#TriplesMapOutput3> + a rml:TriplesMap; + + rml:logicalSource [ + rml:source "metadata.csv"; + rml:referenceFormulation rml:CSV; + ]; + + rml:subjectMap [ + rml:template "{ID}/output/{output3}/"; + rml:class rmltest:Output; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:output; + rml:objectMap [ + rml:reference "output3"; + ]; + ]; + + rml:predicateObjectMap [ + rml:predicate rmltest:outputFormat; + rml:objectMap [ + rml:reference "output_format3"; + ]; + ]; +. + diff --git a/test-cases/manifest.ttl b/test-cases/manifest.ttl new file mode 100644 index 0000000..470d404 --- /dev/null +++ b/test-cases/manifest.ttl @@ -0,0 +1,161 @@ +@prefix dcterms: . +@prefix rml: . +@prefix rmltest: . +@prefix test: . +@prefix xsd: . + + a test:TestCase; + dcterms:identifier "RMLLVTC0001"; + rmltest:hasError false; + rmltest:input ; + rmltest:mappingDocument "mapping.ttl"; + rmltest:output . + + a rmltest:Input; + rmltest:input "people.json"; + rmltest:inputFormat "application/json" . + + a rmltest:Output; + rmltest:output "output.nq"; + rmltest:outputFormat "application/n-quads" . + + a test:TestCase; + dcterms:identifier "RMLLVTC0002"; + rmltest:hasError false; + rmltest:input ; + rmltest:mappingDocument "mapping.ttl"; + rmltest:output . + + a rmltest:Input; + rmltest:input "people.json"; + rmltest:inputFormat "application/json" . + + a rmltest:Output; + rmltest:output "output.nq"; + rmltest:outputFormat "application/n-quads" . + + a test:TestCase; + dcterms:identifier "RMLLVTC0003"; + rmltest:hasError false; + rmltest:input , ; + rmltest:mappingDocument "mapping.ttl"; + rmltest:output . + + a rmltest:Input; + rmltest:input "people.csv"; + rmltest:inputFormat "text/csv" . + + a rmltest:Input; + rmltest:input "people.json"; + rmltest:inputFormat "application/json" . + + a rmltest:Output; + rmltest:output "output.nq"; + rmltest:outputFormat "application/n-quads" . + + a test:TestCase; + dcterms:identifier "RMLLVTC0004"; + rmltest:hasError false; + rmltest:input , ; + rmltest:mappingDocument "mapping.ttl"; + rmltest:output . + + a rmltest:Input; + rmltest:input "people.csv"; + rmltest:inputFormat "text/csv" . + + a rmltest:Input; + rmltest:input "people.json"; + rmltest:inputFormat "application/json" . + + a rmltest:Output; + rmltest:output "output.nq"; + rmltest:outputFormat "application/n-quads" . + + a test:TestCase; + dcterms:identifier "RMLLVTC0005"; + rmltest:hasError false; + rmltest:input , ; + rmltest:mappingDocument "mapping.ttl"; + rmltest:output . + + a rmltest:Input; + rmltest:input "people.csv"; + rmltest:inputFormat "text/csv" . + + a rmltest:Input; + rmltest:input "people.json"; + rmltest:inputFormat "application/json" . + + a rmltest:Output; + rmltest:output "output.nq"; + rmltest:outputFormat "application/n-quads" . + + a test:TestCase; + dcterms:identifier "RMLLVTC0006"; + rmltest:hasError false; + rmltest:input ; + rmltest:mappingDocument "mapping.ttl"; + rmltest:output . + + a rmltest:Input; + rmltest:input "people.csv"; + rmltest:inputFormat "text/csv" . + + a rmltest:Output; + rmltest:output "output.nq"; + rmltest:outputFormat "application/n-quads" . + + a test:TestCase; + dcterms:identifier "RMLLVTC0007"; + rmltest:hasError false; + rmltest:input ; + rmltest:mappingDocument "mapping.ttl"; + rmltest:output . + + a rmltest:Input; + rmltest:input "people.csv"; + rmltest:inputFormat "text/csv" . + + a rmltest:Output; + rmltest:output "output.nq"; + rmltest:outputFormat "application/n-quads" . + + a test:TestCase; + dcterms:identifier "RMLLVTC0008"; + rmltest:hasError false; + rmltest:input ; + rmltest:mappingDocument "mapping.ttl"; + rmltest:output . + + a rmltest:Input; + rmltest:input "people.json"; + rmltest:inputFormat "application/json" . + + a rmltest:Output; + rmltest:output "output.nq"; + rmltest:outputFormat "application/n-quads" . + + a test:TestCase; + dcterms:identifier "RMLLVTC0009"; + rmltest:hasError false; + rmltest:input , , + ; + rmltest:mappingDocument "mapping.ttl"; + rmltest:output . + + a rmltest:Input; + rmltest:input "people.csv"; + rmltest:inputFormat "text/csv" . + + a rmltest:Input; + rmltest:input "people.json"; + rmltest:inputFormat "application/json" . + + a rmltest:Input; + rmltest:input "people2.csv"; + rmltest:inputFormat "text/csv" . + + a rmltest:Output; + rmltest:output "output.nq"; + rmltest:outputFormat "application/n-quads" . diff --git a/test-cases/metadata.csv b/test-cases/metadata.csv new file mode 100644 index 0000000..9082645 --- /dev/null +++ b/test-cases/metadata.csv @@ -0,0 +1,10 @@ +ID,title,description,specification,mapping,input_format1,input_format2,input_format3,output_format1,output_format2,output_format3,input1,input2,input3,output1,output2,output3,error +RMLLVTC0001,,,http://w3id.org/rml/lv/,mapping.ttl,application/json,,,application/n-quads,,,people.json,,,output.nq,,,false +RMLLVTC0002,,,http://w3id.org/rml/lv/,mapping.ttl,application/json,,,application/n-quads,,,people.json,,,output.nq,,,false +RMLLVTC0003,,,http://w3id.org/rml/lv/,mapping.ttl,application/json,text/csv,,application/n-quads,,,people.json,people.csv,,output.nq,,,false +RMLLVTC0004,,,http://w3id.org/rml/lv/,mapping.ttl,application/json,text/csv,,application/n-quads,,,people.json,people.csv,,output.nq,,,false +RMLLVTC0005,,,http://w3id.org/rml/lv/,mapping.ttl,application/json,text/csv,,application/n-quads,,,people.json,people.csv,,output.nq,,,false +RMLLVTC0006,,,http://w3id.org/rml/lv/,mapping.ttl,,text/csv,,application/n-quads,,,,people.csv,,output.nq,,,false +RMLLVTC0007,,,http://w3id.org/rml/lv/,mapping.ttl,,text/csv,,application/n-quads,,,,people.csv,,output.nq,,,false +RMLLVTC0008,,,http://w3id.org/rml/lv/,mapping.ttl,application/json,,,application/n-quads,,,people.json,,,output.nq,,,false +RMLLVTC0009,,,http://w3id.org/rml/lv/,mapping.ttl,application/json,text/csv,text/csv,application/n-quads,,,people.json,people.csv,people2.csv,output.nq,,,false diff --git a/test-cases/section/abstract.md b/test-cases/section/abstract.md new file mode 100644 index 0000000..97a2cd6 --- /dev/null +++ b/test-cases/section/abstract.md @@ -0,0 +1 @@ +This document defines the RML-LV test cases to the determine the RML-LV specification conformance of tools. diff --git a/test-cases/section/data-model.md b/test-cases/section/data-model.md new file mode 100644 index 0000000..f4c3ad6 --- /dev/null +++ b/test-cases/section/data-model.md @@ -0,0 +1,12 @@ +# Data model + +The test cases are semantically described for re-usability and shareability following the [W3C Test case description](https://www.w3.org/2006/03/test-description). +Each `test:Testcase` as the following properties: + +- `dcterms:identifier`: unique ID of the test case. +- `rmltest:hasError`: if an error of the RML Processor is expected or not. +- `rmltest:input`: One or more input data of the test case. +- `rmltest:output`: One or more output data of the test case. +- `rmltest:inputFormat`: the input data format. +- `rmltest:outputFormat`: the output data format. +- `rmltest:mappingDocument`: the RML mapping rules in Turtle. diff --git a/test-cases/section/introduction.md b/test-cases/section/introduction.md new file mode 100644 index 0000000..f19d17b --- /dev/null +++ b/test-cases/section/introduction.md @@ -0,0 +1,4 @@ +# Introduction + +This document defines the RML-LV test cases, consisting of a collection of test case documents (input and expected output). +The purpose of the test cases is to determine the conformance of tools that execute RML rules to the RML-LV specification. diff --git a/test-cases/section/test-cases.md b/test-cases/section/test-cases.md new file mode 100644 index 0000000..4efe6d7 --- /dev/null +++ b/test-cases/section/test-cases.md @@ -0,0 +1,10 @@ +# Test cases + +This section describes the RML-LV test cases. These descriptions are also available as RDF. +The files are available on [GitHub](https://github.com/kg-construct/rml-lv/tree/main/test-cases) in the folder `test-cases`. +Each test case is contained in a single folder, containing three types of files: + + - Zero or more files containing the data sources, in the case of JSON, XML, CSV, or containing the SQL statements to create the necessary tables, in the case of MySQL, PostgreSQL, and SQL Server. + - One file with the RML rules, called `mapping.ttl`, in the Turtle format. + - Zero or more files with the expected RDF. No file is provided if an error is expected that must halt the generation of the RDF because of an error. +