RML-Core: Test Cases

Draft Community Group Report

Latest published version:
https://kg-construct.github.io/rml-core/test-cases/docs/20260316/
Latest editor's draft:
https://w3id.org/rml/core/test-cases/
Previous version:
https://kg-construct.github.io/rml-core/test-cases/docs/20260313/
Editor:
David Chaves-Fraga (CiTIUS – University of Santiago de Compostela)
Former editor:
Dylan Van Assche (IDLab – Ghent University – imec)
Authors:
Dylan Van Assche (IDLab – Ghent University – imec)
Enrique Iglesias (TIB – Leibniz Information Centre for Science and Technology)
Els de Vleeschauwer (IDLab – Ghent University – imec)
Feedback:
GitHub kg-construct/rml-core (pull requests, new issue, open issues)

Abstract

This document describes RML, a generic mapping language, based on and extending R2RML. The RDF Mapping language (RML) is a mapping language defined to express customized mapping rules from heterogeneous data structures and serializations to the RDF RDF-CONCEPTS data model. RML is defined as a superset of the W3C-standardized mapping language R2RML, aiming to extend its applicability and broaden its scope, adding support for data in other structured formats. R2RML is the W3C standard to express customized mappings from relational databases to RDF. RML follows exactly the same syntax as R2RML; therefore, RML mappings are themselves RDF graphs. The present document describes the RML-Core language and its concepts through definitions and examples.

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-Core 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-Core 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:

3. Test cases

This section describes the RML-Core 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:

4. RMLTC0000-JSON

Title: "one table, one column, zero rows"

Description: "Tests if an empty table produces an empty RDF graph"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": []
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.Name}"
    ] .

Output

# empty database

5. RMLTC0001a-JSON

Title: "One column mapping, subject URI generation by using rml:template"

Description: "Tests: (1) one column mapping; (2) subject URI generation by using rml:template; (3) one column to one property"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "Name":"Venus"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap <http://example.com/base/#NameSubjectMap> .

<http://example.com/base/#NameSubjectMap> rml:template "http://example.com/{$.Name}" .

Output

<http://example.com/Venus> <http://xmlns.com/foaf/0.1/name> "Venus" .

6. RMLTC0001b-JSON

Title: "One column mapping, generation of a BlankNode subject by using rml:termType"

Description: "Tests: (1) one column mapping; (2) generation of a BlankNode subject by using rml:termType; (3) one column to one property"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "Name":"Venus"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:template "{$.Name}";
      rml:termType rml:BlankNode
    ] .

Output

_:Venus <http://xmlns.com/foaf/0.1/name> "Venus" .

7. RMLTC0002a-JSON

Title: "Two columns mapping, generation of a subject URI by the concatenation of two column values"

Description: "Tests: (1) two column mapping, no primary key; (2) subject URI generated by the concatenation of two column values; (3) one column to one property"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.ID"
        ];
      rml:predicate ex:id
    ], [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:class foaf:Person;
      rml:template "http://example.com/{$.ID}/{$.Name}"
    ] .

Output

<http://example.com/10/Venus> <http://xmlns.com/foaf/0.1/name> "Venus" .
<http://example.com/10/Venus> <http://example.com/id> "10"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/10/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

8. RMLTC0002b-JSON

Title: "Two columns mapping, generation of a BlankNode subject by using rml:template and rml:termType"

Description: "Tests: (1) two column mapping, no primary key; (2) generation of a BlankNode subject by using rml:template; (3) one column to one property"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:template "students{$.ID}";
      rml:termType rml:BlankNode
    ] .

Output

_:students10 <http://xmlns.com/foaf/0.1/name> "Venus" .

9. RMLTC0002e-JSON

Title: "Two columns mapping, an undefined rml:path"

Description: "Tests the presence of an undefined rml:path"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student2.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.ID"
        ];
      rml:predicate ex:id
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.ID}/{$.Name}"
    ] .

10. RMLTC0002g-JSON

Title: "Two columns mapping, invalid JSONPath"

Description: "Test the presence of an invalid JSONPath"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.ID"
        ];
      rml:predicate ex:id
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.ID}/{$.Name}"
    ] .

11. RMLTC0003c-JSON

Title: "Three columns mapping, by using a rml:template to produce literal"

Description: "Tests: (1) three column mapping; and (2) the use of rml:template to produce literal"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "FirstName":"Venus",
    "LastName":"Williams"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:template "{$.FirstName} {$.LastName}";
          rml:termType rml:Literal
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:template "http://example.com/Student{$.ID}"
    ] .

Output

<http://example.com/Student10> <http://xmlns.com/foaf/0.1/name> "Venus Williams" .

12. RMLTC0004a-JSON

Title: "Two column mapping, from one row table to two different triples"

Description: "Tests: (1) two column mapping, (2) subject URI generated by a column value; (3) from one row table to two different triples (4) typing by using rml:class"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "Student": "Venus",
    "Sport":"Tennis"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student_sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Student"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:class ex:Student;
      rml:template "http://example.com/{$.Student}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student_sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Sport"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:class ex:Sport;
      rml:template "http://example.com/{$.Sport}"
    ] .

Output

<http://example.com/Venus> <http://xmlns.com/foaf/0.1/name> "Venus" .
<http://example.com/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Student> .
<http://example.com/Tennis> <http://xmlns.com/foaf/0.1/name> "Tennis" .
<http://example.com/Tennis> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Sport> .

13. RMLTC0004b-JSON

Title: "One column mapping, presence of rml:termType rml:Literal on rml:subjectMap"

Description: "Tests: (1) one column mapping (2) the presence of rml:termType rml:Literal on rml:subjectMap, which is invalid"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "students": [{
    "Name":"Venus"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.Name}";
      rml:termType rml:Literal
    ] .

14. RMLTC0005a-JSON

Title: "Typing of resources"

Description: "Tests the typing of resources"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "persons": [
    {
      "fname": "Bob",
      "lname": "Smith",
      "amount": "30.0E0"
    },
    {
      "fname": "Sue",
      "lname": "Jones",
      "amount": "20.0E0"
    },
    {
      "fname": "Bob",
      "lname": "Smith",
      "amount": "30.0E0"
    }
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "ious.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:owes
    ];
  rml:subjectMap [
      rml:class foaf:Person;
      rml:template "http://example.com/{$.fname};{$.lname}"
    ] .

Output

<http://example.com/Bob;Smith> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Bob;Smith> <http://example.com/owes> "30.0E0" .
<http://example.com/Sue;Jones> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Sue;Jones> <http://example.com/owes> "20.0E0" .

15. RMLTC0006a-JSON

Title: "Use of rml:constant in rml:subjectMap, rml:predicateMap, rml:objectMap and rml:graphMap"

Description: "Tests the use of rml:constant in rml:subjectMap, rml:predicateMap, rml:objectMap and rml:graphMap"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "FirstName":"Venus",
    "LastName":"Williams"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:constant "Bad Student"
        ];
      rml:predicateMap [
          rml:constant ex:description
        ]
    ];
  rml:subjectMap [
      rml:constant ex:BadStudent;
      rml:graphMap [
          rml:constant <http://example.com/graph/student>
        ]
    ] .

Output

<http://example.com/BadStudent> <http://example.com/description> "Bad Student" <http://example.com/graph/student> .

16. RMLTC0007a-JSON

Title: "Typing resources by relying on rdf:type predicate"

Description: "Tests the typing resources by relying on rdf:type predicate"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "FirstName":"Venus",
    "LastName":"Williams"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:object foaf:Person;
      rml:predicate rdf:type
    ];
  rml:subjectMap [
      rml:template "http://example.com/Student/{$.ID}/{$.FirstName}"
    ] .

Output

 <http://example.com/Student/10/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

17. RMLTC0007b-JSON

Title: "Assigning triples to Named Graphs"

Description: "Tests the generation of triples to a named graph"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "FirstName":"Venus",
    "LastName":"Williams"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:object foaf:Person;
      rml:predicate rdf:type
    ], [
      rml:objectMap [
          rml:reference "$.FirstName"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:graph ex:PersonGraph;
      rml:template "http://example.com/Student/{$.ID}/{$.FirstName}"
    ] .

Output

<http://example.com/Student/10/Venus> <http://xmlns.com/foaf/0.1/name> "Venus" <http://example.com/PersonGraph> . 
<http://example.com/Student/10/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person>  <http://example.com/PersonGraph> .

18. RMLTC0007c-JSON

Title: "One row mapping, using rml:class"

Description: "Tests subjectmap with more than one class IRIs, rml:class"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "FirstName":"Venus",
    "LastName":"Williams"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.ID"
        ];
      rml:predicate ex:id
    ], [
      rml:objectMap [
          rml:reference "$.FirstName"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:class ex:Student, foaf:Person;
      rml:template "http://example.com/Student/{$.ID}/{$.FirstName}"
    ] .

Output

<http://example.com/Student/10/Venus> <http://xmlns.com/foaf/0.1/name> "Venus" .
<http://example.com/Student/10/Venus> <http://example.com/id> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . 
<http://example.com/Student/10/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Student/10/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Student> .

19. RMLTC0007d-JSON

Title: "One column mapping, specifying an rml:predicateObjectMap with rdf:type"

Description: "Tests subjectmap with an alternative of having rml:class, i.e., by specifying an rml:predicateObjectMap with predicate rdf:type"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "FirstName":"Venus",
    "LastName":"Williams"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:object foaf:Person;
      rml:predicate rdf:type
    ], [
      rml:object ex:Student;
      rml:predicate rdf:type
    ], [
      rml:objectMap [
          rml:reference "$.ID"
        ];
      rml:predicate ex:id
    ], [
      rml:objectMap [
          rml:reference "$.FirstName"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:template "http://example.com/Student/{$.ID}/{$.FirstName}"
    ] .

Output

<http://example.com/Student/10/Venus> <http://xmlns.com/foaf/0.1/name> "Venus" . 
<http://example.com/Student/10/Venus> <http://example.com/id> "10"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Student/10/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Student/10/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Student> .

20. RMLTC0007e-JSON

Title: "One column mapping, using rml:graphMap and rml:class"

Description: "Tests subjectmap with rml:graphMap and rml:class"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.ID"
        ];
      rml:predicate ex:id
    ], [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:class foaf:Person;
      rml:graph ex:PersonGraph;
      rml:template "http://example.com/Student/{$.ID}/{$.Name}"
    ] .

Output

<http://example.com/Student/10/Venus> <http://example.com/id> "10"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.com/PersonGraph> .
<http://example.com/Student/10/Venus> <http://xmlns.com/foaf/0.1/name> "Venus" <http://example.com/PersonGraph> .
<http://example.com/Student/10/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://example.com/PersonGraph> .

21. RMLTC0007f-JSON

Title: "One column mapping, using rml:graphMap and specifying an rml:predicateObjectMap with rdf:type"

Description: "Tests subjectmap with rml:graphMap and specifying an rml:predicateObjectMap with predicate rdf:type"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "FirstName":"Venus",
    "LastName":"Williams"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:object foaf:Person;
      rml:predicate rdf:type
    ], [
      rml:objectMap [
          rml:reference "$.ID"
        ];
      rml:predicate ex:id
    ], [
      rml:objectMap [
          rml:reference "$.FirstName"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:graph ex:PersonGraph;
      rml:template "http://example.com/Student/{$.ID}/{$.FirstName}"
    ] .

Output

<http://example.com/Student/10/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://example.com/PersonGraph> .
<http://example.com/Student/10/Venus> <http://xmlns.com/foaf/0.1/name> "Venus" <http://example.com/PersonGraph> .
<http://example.com/Student/10/Venus> <http://example.com/id> "10"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.com/PersonGraph> .

22. RMLTC0007g-JSON

Title: "Assigning triples to the default graph"

Description: "Tests the generation of triples to the default graph"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "FirstName":"Venus",
    "LastName":"Williams"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.FirstName"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:graph rml:defaultGraph;
      rml:template "http://example.com/Student/{$.ID}/{$.FirstName}"
    ] .

Output

<http://example.com/Student/10/Venus> <http://xmlns.com/foaf/0.1/name> "Venus" .

23. RMLTC0007h-JSON

Title: "Assigning triples to a non-IRI named graph"

Description: "Tests the generation of triples to a non-IRI named graph, which is an error"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "students": [{
    "ID": 10,
    "FirstName":"Venus",
    "LastName":"Williams"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.FirstName"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:graphMap [
          rml:reference "$.ID";
          rml:termType rml:Literal
        ];
      rml:template "http://example.com/Student/{$.ID}/{$.FirstName}"
    ] .

24. RMLTC0008a-JSON

Title: "Generation of triples to a target graph by using rml:graphMap and rml:template"

Description: "Test that results of the mapping can be directed to a target graph by using rml:graphMap and rml:template"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus Williams",
    "Sport": "Tennis"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:object foaf:Person;
      rml:predicate rdf:type
    ], [
      rml:objectMap [
          rml:reference "$.ID"
        ];
      rml:predicate ex:id
    ], [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ], [
      rml:objectMap [
          rml:reference "$.Sport"
        ];
      rml:predicate ex:Sport
    ];
  rml:subjectMap [
      rml:graphMap [
          rml:template "http://example.com/graph/Student/{$.ID}/{$.Name}"
        ];
      rml:template "http://example.com/Student/{$.ID}/{$.Name}"
    ] .

Output

<http://example.com/Student/10/Venus%20Williams> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://example.com/graph/Student/10/Venus%20Williams> .
<http://example.com/Student/10/Venus%20Williams> <http://xmlns.com/foaf/0.1/name> "Venus Williams" <http://example.com/graph/Student/10/Venus%20Williams> .
<http://example.com/Student/10/Venus%20Williams> <http://example.com/id> "10"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.com/graph/Student/10/Venus%20Williams> .
<http://example.com/Student/10/Venus%20Williams> <http://example.com/Sport> "Tennis" <http://example.com/graph/Student/10/Venus%20Williams> . 

25. RMLTC0008b-JSON

Title: "Generation of triples referencing object map"

Description: "Tests the mapping specification referencing object map without join"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus Williams",
    "Sport": "Tennis"
  }]
}

Mapping

@prefix activity: <http://example.com/activity/> .
@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap <http://example.com/base/RefObjectMap1>;
      rml:predicate ex:Sport
    ], [
      rml:object foaf:Person;
      rml:predicate rdf:type
    ], [
      rml:objectMap [
          rml:reference "$.ID"
        ];
      rml:predicate ex:id
    ], [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:template "http://example.com/Student/{$.ID}/{$.Name}"
    ] .

<http://example.com/base/RefObjectMap1> a rml:RefObjectMap;
  rml:parentTriplesMap <http://example.com/base/TriplesMap2> .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:object activity:Sport;
      rml:predicate rdf:type
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.Sport}"
    ] .

Output

<http://example.com/Student/10/Venus%20Williams> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person>  .
<http://example.com/Student/10/Venus%20Williams> <http://xmlns.com/foaf/0.1/name> "Venus Williams" .
<http://example.com/Student/10/Venus%20Williams> <http://example.com/id> "10"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Student/10/Venus%20Williams> <http://example.com/Sport> <http://example.com/Tennis> . 
<http://example.com/Tennis> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/activity/Sport> .


26. RMLTC0008c-JSON

Title: "Generation of triples by using multiple predicateMaps within a rml:predicateObjectMap"

Description: "Tests the generation of triples by using multiple predicateMaps within a rml:predicateObjectMap"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus Williams",
    "Sport": "Tennis"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate ex:name, foaf:name
    ];
  rml:subjectMap [
      rml:template "http://example.com/Student/{$.ID}/{$.Name}"
    ] .

Output

<http://example.com/Student/10/Venus%20Williams> <http://xmlns.com/foaf/0.1/name> "Venus Williams"  .
<http://example.com/Student/10/Venus%20Williams> <http://example.com/name> "Venus Williams"  .

27. RMLTC0009a-JSON

Title: "Generation of triples from foreign key relations"

Description: "Test foreign key relationships among logical tables"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students" : [
    { 
      "ID": 10,
      "Sport": 100,
      "Name": "Venus Williams"
    },
    { 
      "ID": 20,
      "Name": "Demi Moore"
    }
  ]
}

Input 1

{
  "sports": [
    {
      "ID": 100,
      "Name": "Tennis"
    }
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ], [
      rml:objectMap [ a rml:RefObjectMap;
          rml:joinCondition [
              rml:child "$.Sport";
              rml:parent "$.ID"
            ];
          rml:parentTriplesMap <http://example.com/base/TriplesMap2>
        ];
      rml:predicate <http://example.com/ontology/practises>
    ];
  rml:subjectMap [
      rml:template "http://example.com/resource/student_{$.ID}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.sports[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:template "http://example.com/resource/sport_{$.ID}"
    ] .

Output

<http://example.com/resource/student_10> <http://xmlns.com/foaf/0.1/name> "Venus Williams"  .
<http://example.com/resource/student_20> <http://xmlns.com/foaf/0.1/name> "Demi Moore"  .
<http://example.com/resource/sport_100> <http://www.w3.org/2000/01/rdf-schema#label> "Tennis" .
<http://example.com/resource/student_10> <http://example.com/ontology/practises> <http://example.com/resource/sport_100>  .

28. RMLTC0009b-JSON

Title: "Generation of triples to multiple graphs"

Description: "Test that results from distinct parts of the mapping can be directed to different target graphs."

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students" : [
    { 
      "ID": 10,
      "Sport": 100,
      "Name": "Venus Williams"
    },
    { 
      "ID": 20,
      "Name": "Demi Moore"
    }
  ]
}

Input 1

{
  "sports": [
    {
      "ID": 100,
      "Name": "Tennis"
    }
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:graph <http://example.com/graph/students>;
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ], [
      rml:graph <http://example.com/graph/practise>;
      rml:objectMap [ a rml:RefObjectMap;
          rml:joinCondition [
              rml:child "$.Sport";
              rml:parent "$.ID"
            ];
          rml:parentTriplesMap <http://example.com/base/TriplesMap2>
        ];
      rml:predicate <http://example.com/ontology/practises>
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Student>;
      rml:graph <http://example.com/graph/students>;
      rml:template "http://example.com/resource/student_{$.ID}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.sports[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Sport>;
      rml:graph <http://example.com/graph/sports>;
      rml:template "http://example.com/resource/sport_{$.ID}"
    ] .

Output

<http://example.com/resource/student_10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student> <http://example.com/graph/students> .
<http://example.com/resource/student_10> <http://xmlns.com/foaf/0.1/name> "Venus Williams" <http://example.com/graph/students> .
<http://example.com/resource/student_20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student> <http://example.com/graph/students> .
<http://example.com/resource/student_20> <http://xmlns.com/foaf/0.1/name> "Demi Moore" <http://example.com/graph/students> .
<http://example.com/resource/sport_100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> <http://example.com/graph/sports> .
<http://example.com/resource/sport_100> <http://www.w3.org/2000/01/rdf-schema#label> "Tennis" <http://example.com/graph/sports> .
<http://example.com/resource/student_10> <http://example.com/ontology/practises> <http://example.com/resource/sport_100> <http://example.com/graph/practise> .
<http://example.com/resource/student_10> <http://example.com/ontology/practises> <http://example.com/resource/sport_100> <http://example.com/graph/students> .

29. RMLTC0010a-JSON

Title: "Template with table column with blank space"

Description: "Tests a template with blank space in column value"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "countries": [{
    "Country Code": 1,
    "Name":"Bolivia, Plurinational State of",
    "ISO 3166": "BO"
  }, {
    "Country Code": 2,
    "Name":"Ireland",
    "ISO 3166": "IE"
  }, {
    "Country Code": 3,
    "Name":"Saint Martin (French part)",
    "ISO 3166": "MF"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.countries[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "country_info.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate ex:name
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$['Country Code']}"
    ] .

Output

<http://example.com/1> <http://example.com/name> "Bolivia, Plurinational State of" .
<http://example.com/2> <http://example.com/name> "Ireland" .
<http://example.com/3> <http://example.com/name> "Saint Martin (French part)" .

30. RMLTC0010b-JSON

Title: "Template with table columns with special chars"

Description: "Tests a template with special chars in column value"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "countries": [{
    "Country Code": 1,
    "Name":"Bolivia, Plurinational State of",
    "ISO 3166": "BO"
  }, {
    "Country Code": 2,
    "Name":"Ireland",
    "ISO 3166": "IE"
  }, {
    "Country Code": 3,
    "Name":"Saint Martin (French part)",
    "ISO 3166": "MF"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.countries[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "country_info.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate ex:name
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$['Country Code']}/{$.Name}"
    ] .

Output

<http://example.com/1/Bolivia%2C%20Plurinational%20State%20of> <http://example.com/name> "Bolivia, Plurinational State of" .
<http://example.com/2/Ireland> <http://example.com/name> "Ireland" .
<http://example.com/3/Saint%20Martin%20%28French%20part%29> <http://example.com/name> "Saint Martin (French part)" .

31. RMLTC0010c-JSON

Title: "Template with table columns with special chars and backslashes"

Description: "Tests a template with special chars in reference value and backslash escapes in string templates"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "countries": [{
    "Country Code": 1,
    "Name":"Bolivia, Plurinational State of",
    "ISO 3166": "BO"
  }, {
    "Country Code": 2,
    "Name":"Ireland",
    "ISO 3166": "IE"
  }, {
    "Country Code": 3,
    "Name":"Saint Martin (French part)",
    "ISO 3166": "MF"
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.countries[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "country_info.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:predicate ex:code;
      rml:objectMap [
          rml:template "\\{\\{\\{ {$['ISO 3166']} \\}\\}\\}";
          rml:termType rml:Literal
        ]
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$['Country Code']}/{$.Name}"
    ] .

Output

<http://example.com/1/Bolivia%2C%20Plurinational%20State%20of> <http://example.com/code> "{{{ BO }}}" .
<http://example.com/2/Ireland> <http://example.com/code> "{{{ IE }}}" .
<http://example.com/3/Saint%20Martin%20%28French%20part%29> <http://example.com/code> "{{{ MF }}}" .

32. RMLTC0011b-JSON

Title: "M to M relation, by using an additional Triples Map"

Description: "Tests, M to M relations, by using an additional Triples Map"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [
    {"ID":10, "FirstName":"Venus", "LastName":"Williams"},
    {"ID":11, "FirstName":"Fernando", "LastName":"Alonso"},
    {"ID":12, "FirstName":"David", "LastName":"Villa"}
  ]
}

Input 1

{
  "sports": [
    {"ID":110, "Description":"Tennis"},
    {"ID":111, "Description":"Football"},
    {"ID":112, "Description":"Formula1"}
  ]
}

Input 2

{
  "links": [
    {"ID_Student":10, "ID_Sport":110},
    {"ID_Student":11, "ID_Sport":111},
    {"ID_Student":11, "ID_Sport":112},
    {"ID_Student":12, "ID_Sport":111}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/LinkMap_1_2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.links[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student_sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:template "http://example.com/sport/{$.ID_Sport}"
        ];
      rml:predicate ex:plays
    ];
  rml:subjectMap [
      rml:template "http://example.com/student/{$.ID_Student}"
    ] .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.FirstName"
        ];
      rml:predicate ex:firstName
    ], [
      rml:objectMap [
          rml:reference "$.LastName"
        ];
      rml:predicate ex:lastName
    ];
  rml:subjectMap [
      rml:template "http://example.com/student/{$.ID}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.sports[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Description"
        ];
      rml:predicate ex:description
    ], [
      rml:objectMap [
          rml:reference "$.ID"
        ];
      rml:predicate ex:id
    ];
  rml:subjectMap [
      rml:template "http://example.com/sport/{$.ID}"
    ] .

Output

<http://example.com/student/10> <http://example.com/lastName> "Williams" .
<http://example.com/student/10> <http://example.com/firstName> "Venus" .
<http://example.com/student/12> <http://example.com/lastName> "Villa" .
<http://example.com/student/12> <http://example.com/firstName> "David" .
<http://example.com/student/11> <http://example.com/lastName> "Alonso" .
<http://example.com/student/11> <http://example.com/firstName> "Fernando" .
<http://example.com/sport/110> <http://example.com/description> "Tennis" .
<http://example.com/sport/110> <http://example.com/id> "110"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/sport/111> <http://example.com/description> "Football" .
<http://example.com/sport/111> <http://example.com/id> "111"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/sport/112> <http://example.com/description> "Formula1" .
<http://example.com/sport/112> <http://example.com/id> "112"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/student/10> <http://example.com/plays> <http://example.com/sport/110> .
<http://example.com/student/12> <http://example.com/plays> <http://example.com/sport/111> .
<http://example.com/student/11> <http://example.com/plays> <http://example.com/sport/112> .
<http://example.com/student/11> <http://example.com/plays> <http://example.com/sport/111> .

33. RMLTC0012a-JSON

Title: "Blank node referencing multiple columns"

Description: "Tests that blank nodes can be generated by referencing multiple columns"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "persons": [
    {"fname":"Bob","lname":"Smith","amount":30},
    {"fname":"Sue","lname":"Jones","amount":20},
    {"fname":"Bob","lname":"Smith","amount":30}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:template "{$.fname} {$.lname}";
          rml:termType rml:Literal
        ];
      rml:predicate foaf:name
    ], [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "{$.fname}{$.lname}{$.amount}";
      rml:termType rml:BlankNode
    ] .

Output

_:BobSmith30 <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:BobSmith30 <http://xmlns.com/foaf/0.1/name> "Bob Smith" .
_:SueJones20 <http://example.com/amount> "20"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:SueJones20 <http://xmlns.com/foaf/0.1/name> "Sue Jones" .

34. RMLTC0012b-JSON

Title: "Duplicate tuples generate same blank node"

Description: "Tests that blank nodes with same identifier and in the same graph but generated by different logical rows are considered equivalent."

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "lives": [
    {"fname":"Bob","lname":"Smith","city":"London"},
    {"fname":"Sue","lname":"Jones","city":"Madrid"},
    {"fname":"Bob","lname":"Smith","city":"London"}
  ]
}

Input 1

{
  "persons": [
    {"fname":"Bob","lname":"Smith","amount":30},
    {"fname":"Sue","lname":"Jones","amount":20},
    {"fname":"Bob","lname":"Smith","amount":30}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:template "{$.fname} {$.lname}";
          rml:termType rml:Literal
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:template "{$.fname}{$.lname}";
      rml:termType rml:BlankNode
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.lives[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "lives.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.city"
        ];
      rml:predicate ex:city
    ];
  rml:subjectMap [
      rml:template "{$.fname}{$.lname}";
      rml:termType rml:BlankNode
    ] .

Output

_:BobSmith <http://example.com/city> "London" .
_:BobSmith <http://xmlns.com/foaf/0.1/name> "Bob Smith" .
_:SueJones <http://example.com/city> "Madrid" .
_:SueJones <http://xmlns.com/foaf/0.1/name> "Sue Jones" .

35. RMLTC0012c-JSON

Title: "TriplesMap without subjectMap"

Description: "Tests a RML with missing information, TriplesMap without subjectMap."

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "persons": [
    {"fname":"Bob","lname":"Smith","amount":30},
    {"fname":"Sue","lname":"Jones","amount":20},
    {"fname":"Bob","lname":"Smith","amount":30}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:template "{$.fname} {$.lname}";
          rml:termType rml:Literal
        ];
      rml:predicate foaf:name
    ], [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ] .

36. RMLTC0012d-JSON

Title: "TriplesMap with two subjectMap"

Description: "Tests a RML with wrong information, TriplesMap with two subjectMap."

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "persons": [
    {"fname":"Bob","lname":"Smith","amount":30},
    {"fname":"Sue","lname":"Jones","amount":20},
    {"fname":"Bob","lname":"Smith","amount":30}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:template "{$.fname} {$.lname}";
          rml:termType rml:Literal
        ];
      rml:predicate foaf:name
    ], [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "{$.fname}_{$.lname}_{$.amount}";
      rml:termType rml:BlankNode
    ], [
      rml:template "{$.amount}_{$.fname}_{$.lname}";
      rml:termType rml:BlankNode
    ] .

37. RMLTC0012e-JSON

Title: "Blank node as subject"

Description: "Test a subjectMap with termType BlankNode without expressionMap"

Default Base IRI: http://example.com/

Error expected? No

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 "$[*]" .

:triplesMapPerson a rml:TriplesMap ;
  rml:logicalSource :jsonSource ;
  rml:subjectMap [
    rml:termType  rml:BlankNode ;
  ] ;
  rml:predicateObjectMap [
    rml:predicate :firstName ;
    rml:objectMap [
      rml:reference "$.firstName" ;
    ] ;
  ];   
rml:predicateObjectMap [
    rml:predicate :lastName ;
    rml:objectMap [
      rml:reference "$.lastName" ;
   ] ;
 ] . 

Output

_:Blank1 <http://example.org/firstName> "Alice" .
_:Blank1 <http://example.org/lastName> "Smith" .
_:Blank2 <http://example.org/firstName> "Bob" .
_:Blank2 <http://example.org/lastName> "Jones" .

38. RMLTC0013a-JSON

Title: "Null value in JSON file"

Description: "Tests if null values in JSON files are handled correctly."

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "persons": [
    {"ID":"1","Name":"Alice","DateOfBirth":null},
    {"ID":"2","Name":"Bob","DateOfBirth":"September, 2010"}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.DateOfBirth"
        ];
      rml:predicate ex:BirthDay
    ];
  rml:subjectMap [
      rml:template "http://example.com/Person/{$.ID}/{$.Name}/{$.DateOfBirth}"
    ] .

Output

<http://example.com/Person/2/Bob/September%2C%202010> <http://example.com/BirthDay> "September, 2010" .

39. RMLTC0015a-JSON

Title: "Generation of language tags from a table with language information"

Description: "Generation of language tags from a table with language information"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "countries": [
    {"Code": "BO", "Name": "Estado Plurinacional de Bolivia"},
    {"Code": "IE", "Name": "Irlanda"}
  ]
}

Mapping

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.countries[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "country_en.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:language "en";
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.Code}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.countries[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "country_es.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:language "es";
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.Code}"
    ] .

Output

<http://example.com/BO> <http://www.w3.org/2000/01/rdf-schema#label> "Bolivia, Plurinational State of"@en .
<http://example.com/BO> <http://www.w3.org/2000/01/rdf-schema#label> "Estado Plurinacional de Bolivia"@es .
<http://example.com/IE> <http://www.w3.org/2000/01/rdf-schema#label> "Ireland"@en .
<http://example.com/IE> <http://www.w3.org/2000/01/rdf-schema#label> "Irlanda"@es .


40. RMLTC0015b-JSON

Title: "Generation of language tags from a table with language information, and a term map with invalid rml:language value"

Description: "Tests a term map with an invalid rml:language value, which is an error"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "countries": [
    {"Code": "BO", "Name": "Estado Plurinacional de Bolivia"},
    {"Code": "IE", "Name": "Irlanda"}
  ]
}

Mapping

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.countries[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "country_en.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:language "a-english";
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.Code}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.countries[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "country_en.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:language "a-spanish";
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.Code}"
    ] .

41. RMLTC0019a-JSON

Title: "Generation of triples by using IRI value in columns"

Description: "Test the generation of triples by using IRI value in attributes"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "persons": [
    {
      "ID": 10,
      "FirstName": "http://example.com/ns#Jhon",
      "LastName": "Smith"
    },
    {
      "ID": 20,
      "FirstName": "Carlos",
      "LastName": "Mendoza"
    }
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.FirstName"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:reference "$.FirstName"
    ] .

Output

<http://example.com/ns#Jhon> <http://xmlns.com/foaf/0.1/name> "http://example.com/ns#Jhon" .
<http://example.com/Carlos> <http://xmlns.com/foaf/0.1/name> "Carlos" .

42. RMLTC0019b-JSON

Title: "Generation of triples by using IRI value in columns, with data error"

Description: "Test the generation of triples by using IRI value in attributes, conforming RML mapping with data error (and limited results)"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "persons": [
    {
      "ID": 30,
      "FirstName": "Juan Daniel",
      "LastName": "Crespo"
    }
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.FirstName"
        ];
      rml:predicate foaf:name
    ];
  rml:subjectMap [
      rml:reference "$.FirstName"
    ] .

43. RMLTC0020a-JSON

Title: "Generation of triples by using IRI value in columns"

Description: "Test the generation of triples by using IRI value in attributes"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [
    {"Name": "http://example.com/company/Alice"},
    {"Name": "Bob"},
    {"Name": "Bob/Charles"},
    {"Name": "path/../Danny"},
    {"Name": "Emily Smith"}
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:object foaf:Person;
      rml:predicate rdf:type
    ];
  rml:subjectMap [
      rml:template "{$.Name}";
      rml:termType rml:IRI
    ] .

Output

<http://example.com/http%3A%2F%2Fexample.com%2Fcompany%2FAlice> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Bob> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Bob%2FCharles> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/path%2F..%2FDanny> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Emily%20Smith> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

44. RMLTC0021a-JSON

Title: "Generation of triples referencing object map"

Description: "Tests the mapping specification referencing object map with same logical source and join condition"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus Williams",
    "Sport": "Tennis"
  }, {
    "ID": 20,
    "Name":"Serena Williams",
    "Sport": "Tennis"
  }, {
    "ID": 30,
    "Name":"Loena Hendrickx",
    "Sport": "Figure skating"
  }]
}

Mapping

@prefix activity: <http://example.com/activity/> .
@prefix ex: <http://example.com/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/RefObjectMap1> a rml:RefObjectMap;
  rml:joinCondition [
      rml:child "$.Sport";
      rml:parent "$.Sport"
    ];
  rml:parentTriplesMap <http://example.com/base/TriplesMap1> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap <http://example.com/base/RefObjectMap1>;
      rml:predicate ex:sameSportAs
    ];
  rml:subjectMap [
      rml:template "http://example.com/Student/{$.ID}/{$.Name}"
    ] .

Output

<http://example.com/Student/10/Venus%20Williams> <http://example.com/sameSportAs> <http://example.com/Student/10/Venus%20Williams> . 
<http://example.com/Student/10/Venus%20Williams> <http://example.com/sameSportAs> <http://example.com/Student/20/Serena%20Williams> . 
<http://example.com/Student/20/Serena%20Williams> <http://example.com/sameSportAs> <http://example.com/Student/20/Serena%20Williams> . 
<http://example.com/Student/20/Serena%20Williams> <http://example.com/sameSportAs> <http://example.com/Student/10/Venus%20Williams> . 
<http://example.com/Student/30/Loena%20Hendrickx> <http://example.com/sameSportAs> <http://example.com/Student/30/Loena%20Hendrickx> . 


45. RMLTC0022a-JSON

Title: "Generating of triples with constant datatype"

Description: "Test triples with a fixed constant datatype"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus",
    "Age": 21
  }]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:datatype xsd:string;
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ], [
      rml:objectMap [
          rml:datatype xsd:int;
          rml:reference "$.Age"
        ];
      rml:predicate ex:age
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.Name}"
    ] .

Output

<http://example.com/Venus> <http://xmlns.com/foaf/0.1/name> "Venus"^^<http://www.w3.org/2001/XMLSchema#string> .
<http://example.com/Venus> <http://example.com/age> "21"^^<http://www.w3.org/2001/XMLSchema#int> .

46. RMLTC0022b-JSON

Title: "Generating of triples with datatypeMap"

Description: "Test triples with a XSD datatype generated from the data"

Default Base IRI: http://example.com/

Error expected? No

Input

[
    { "FOO": 1, "BAR": "string"},
    { "FOO": 2, "BAR": "int"}
]

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "data.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:datatypeMap [
              rml:template "http://www.w3.org/2001/XMLSchema#{$.BAR}"
            ];
          rml:reference "$.FOO"
        ];
      rml:predicate ex:x
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.FOO}"
    ] .

Output

<http://example.com/1> <http://example.com/x> "1"^^<http://www.w3.org/2001/XMLSchema#string> .
<http://example.com/2> <http://example.com/x> "2"^^<http://www.w3.org/2001/XMLSchema#int> .

47. RMLTC0022c-JSON

Title: "Generating of triples with a template-valued datatypeMap"

Description: "Test triples with a template-valued datatypeMap"

Default Base IRI: http://example.com/

Error expected? No

Input

[
    { "FOO": 1, "BAR": "string"},
    { "FOO": 2, "BAR": "int"}
]

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "data.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:datatypeMap [
              rml:template "datatype#{$.BAR}"
            ];
          rml:reference "$.FOO"
        ];
      rml:predicate ex:x
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.FOO}"
    ] .

Output

<http://example.com/1> <http://example.com/x> "1"^^<http://example.com/datatype#string> .
<http://example.com/2> <http://example.com/x> "2"^^<http://example.com/datatype#int> .

48. RMLTC0022d-JSON

Title: "Generating of triples with a constant-valued datatypeMap"

Description: "Test triples with a constant-valued datatypeMap"

Default Base IRI: http://example.com/

Error expected? No

Input

[
    { "FOO": 1, "BAR": "string"},
    { "FOO": 2, "BAR": "int"}
]

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "data.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:datatypeMap [
              rml:constant xsd:integer
            ];
          rml:reference "$.FOO"
        ];
      rml:predicate ex:x
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.FOO}"
    ] .

Output

<http://example.com/1> <http://example.com/x> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/2> <http://example.com/x> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .

49. RMLTC0022e-JSON

Title: "Generating of triples with a reference-valued datatypeMap"

Description: "Test triples with a reference-valued datatypeMap"

Default Base IRI: http://example.com/

Error expected? No

Input

[
    { "FOO": 1, "BAR": "http://www.w3.org/2001/XMLSchema#string"},
    { "FOO": 2, "BAR": "http://www.w3.org/2001/XMLSchema#int"}
]

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "data.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:datatypeMap [
              rml:reference "BAR";
              rml:termType rml:IRI
            ];
          rml:reference "$.FOO"
        ];
      rml:predicate ex:x
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.FOO}"
    ] .

Output

<http://example.com/1> <http://example.com/x> "1"^^<http://www.w3.org/2001/XMLSchema#string> .
<http://example.com/2> <http://example.com/x> "2"^^<http://www.w3.org/2001/XMLSchema#int> .

50. RMLTC0023a-JSON

Title: "Invalid IRI template 1"

Description: "Test handling of invalid IRI template"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "students": [{
    "ID": 10,
    "{Name}":"Venus"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$.students[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:subjectMap [
      rml:template "http://example.com/{{Name}}";
      rml:class foaf:Person;
    ] .

51. RMLTC0023b-JSON

Title: "Invalid IRI template 2"

Description: "Test handling of invalid IRI template"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "students": [{
    "ID": 10,
    "N\ame":"Venus"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$.students[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:subjectMap [
      rml:template "http://example.com/{N\ame}";
      rml:class foaf:Person;
    ] .

52. RMLTC0023c-JSON

Title: "Invalid IRI template 3"

Description: "Test handling of invalid IRI template"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "students": [{
    "ID": 10,
    "Name":"Venus"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$.students[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:subjectMap [
      rml:template "http://example.com/{Name\}";
      rml:class foaf:Person;
    ] .

53. RMLTC0023d-JSON

Title: "Invalid IRI template 4"

Description: "Test handling of invalid IRI template"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "students": [{
    "ID": 10,
    "{Name}":"Venus"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
     rml:referenceFormulation rml:JSONPath;
     rml:iterator "$.students[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:subjectMap [
      rml:template "http://example.com/{\\\\{Name\\\\}}";
      rml:class foaf:Person;
    ] .

54. RMLTC0023e-JSON

Title: "Invalid IRI template 5"

Description: "Test handling of invalid IRI template"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "students": [{
    "ID": 10,
    "N\ame":"Venus"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$.students[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:subjectMap [
      rml:template "http://example.com/{N\\\ame}";
      rml:class foaf:Person;
    ] .

55. RMLTC0023f-JSON

Title: "Valid IRI template with backslash-escape"

Description: "Test handling of a valid IRI template using backslash-escape"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [{
    "ID": 10,
    "{Name}":"Venus"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
     rml:referenceFormulation rml:JSONPath;
     rml:iterator "$.students[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$['\\{Name\\}']}";
      rml:class foaf:Person;
    ] .

Output

<http://example.com/Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

56. RMLTC0024a-JSON

Title: "Usage of constant term maps in combination with explicitly defined term types"

Description: "Tests the usage of constant term maps in combination with explicitly defined term types"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "students": [{
    "Name":"Venus"
  },
  {
    "Name":"Julio"
  }]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .
@prefix ex: <http://example.com/>.

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate ex:student
    ];
  rml:subjectMap [
      rml:constant "School";
      rml:termType rml:BlankNode
  ] .

57. RMLTC0025a-JSON

Title: "Generation of triples from arrays"

Description: "Tests the generation of triples from array input data structures"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "persons": [
    {"fname":"Bob","lname":"Smith","amounts":[30, 40, 50]}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amounts[*]"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "http://example.com/Student/{$.fname}/{$.lname}"
    ] .

Output

<http://example.com/Student/Bob/Smith> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Student/Bob/Smith> <http://example.com/amount> "40"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Student/Bob/Smith> <http://example.com/amount> "50"^^<http://www.w3.org/2001/XMLSchema#integer> .

58. RMLTC0025b-JSON

Title: "Generation of triples from arrays with wrong reference"

Description: "Tests the generation of triples from array input data structures. Test should fail as reference points to the array and not the values of the array"

Default Base IRI: http://example.com/

Error expected? Yes

Input

{
  "persons": [
    {"fname":"Bob","lname":"Smith","amounts":[30, 40, 50]}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amounts"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "http://example.com/Student/{$.fname}/{$.lname}"
    ] .

59. RMLTC0025c-JSON

Title: "Generation of triples from arrays in subject and object"

Description: "Tests the generation of triples from array input data structures in subject and object"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "persons": [
    {"names":["Bob", "Smith"],"amounts":[30, 40, 50]}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amounts[*]"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "http://example.com/Student/{$.names[*]}"
    ] .

Output

<http://example.com/Student/Smith> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Student/Smith> <http://example.com/amount> "40"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Student/Smith> <http://example.com/amount> "50"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Student/Bob> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Student/Bob> <http://example.com/amount> "40"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Student/Bob> <http://example.com/amount> "50"^^<http://www.w3.org/2001/XMLSchema#integer> .

60. RMLTC0026a-JSON

Title: "Two triples maps, one with rml:baseIRI and one without and generating absolute IRIs"

Description: "Tests the generation of triples from relative IRIs using base IRI"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "persons": [
    {"fname":"Bob","lname":"Smith","amount":30},
    {"fname":"Sue","lname":"Jones","amount":20}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:baseIRI <http://example.com/>;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "{$.fname}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.lname}"
    ] .

Output

<http://example.com/Bob> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Jones> <http://example.com/amount> "20"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Smith> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Sue> <http://example.com/amount> "20"^^<http://www.w3.org/2001/XMLSchema#integer> .

61. RMLTC0026b-JSON

Title: "Two triples maps, one with rml:baseIRI one one without and generating relative IRIs using baseIRI parameter"

Description: "Tests the generation of triples from relative IRI using base IRI parameter"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "persons": [
    {"fname":"Bob","lname":"Smith","amount":30},
    {"fname":"Sue","lname":"Jones","amount":20}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:baseIRI <http://tp1.com/>;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "{$.fname}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "{$.lname}"
    ] .

Output

<http://tp1.com/Bob> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Jones> <http://example.com/amount> "20"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Smith> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://tp1.com/Sue> <http://example.com/amount> "20"^^<http://www.w3.org/2001/XMLSchema#integer> .

62. RMLTC0026c-JSON

Title: "Two triples maps, both with rml:baseIRI defined"

Description: "Tests the generation of triples using relative IRIs with base IRIs defined only in triples maps, without base IRI parameter"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "persons": [
    {"fname":"Bob","lname":"Smith","amount":30},
    {"fname":"Sue","lname":"Jones","amount":20}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:baseIRI <http://example.com/>;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "{$.fname}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:baseIRI <http://example.com/>;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "{$.lname}"
    ] .

Output

<http://example.com/Bob> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Jones> <http://example.com/amount> "20"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Smith> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Sue> <http://example.com/amount> "20"^^<http://www.w3.org/2001/XMLSchema#integer> .

63. RMLTC0026d-JSON

Title: "Two triples maps,both with rml:bseIRI defined and baseIRI parameter defined"

Description: "Tests the generation of triples by with base IRIs different than the base IRI parameter"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "persons": [
    {"fname":"Bob","lname":"Smith","amount":30},
    {"fname":"Sue","lname":"Jones","amount":20}
  ]
}

Mapping

@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:baseIRI <http://example2.com/>;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "{$.fname}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:baseIRI <http://example2.com/>;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.persons[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "persons.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.amount"
        ];
      rml:predicate ex:amount
    ];
  rml:subjectMap [
      rml:template "{$.lname}"
    ] .

Output

<http://example2.com/Bob> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example2.com/Jones> <http://example.com/amount> "20"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example2.com/Smith> <http://example.com/amount> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example2.com/Sue> <http://example.com/amount> "20"^^<http://www.w3.org/2001/XMLSchema#integer> .

64. RMLTC0027a-JSON

Title: "Generation of triples using the URI term type"

Description: "Tests the generation of triples with a URI term type in the subject or object"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [
    {"Name": "Alice"},
    {"Name": "Bob"},
    {"Name": "Bob/Charles"},
    {"Name": "Zoë Krüger"},
    {"Name": "Emily Smith"}
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:object foaf:Person;
      rml:predicate rdf:type
    ];
  rml:subjectMap [
      rml:template "http://example.com/Person/{$.Name}";
      rml:termType rml:URI
    ] .

Output

<http://example.com/Person/Alice> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Person/Bob> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Person/Bob%2FCharles> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Person/Zo%C3%AB%20Kr%C3%BCger> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Person/Emily%20Smith> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

65. RMLTC0027b-JSON

Title: "Generation of triples using the UnsafeIRI term type"

Description: "Tests the generation of triples with a UnsafeIRI term type in the subject or object"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [
    {"Name": "Bob/Charles"},
    {"Name": "Emily Smith"},
    {"Name": "Zoë Krüger"}
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:object foaf:Person;
      rml:predicate rdf:type
    ];
  rml:subjectMap [
      rml:template "http://example.com/Person/{$.Name}";
      rml:termType rml:UnsafeIRI
    ] .

Output

<http://example.com/Person/Bob/Charles> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Person/Emily Smith> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Person/Zoë Krüger> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

66. RMLTC0027c-JSON

Title: "Generation an IRI using the term type IRI"

Description: "Tests the generation of triples with a IRI term type in the subject"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students": [
    {"Name": "Zoë Krüger"}
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:object foaf:Person;
      rml:predicate rdf:type
    ];
  rml:subjectMap [
      rml:template "http://example.com/Person/{$.Name}";
      rml:termType rml:IRI
    ] .

Output

<http://example.com/Person/Zoë%20Krüger> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

67. RMLTC0028a-JSON

Title: "Generation of the right datatype for a constant in the mapping"

Description: "Test the honoring of the datatype specified by the constant term in the mapping"

Default Base IRI: http://example.com/

Error expected? No

Input

[ { "id": "0", "foo": "bar"  } ] 

Mapping

@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
    rml:logicalSource [
      rml:referenceFormulation rml:JSONPath ;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
        rml:root rml:MappingDirectory;
        rml:path "data.json"
      ]
    ];
    rml:subjectMap [
      rml:template "https://example.org/instances/{$.id}";
    ];
    rml:predicateObjectMap [
      rml:predicate <http://example.org/ns/p> ;
      rml:object true ; # datatype is boolean
    ] .

Output

<https://example.org/instances/0> <http://example.org/ns/p> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .

68. RMLTC0028b-JSON

Title: "Generation of all named graphs when rml:defaultGraph is involved"

Description: "Test if the default graph is also generated correctly."

Default Base IRI: http://example.com/

Error expected? No

Input

[ { "id": "0", "name": "Alice"  } ] 

Mapping

@prefix rml: <http://w3id.org/rml/> .
@prefix s: <http://schema.org/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
    rml:logicalSource [
      rml:referenceFormulation rml:JSONPath ;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
        rml:root rml:MappingDirectory;
        rml:path "data.json"
      ]
    ];
    rml:subjectMap [
      rml:template "https://example.org/instances/{$.id}";
      rml:class s:Person ;
      rml:graph <graph:1> ;
    ];
    rml:predicateObjectMap [
      rml:predicate s:givenName ;
      rml:objectMap [ rml:reference "$.name" ] ;
      rml:graph rml:defaultGraph ;
    ].

Output

<https://example.org/instances/0> <http://schema.org/givenName> "Alice".
<https://example.org/instances/0> <http://schema.org/givenName> "Alice" <graph:1> .
<https://example.org/instances/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> <graph:1> .

69. RMLTC0028c-JSON

Title: "Generation of the right language tag for a constant in the mapping"

Description: "Test the honoring of the language tag specified by the constant term in the mapping"

Default Base IRI: http://example.com/

Error expected? No

Input

[ { "id": "0", "foo": "bar"  } ] 

Mapping

@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
    rml:logicalSource [
      rml:referenceFormulation rml:JSONPath ;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
        rml:root rml:MappingDirectory;
        rml:path "data.json"
      ]
    ];
    rml:subjectMap [
      rml:template "https://example.org/instances/{$.id}";
    ];
    rml:predicateObjectMap [
      rml:predicate <http://example.org/ns/p> ;
      rml:object "train"@en ;
    ] .

Output

<https://example.org/instances/0> <http://example.org/ns/p> "train"@en .

70. RMLTC0029a-JSON

Title: "Generating of triples with constant shortcut subject"

Description: "Test triples with a constant shortcut subject from the data"

Default Base IRI: http://example.com/

Error expected? No

Input

[
    { "FOO": "one", "BAR": "string"},
    { "FOO": "two", "BAR": "int"}
]

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "data.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.FOO"
        ];
      rml:predicate ex:x
    ];
  rml:subject ex:example .

Output

<http://example.com/example> <http://example.com/x> "one" .
<http://example.com/example> <http://example.com/x> "two" .

71. RMLTC0030a-JSON

Title: "Generation of triples from a join with reference-valued parentMap and childMap"

Description: "Test the results from a join with reference-valued parentMap and childMap"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students" : [
    { 
      "ID": 10,
      "Sport": 100,
      "Name": "Venus Williams"
    },
    { 
      "ID": 20,
      "Sport": 300,
      "Name": "Demi Moore"
    }
  ]
}

Input 1

{
  "sports": [
    {
      "ID": 100,
      "Name": "Tennis"
    },
     {
      "ID": 200,
      "Name": "Football"
    }
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:graph <http://example.com/graph/students>;
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ], [
      rml:graph <http://example.com/graph/practise>;
      rml:objectMap [ a rml:RefObjectMap;
          rml:joinCondition [
              rml:parentMap [ rml:reference "$.ID" ];
              rml:childMap [ rml:reference "$.Sport" ];
            ];
          rml:parentTriplesMap <http://example.com/base/TriplesMap2>
        ];
      rml:predicate <http://example.com/ontology/practises>
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Student>;
      rml:template "http://example.com/resource/student_{$.ID}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.sports[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Sport>;
      rml:template "http://example.com/resource/sport_{$.ID}"
    ] .

Output

<http://example.com/resource/student_10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student> .
<http://example.com/resource/student_10> <http://xmlns.com/foaf/0.1/name> "Venus Williams"  .
<http://example.com/resource/student_20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student>  .
<http://example.com/resource/student_20> <http://xmlns.com/foaf/0.1/name> "Demi Moore".
<http://example.com/resource/sport_100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_100> <http://www.w3.org/2000/01/rdf-schema#label> "Tennis" .
<http://example.com/resource/student_10> <http://example.com/ontology/practises> <http://example.com/resource/sport_100>  .
<http://example.com/resource/sport_200> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_200> <http://www.w3.org/2000/01/rdf-schema#label> "Football" .

72. RMLTC0030b-JSON

Title: "Generation of triples from a join with template-valued parentMap and childMap"

Description: "Test that results from a join with template-valued parentMap and childMap"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students" : [
    { 
      "ID": 10,
      "Sport": 100,
      "Name": "Venus Williams"
    },
    { 
      "ID": 20,
      "Sport":300,
      "Name": "Demi Moore"
    }
  ]
}

Input 1

{
  "sports": [
    {
      "ID": 100,
      "Name": "Tennis"
    },
     {
      "ID": 200,
      "Name": "Football"
    }
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:graph <http://example.com/graph/students>;
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ], [
      rml:graph <http://example.com/graph/practise>;
      rml:objectMap [ a rml:RefObjectMap;
          rml:joinCondition [
              rml:parentMap [ rml:template "http://example.com/{$.ID}" ];
              rml:childMap [ rml:template "http://example.com/{$.Sport}" ];
            ];
          rml:parentTriplesMap <http://example.com/base/TriplesMap2>
        ];
      rml:predicate <http://example.com/ontology/practises>
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Student>;
      rml:template "http://example.com/resource/student_{$.ID}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.sports[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Sport>;
      rml:template "http://example.com/resource/sport_{$.ID}"
    ] .

Output

<http://example.com/resource/student_10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student> .
<http://example.com/resource/student_10> <http://xmlns.com/foaf/0.1/name> "Venus Williams"  .
<http://example.com/resource/student_20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student>  .
<http://example.com/resource/student_20> <http://xmlns.com/foaf/0.1/name> "Demi Moore".
<http://example.com/resource/sport_100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_100> <http://www.w3.org/2000/01/rdf-schema#label> "Tennis" .
<http://example.com/resource/student_10> <http://example.com/ontology/practises> <http://example.com/resource/sport_100>  .
<http://example.com/resource/sport_200> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_200> <http://www.w3.org/2000/01/rdf-schema#label> "Football" .

73. RMLTC0030c-JSON

Title: "Generation of triples from a join with constant-valued parentMap"

Description: "Test that results from a join with constant-valued parentMap"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students" : [
    { 
      "ID": 10,
      "Sport": 100,
      "Name": "Venus Williams"
    },
    { 
      "ID": 20,
      "Sport": 300,
      "Name": "Demi Moore"
    }
  ]
}

Input 1

{
  "sports": [
    {
      "ID": 100,
      "Name": "Tennis"
    },
     {
      "ID": 200,
      "Name": "Football"
    }
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:graph <http://example.com/graph/students>;
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ], [
      rml:graph <http://example.com/graph/practise>;
      rml:objectMap [ a rml:RefObjectMap;
          rml:joinCondition [
              rml:parentMap [ rml:constant "100" ];
              rml:childMap [ rml:reference "$.Sport" ];
            ];
          rml:parentTriplesMap <http://example.com/base/TriplesMap2>
        ];
      rml:predicate <http://example.com/ontology/practises>
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Student>;
      rml:template "http://example.com/resource/student_{$.ID}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.sports[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Sport>;
      rml:template "http://example.com/resource/sport_{$.ID}"
    ] .

Output

<http://example.com/resource/student_10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student> .
<http://example.com/resource/student_10> <http://xmlns.com/foaf/0.1/name> "Venus Williams"  .
<http://example.com/resource/student_20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student>  .
<http://example.com/resource/student_20> <http://xmlns.com/foaf/0.1/name> "Demi Moore".
<http://example.com/resource/sport_100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_100> <http://www.w3.org/2000/01/rdf-schema#label> "Tennis" .
<http://example.com/resource/student_10> <http://example.com/ontology/practises> <http://example.com/resource/sport_100>  .
<http://example.com/resource/sport_200> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_200> <http://www.w3.org/2000/01/rdf-schema#label> "Football" .

74. RMLTC0030d-JSON

Title: "Generation of triples from a join with constant-valued parentMap"

Description: "Test that results from a join with constant-valued parentMap"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students" : [
    { 
      "ID": 10,
      "Sport": 100,
      "Name": "Venus Williams"
    },
    { 
      "ID": 20,
      "Sport": 300,
      "Name": "Demi Moore"
    }
  ]
}

Input 1

{
  "sports": [
    {
      "ID": 100,
      "Name": "Tennis"
    },
     {
      "ID": 200,
      "Name": "Football"
    }
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:graph <http://example.com/graph/students>;
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ], [
      rml:graph <http://example.com/graph/practise>;
      rml:objectMap [ a rml:RefObjectMap;
          rml:joinCondition [
              rml:parentMap [ rml:constant "http://example.com/100" ];
              rml:childMap [ rml:template "http://example.com/{$.Sport}" ];
            ];
          rml:parentTriplesMap <http://example.com/base/TriplesMap2>
        ];
      rml:predicate <http://example.com/ontology/practises>
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Student>;
      rml:template "http://example.com/resource/student_{$.ID}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.sports[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Sport>;
      rml:template "http://example.com/resource/sport_{$.ID}"
    ] .

Output

<http://example.com/resource/student_10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student> .
<http://example.com/resource/student_10> <http://xmlns.com/foaf/0.1/name> "Venus Williams"  .
<http://example.com/resource/student_20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student>  .
<http://example.com/resource/student_20> <http://xmlns.com/foaf/0.1/name> "Demi Moore".
<http://example.com/resource/sport_100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_100> <http://www.w3.org/2000/01/rdf-schema#label> "Tennis" .
<http://example.com/resource/student_10> <http://example.com/ontology/practises> <http://example.com/resource/sport_100>  .
<http://example.com/resource/sport_200> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_200> <http://www.w3.org/2000/01/rdf-schema#label> "Football" .

75. RMLTC0030e-JSON

Title: "Generation of triples from a join with constant-valued childMap"

Description: "Test that results from a join with constant-valued childMap"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students" : [
    { 
      "ID": 10,
      "Sport": 100,
      "Name": "Venus Williams"
    },
    { 
      "ID": 20,
      "Sport": 300,
      "Name": "Demi Moore"
    }
  ]
}

Input 1

{
  "sports": [
    {
      "ID": 100,
      "Name": "Tennis"
    },
     {
      "ID": 200,
      "Name": "Football"
    }
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:graph <http://example.com/graph/students>;
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ], [
      rml:graph <http://example.com/graph/practise>;
      rml:objectMap [ a rml:RefObjectMap;
          rml:joinCondition [
              rml:parentMap [ rml:reference "$.ID" ];
              rml:childMap [ rml:constant "100" ];
            ];
          rml:parentTriplesMap <http://example.com/base/TriplesMap2>
        ];
      rml:predicate <http://example.com/ontology/practises>
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Student>;
      rml:template "http://example.com/resource/student_{$.ID}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.sports[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Sport>;
      rml:template "http://example.com/resource/sport_{$.ID}"
    ] .

Output

<http://example.com/resource/student_10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student> .
<http://example.com/resource/student_10> <http://xmlns.com/foaf/0.1/name> "Venus Williams"  .
<http://example.com/resource/student_20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student>  .
<http://example.com/resource/student_20> <http://xmlns.com/foaf/0.1/name> "Demi Moore".
<http://example.com/resource/sport_100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_100> <http://www.w3.org/2000/01/rdf-schema#label> "Tennis" .
<http://example.com/resource/student_10> <http://example.com/ontology/practises> <http://example.com/resource/sport_100>  .
<http://example.com/resource/sport_200> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_200> <http://www.w3.org/2000/01/rdf-schema#label> "Football" .

76. RMLTC0030f-JSON

Title: "Generation of triples from a join with constant-valued childMap"

Description: "Test that results from a join with constant-valued childMap"

Default Base IRI: http://example.com/

Error expected? No

Input

{
  "students" : [
    { 
      "ID": 10,
      "Sport": 100,
      "Name": "Venus Williams"
    },
    { 
      "ID": 20,
      "Sport": 300,
      "Name": "Demi Moore"
    }
  ]
}

Input 1

{
  "sports": [
    {
      "ID": 100,
      "Name": "Tennis"
    },
     {
      "ID": 200,
      "Name": "Football"
    }
  ]
}

Mapping

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.students[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "student.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:graph <http://example.com/graph/students>;
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate foaf:name
    ], [
      rml:graph <http://example.com/graph/practise>;
      rml:objectMap [ a rml:RefObjectMap;
          rml:joinCondition [
              rml:parentMap [ rml:template "http://example.com/{$.ID}" ];
              rml:childMap [ rml:constant "http://example.com/100" ];
            ];
          rml:parentTriplesMap <http://example.com/base/TriplesMap2>
        ];
      rml:predicate <http://example.com/ontology/practises>
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Student>;
      rml:template "http://example.com/resource/student_{$.ID}"
    ] .

<http://example.com/base/TriplesMap2> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:iterator "$.sports[*]";
      rml:referenceFormulation rml:JSONPath;
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "sport.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:reference "$.Name"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:class <http://example.com/ontology/Sport>;
      rml:template "http://example.com/resource/sport_{$.ID}"
    ] .

Output

<http://example.com/resource/student_10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student> .
<http://example.com/resource/student_10> <http://xmlns.com/foaf/0.1/name> "Venus Williams"  .
<http://example.com/resource/student_20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Student>  .
<http://example.com/resource/student_20> <http://xmlns.com/foaf/0.1/name> "Demi Moore".
<http://example.com/resource/sport_100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_100> <http://www.w3.org/2000/01/rdf-schema#label> "Tennis" .
<http://example.com/resource/student_10> <http://example.com/ontology/practises> <http://example.com/resource/sport_100>  .
<http://example.com/resource/sport_200> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ontology/Sport> .
<http://example.com/resource/sport_200> <http://www.w3.org/2000/01/rdf-schema#label> "Football" .

77. RMLTC0031a-JSON

Title: "Generating of triples with a constant-valued language map"

Description: "Test triples with a constant-valued language map"

Default Base IRI: http://example.com/

Error expected? No

Input

[
    {"ID": 10,"label": "apple"},
    { "ID": 20,"label": "pear"}
]

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "data.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:languageMap [
              rml:constant "en"
            ];
          rml:reference "$.label"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.ID}"
    ] .

Output

<http://example.com/10> <http://www.w3.org/2000/01/rdf-schema#label> "apple"@en .
<http://example.com/20> <http://www.w3.org/2000/01/rdf-schema#label> "pear"@en .

78. RMLTC0031b-JSON

Title: "Generating of triples with a reference-valued language map"

Description: "Test triples with a reference-valued language map"

Default Base IRI: http://example.com/

Error expected? No

Input

[
    {
        "ID": 10,
        "label": "apple",
        "language": "en"
    },
    {
        "ID": 10,
        "label": "pomme",
        "language": "fr"
    }
]

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "data.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:languageMap [
              rml:reference "$.language"
            ];
          rml:reference "$.label"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.ID}"
    ] .

Output

<http://example.com/10> <http://www.w3.org/2000/01/rdf-schema#label> "apple"@en .
<http://example.com/10> <http://www.w3.org/2000/01/rdf-schema#label> "pomme"@fr .

79. RMLTC0031c-JSON

Title: "Generating of triples with a template-valued language map"

Description: "Test triples with a template-valued language map"

Default Base IRI: http://example.com/

Error expected? No

Input

[
    {
        "ID": 10,
        "label": "aubergine",
        "language": "en", 
        "region":"GB"
    },
    {
        "ID": 10,
        "label": "eggplant",
        "language": "en",
        "region": "US"
    }
]

Mapping

@prefix ex: <http://example.com/> .
@prefix rml: <http://w3id.org/rml/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
  rml:logicalSource [ a rml:LogicalSource;
      rml:referenceFormulation rml:JSONPath;
      rml:iterator "$[*]";
      rml:source [ a rml:RelativePathSource;
          rml:root rml:MappingDirectory;
          rml:path "data.json"
        ]
    ];
  rml:predicateObjectMap [
      rml:objectMap [
          rml:languageMap [
              rml:template "{$.language}-{$.region}"
            ];
          rml:reference "$.label"
        ];
      rml:predicate rdfs:label
    ];
  rml:subjectMap [
      rml:template "http://example.com/{$.ID}"
    ] .

Output

<http://example.com/10> <http://www.w3.org/2000/01/rdf-schema#label> "aubergine"@en-GB .
<http://example.com/10> <http://www.w3.org/2000/01/rdf-schema#label> "eggplant"@en-US .

A. References

A.1 Informative references

[rdf-concepts]
Resource Description Framework (RDF): Concepts and Abstract Syntax. Graham Klyne; Jeremy Carroll. W3C. 10 February 2004. W3C Recommendation. URL: https://www.w3.org/TR/rdf-concepts/