Warning:
This wiki has been archived and is now read-only.

R2RML Test Cases

From RDB2RDF
Jump to: navigation, search

Purpose

The purpose of the R2RML test cases is to verify and validate the specification of the R2RML language. Moreover, these test cases can be useful to create a test harness or automated test framework for testing the interoperable implementors, i.e. R2RML engines.

Initial Approach

Process Owner

As in previous WGs we need someone to collect, document, and package the test cases. The person in charge is Boris, and everyone is welcome to contribute/comment to the Test Cases.

Official document

There will be a centralized document that includes the R2RML Test Cases, and it will be available at R2RML Test Cases

Initially, only Michael and Boris are able to edit the document. They will edit the document following the comments/suggestions of the people from the WG.

Starting documents

We will start from a set of very simple test cases (see File:SimpleTestCases.pdf document) and a set of general test cases (see File:GeneralTestCases.pdf document). We have to refine them and also to identify a set of new test cases.

Later on we can reuse another test cases from Can RDB2RDF Tools Feasibily Expose Large Science Archives for Data Integration? or HLCS (Thanks Harry for pointing out those resources).

Initial Protocol

If someone wants to comment/suggest something related with the test cases, that person has to send an email to the WG mailing list, specifying in the subject [R2RML Test Cases]. In this way will be easy to keep track of the discussion about the test cases.

When the WG reaches a consensus about a particular test case, Boris will include this test case in the official document.

R2RML Test Cases

This first round of test cases is very simple, tables do not include PK,FK. No Blank nodes.

The table owner for the whole set of test cases: boricles.

Simple Test Cases

R2RMLTC0000

Id: R2RMLTC0000

Title: Empty table

Purpose: Tests if an empty table produces an empty RDF graph.

Specification Reference: 1.30

Review Status: On hold depending on Direct Mapping as default

Input:

Graphical Representation:

Student
Name

SQL:

CREATE TABLE Student (
Name varchar(50)
);

Expected Result: RDF:


Expected Default Mapping Result:


R2RML Mapping:

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

<#TriplesMap1>
    a rr:TriplesMap;
        
    rr:tableOwner "boricles";
    rr:tableName "Student";

    rr:subjectMap [ rr:template "http://example.com/{Name}" ]; 
	
    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:name ]; 
      rr:objectMap    [ rr:column "Name" ]
    ]
    .

R2RMLTC0001

Id: R2RMLTC0001

Title: One column mapping

Purpose: Tests: (1) one column mapping, no primary key; (2) subject URI generation by using one single column; (3) one column to one property

Specification Reference: 1.30

Review Status: Accepted

Input:

Graphical Representation:

Student
Name
Venus

SQL:

CREATE TABLE Student (
Name varchar(50)
);
INSERT INTO Student (Name) VALUES ("Venus");

Expected Result:

RDF:

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

ex:Venus foaf:name "Venus".

Expected Default Mapping Result:


R2RML Mapping:

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

<#TriplesMap1>
    a rr:TriplesMap;
    
    rr:tableOwner "boricles";
    rr:tableName "Student";

    rr:subjectMap [ rr:template "http://example.com/{Name}" ]; 
	
    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:name ]; 
      rr:objectMap    [ rr:column "Name" ]
    ]
    .

R2RMLTC0002

Id: R2RMLTC0002

Title: Two columns mapping

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

Specification Reference: 1.30

Review Status: unreviewed

Input:

Graphical Representation:

Student
ID Name
10 Venus

SQL:

CREATE TABLE Student (
ID integer,
Name varchar(50)
);
INSERT INTO Student (ID, Name) VALUES(10,"Venus");

Expected Result:

RDF:

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

ex:10Venus rdf:type foaf:Person;
           ex:id "10"^^xsd:integer;
           foaf:name "Venus".

Expected Default Mapping Result:

 

R2RML Mapping:

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

<#TriplesMap1>
    a rr:TriplesMap;
    
    rr:tableOwner "boricles";
    rr:tableName "Student";

    rr:subjectMap [ rr:template "http://example.com/{ID}{Name}";
                    rr:class foaf:Person ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate ex:id ]; 
      rr:objectMap    [ rr:column "ID"; rr:datatype xsd:integer ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:name ]; 
      rr:objectMap    [ rr:column "Name" ]
    ]
    .

R2RMLTC0003

Id: R2RMLTC0003

Title: Three column mapping

Purpose: Tests: (1)three column mapping, no primary key; (2) Subject URI generated by concatenation of three column values and a constant value; (3) One column to one property

Specification Reference: 1.30

Review Status: unreviewed

Input:

Graphical Representation:

Student
ID FirstName LastName
10 Venus Williams

SQL:

CREATE TABLE Student (
ID integer,
FirstName varchar(50),
LastName varchar(50)
);
INSERT INTO Student (ID, FirstName, LastName) VALUES (10,"Venus", "Williams");

Expected Result:

RDF:

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

ex:Student10VenusWilliams rdf:type foaf:Person
                          ex:id "10"^^xsd:integer;
                          foaf:firstName "Venus";
                          foaf:lastName "Williams".

Expected Default Mapping Result:

 

R2RML Mapping:

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

<#TriplesMap1>
    a rr:TriplesMap;

    rr:tableOwner "boricles";
    rr:tableName "Student";

    rr:subjectMap [ rr:template "http://example.com/Student{ID}{FirstName}{LastName}";
                    rr:class foaf:Person  ];
	
    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate ex:id ]; 
      rr:objectMap    [ rr:column "ID"; rr:datatype xsd:integer ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:firstName ]; 
      rr:objectMap    [ rr:column "FirstName" ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:lastName ]; 
      rr:objectMap    [ rr:column "LastName" ]
    ]
    .

R2RMLTC0004

Id: R2RMLTC0004

Title: Two column mapping, a concatenation operation

Purpose: Tests: (1) two column mapping, no primary key; (2) subject URI generated by concatenation of three column values and a constant value; (3) Two column to one property – concat operation

Specification Reference: 1.30

Review Status: unreviewed

Input:

Graphical Representation:

Student
ID FirstName LastName
10 Venus Williams

SQL:

CREATE TABLE Student (
ID integer,
FirstName varchar(50),
LastName varchar(50)
);
INSERT INTO Student (ID, FirstName, LastName) VALUES (10,"Venus", "Williams");

Expected Result:

RDF:

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

ex:Student10VenusWilliams rdf:type foaf:Person
                          ex:id "10"^^xsd:integer;
                          foaf:name "Venus Williams".

Expected Default Mapping Result:

 

R2RML Mapping:

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

<#TriplesMap1>
    a rr:TriplesMap;

      rr:SQLQuery """
      SELECT ID,
             (FirstName || ' ' || LastName) AS Name
      FROM Student
      """;

    rr:subjectMap [ rr:template "http://example.com/Student{ID}{Name}"; 
                    rr:class foaf:Person ];
	
    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate ex:id ]; 
      rr:objectMap    [ rr:column "ID"; rr:datatype xsd:integer ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:name ]; 
      rr:objectMap    [ rr:column "Name" ]
    ]
    .

Note: A SQLQuery for MySQL is different:

 rr:SQLQuery """
             SELECT ID,
             CONCAT (FirstName,' ',LastName) AS Name
             FROM Student
      """;

R2RMLTC0005

Id: R2RMLTC0005

Title: Projection

Purpose: Tests: (1) two column mapping, no primary key, (2) subject URI generated by a column value; (3) one row table to two different resources

Specification Reference: 1.30

Review Status: unreviewed

Input:

Graphical Representation:

Student_Sport
Student Sport
Venus Tennis

SQL:

CREATE TABLE Student_Sport(
      Student varchar(50),
      Sport varchar(50)
);
INSERT INTO Student_Sport (Student,Sport) VALUES ("Venus", "Tennis");

Expected Result:

RDF:

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

ex:Venus rdf:type ex:Student;
         foaf:name "Venus".

ex:Tennis rdf:type ex:Sport;
          foaf:name "Tennis".

Expected Default Mapping Result:

 

R2RML Mapping:

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

<#TriplesMap1>
    a rr:TriplesMap;

    rr:tableOwner "boricles";
    rr:tableName "Student_Sport";

    rr:subjectMap [ rr:template "http://example.com/{Student}";
                    rr:class ex:Student ];
	
    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:name ]; 
      rr:objectMap    [ rr:column "Student" ]
    ]
    .

<#TriplesMap2>
    a rr:TriplesMap;

    rr:tableOwner "boricles";
    rr:tableName "Student_Sport";

    rr:subjectMap [ rr:template "http://example.com/{Sport}";
                    rr:class ex:Sport  ];
	
    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:name ]; 
      rr:objectMap    [ rr:column "Sport" ]
    ]
    .

R2RMLTC0005b

Id: R2RMLTC0005b

Title: Projection

Purpose: Tests, two column mapping, no primary key, non-unique data

URI generated by a column value

Three row table with non-unique rows.

Specification Reference: 1.30@@

Review Status: unreviewed

Input:

Graphical Representation:

IOUs
fname lname amount
Bob Smith 30
Sue Jones 20
Bob Smith 30

SQL:

CREATE TABLE IOUs (
      fname CHAR(20),
      lname CHAR(20),
      amount FLOAT);
INSERT INTO IOUs (fname, lname, amount) VALUES ("Bob", "Smith", 30);
INSERT INTO IOUs (fname, lname, amount) VALUES ("Sue", "Jones", 20);
INSERT INTO IOUs (fname, lname, amount) VALUES ("Bob", "Smith", 30);

Expected Result:

RDF:

@base <http://example.com/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix IOUs: <IOUs#> .

_:Bob1 rdf:type <IOUs>;
       fname "Bob".
       lanme "Smith".
       amount 30.0 .

_:Bob1 rdf:type <IOUs>;
       fname "Sue".
       lanme "Jones".
       amount 20.0 .

_:Bob2 rdf:type <IOUs>;
       fname "Bob".
       lanme "Smith".
       amount 30.0 .

Expected Default Mapping Result:

 

R2RML Mapping: @@

Discriminating SQL Query:

SELECT SUM(amount) FROM IOUs WHERE fname="Bob" AND lname="Smith";

R2RMLTC0006

Id: R2RMLTC0006

Title: Join/Union

Purpose: Tests: (1) join/union tables; (2) subject URI generated by concatenation of three column values, (3) join of two different row tables to one resource

Specification Reference: 1.30

Review Status: unreviewed

Input:

Graphical Representation:

Student
ID FirstName LastName
10 Venus Williams
Web
ID Nick Homepage
10 Ven http://venus.williams.com


SQL:

CREATE TABLE Student (
ID integer,
FirstName varchar(50),
LastName varchar(50)
);
CREATE TABLE Web (
ID integer,
Nick varchar (50),
Homepage varchar(50)
);
INSERT INTO Student (ID, FirstName, LastName) VALUES (10,"Venus", "Williams");
INSERT INTO Web (ID, Nick, Homepage) VALUES (10,"Ven", "http://venus.williams.com");

Expected Result:

RDF:

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

ex:10VenusWilliams rdf:type foaf:Person;
                   ex:id "10"^^xsd:integer;
                   foaf:firstName "Venus";
                   foaf:lastName "Williams";
                   foaf:nick "Ven";
                   foaf:homepage <http://venus.williams.com>.

Expected Default Mapping Result:

 


R2RML Mapping:

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

<#TriplesMap1>
    a rr:TriplesMap;

       rr:SQLquery """
       SELECT Student.ID as Id,
              Student.FirstName as FirstName,
              Student.LastName as LastName,
              Web.Nick as Nick,
              Web.Homepage as Homepage
       FROM Student, Web
       WHERE Student.ID = Web.ID
       """;

    rr:subjectMap [ rr:template "http://example.com/{Id}{FirstName}{LastName}";
                    rr:class foaf:Person ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate ex:id ]; 
      rr:objectMap    [ rr:column "ID"; rr:datatype xsd:integer ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:firstName ]; 
      rr:objectMap    [ rr:column "FirstName" ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:lastName ]; 
      rr:objectMap    [ rr:column "LastName" ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:nick ]; 
      rr:objectMap    [ rr:column "Nick" ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:homepage ]; 
      rr:objectMap    [ rr:column "Homepage"; rr:datatype xsd:anyURI ]
    ]

    .

R2RMLTC0007

Id: R2RMLTC0007

Title: Selection

Purpose: Tests: (1) selection, a subset of the rows of a table maps a resource; (2) subject URI generated by concatenation of three column values

Specification Reference: 1.30

Review Status: unreviewed

Input:

Graphical Representation:

Student
ID FirstName LastName Gender
10 Venus Williams Female
11 Rafael Nadal Male


SQL:

CREATE TABLE Student (
ID integer,
FirstName varchar(50),
LastName varchar(50),
Gender varchar(20) 
);
INSERT INTO Student (ID, FirstName, LastName, Gender) VALUES (10,"Venus", "Williams","Female");
INSERT INTO Student (ID, FirstName, LastName, Gender) VALUES (11,"Rafael", "Nadal","Male");

Expected Result:

RDF:

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

ex:10VenusWilliams rdf:type ex:Women ;
                   ex:id "10"^^xsd:integer;
                   foaf:firstName "Venus";
                   foaf:lastName "Williams".

Expected Default Mapping Result:

 


R2RML Mapping:

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

<#TriplesMap1>
    a rr:TriplesMap;

       rr:SQLquery """
       SELECT ID,
              FirstName,
              LastName,
              Gender,
       FROM Student
       WHERE Gender = 'Female'
       """;

    rr:subjectMap [ rr:template "http://example.com/{ID}{FirstName}{LastName}";
                    rr:class ex:Women ];
	
    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate ex:id ]; 
      rr:objectMap    [ rr:column "ID"; rr:datatype xsd:integer ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:firstName ]; 
      rr:objectMap    [ rr:column "FirstName" ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:lastName ]; 
      rr:objectMap    [ rr:column "LastName" ]
    ]
    .

More Complex Test Cases

R2RMLTC0008

Id: R2RMLTC0008

Title: M to N relation

Purpose: Tests, M to N relations

Specification Reference: 1.30

Review Status: unreviewed

Input:

Graphical Representation:

Student
ID (PK) FirstName LastName
10 Venus Williams
11 Fernando Alonso
12 David Villa
Student_Sport
ID_Student (FK - Student(ID)) ID_Sport (FK - Sport(ID))
10 110
11 111
11 112
12 111
Sport
ID (PK) Description
110 Tennis
111 Football
112 Formula1


SQL:

CREATE TABLE Student (
ID integer PRIMARY KEY,
FirstName varchar(50),
LastName varchar(50)
);
CREATE TABLE Sport (
ID integer PRIMARY KEY,
Description varchar(50)
);
CREATE TABLE Student_Sport (
ID_Student integer,
ID_Sport integer,
PRIMARY KEY (ID_Student,ID_Sport),
FOREIGN KEY (ID_Student) REFERENCES Student(ID),
FOREIGN KEY (ID_Sport) REFERENCES Sport(ID)
);

INSERT INTO Student (ID,FirstName,LastName) VALUES (10,"Venus", "Williams");
INSERT INTO Student (ID,FirstName,LastName) VALUES (11,"Fernando", "Alonso");
INSERT INTO Student (ID,FirstName,LastName) VALUES (12,"David", "Villa");

INSERT INTO Sport (ID, Description) VALUES (110,"Tennis");
INSERT INTO Sport (ID, Description) VALUES (111,"Football");
INSERT INTO Sport (ID, Description) VALUES (112,"Formula1");

INSERT INTO Student_Sport (ID_Student, ID_Sport) VALUES (10,110);
INSERT INTO Student_Sport (ID_Student, ID_Sport) VALUES (11,111);
INSERT INTO Student_Sport (ID_Student, ID_Sport) VALUES (11,112);
INSERT INTO Student_Sport (ID_Student, ID_Sport) VALUES (12,111);

Expected Result:

RDF:

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

ex:10VenusWilliams ex:id "10"^^xsd:integer;
                   foaf:firstName "Venus";
                   foaf:lastName "Williams";
                   ex:plays ex:110Tennis.

ex:11FernandoAlonso ex:id "11"^^xsd:integer;
                    foaf:firstName "Fernando";
                    foaf:lastName "Alonso";
                    ex:plays ex:111Football;
                    ex:plays ex:112Formula1. 

ex:12DavidVilla ex:id "12"^^xsd:integer;
                   foaf:firstName "David";
                   foaf:lastName "Villa";
                   ex:plays ex:111Football.

ex:110Tennis ex:id "110"^^xsd:integer;
             ex:description "Tennis".

ex:111Football ex:id "111"^^xsd:integer;
               ex:description "Football".

ex:112Formula1 ex:id "112"^^xsd:integer;
               ex:description "Formula1".

Expected Default Mapping Result:

 


R2RML Mapping:

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

<#TriplesMap1>
    a rr:TriplesMap;

       rr:SQLquery """
       SELECT Student.ID as ID,
              Student.FirstName as FirstName,
              Student.LastName as LastName,
              Sport.Description as Description,
              Sport.ID as Sport_ID
       FROM Student,Sport,Student_sport
       WHERE Student.ID = student_Sport.ID_Student
       AND Sport.ID = Student_Sport.ID_Sport;
       """;

    rr:subjectMap [ rr:template "http://example.com/{ID}{FirstName}{LastName}" ];
	
    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate ex:id ]; 
      rr:objectMap    [ rr:column "ID"; rr:datatype xsd:integer ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:firstName ]; 
      rr:objectMap    [ rr:column "FirstName" ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate foaf:lastName ]; 
      rr:objectMap    [ rr:column "LastName" ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate ex:plays ]; 
      rr:objectMap    [ rr:template "http://example.com/{Sport_ID}{Description}" ]
    ]
    .

<#TriplesMap2>
    a rr:TriplesMap;

    rr:tableOwner "boricles";
    rr:tableName "Sport";

    rr:subjectMap [ rr:template "http://example.com/{ID}{Description}" ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate ex:id ]; 
      rr:objectMap    [ rr:column "ID"; rr:datatype xsd:integer ]
    ];

    rr:predicateObjectMap
    [ 
      rr:predicateMap [ rr:predicate ex:description ]; 
      rr:objectMap    [ rr:column "Description" ]
    ]
    .

R2RMLTC0009

Id: R2RMLTC0009

Title: Path Enumeration

Purpose: Tests: Path Enumeration, a recursive structure for hierarchy representations, which stores for each element the path (as a string) from the root to the element

Note: Thanks to FAO

Specification Reference: 1.30

Review Status: unreviewed

Input:

Graphical Representation:

Area
ID (PK) Name
2000 Water area
2000.2100 Environmental area
2000.2420 Jurisdiction area
2000.2200 Fishing statistical area
2000.2100.2101 Inland/Marine
2000.2100.2102 Ocean
2000.2100.2103 North/South/Equatorial
2000.2200.2201 FAO statistical area
2000.2200.2202 Areal grid system

SQL:


CREATE TABLE Area (
ID varchar(50) PRIMARY KEY,
Name varchar(50)
);

INSERT INTO Area (ID, Name) VALUES ("2000","Water area");
INSERT INTO Area (ID, Name) VALUES ("2000.2100","Environmental area");
INSERT INTO Area (ID, Name) VALUES ("2000.2420","Jurisdiction area");
INSERT INTO Area (ID, Name) VALUES ("2000.2200","Fishing statistical area");
INSERT INTO Area (ID, Name) VALUES ("2000.2100.2101","Inland/Marine");
INSERT INTO Area (ID, Name) VALUES ("2000.2100.2102","Ocean");
INSERT INTO Area (ID, Name) VALUES ("2000.2100.2103","North/South/Equatorial");
INSERT INTO Area (ID, Name) VALUES ("2000.2200.2201","FAO statistical area");
INSERT INTO Area (ID, Name) VALUES ("2000.2200.2202","Areal grid system");

Expected Result:

RDF:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ex: <http://example.com/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2008/05/skos#> .

ex:2000Water_area rdf:type skos:Concept;
                  skos:prefLabel "Water area".

ex:2000_2100Environmental_area rdf:type skos:Concept;
                               skos:prefLabel "Environmental area";
                               skos:broader ex:2000Water_area.

ex:2000_2420Jurisdiction_area rdf:type skos:Concept;
                              skos:prefLabel "Jurisdiction area";
                              skos:broader ex:2000Water_area.

ex:2000_2200Fishing_statistical_area rdf:type skos:Concept;
                                     skos:prefLabel "Fishing statistical area";
                                     skos:broader ex:2000Water_area.

ex:2000_2100_2101Inland_Marine rdf:type skos:Concept;
                               skos:prefLabel "Inland/Marine";
                               skos:broader ex:2000_2100Environmental_area.

ex:2000_2100_2102Ocean rdf:type skos:Concept;
                       skos:prefLabel "Ocean";
                       skos:broader ex:2000_2100Environmental_area.

ex:2000_2100_2103North_South_Equatorial rdf:type skos:Concept;
                       skos:prefLabel "North South Equatorial";
                       skos:broader ex:2000_2100Environmental_area.

ex:2000_2200_2201FAO_statistical_area rdf:type skos:Concept;
                                      skos:prefLabel "FAO statistical area";
                                      skos:broader ex:2000_2200Fishing_statistical_area.

ex:2000_2200_2202Areal_grid_system rdf:type skos:Concept;
                                   skos:prefLabel "Areal grid system";
                                   skos:broader ex:2000_2200Fishing_statistical_area.

Expected Default Mapping Result:

 


R2RML Mapping (TO DO):

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

<#TriplesMap1>
    a rr:TriplesMap;


R2RMLTC0010

Id: R2RMLTC0010

Title: Adjacency List

Purpose: Tests Adjacency List, a recursive structure for hierarchy representations comprising a list of elements with a linking column to their parent element

Note: Thanks to FAO

Specification Reference: 1.30

Review Status: unreviewed

Input:

Graphical Representation:

Area
ID (PK) Name ParentID
2000 Water area NULL
2100 Environmental area 2000
2420 Jurisdiction area 2000
2200 Fishing statistical area 2000
2101 Inland/Marine 2100
2102 Ocean 2100
2103 North/South/Equatorial 2100
2201 FAO statistical area 2200
2202 Areal grid system 2200

SQL:


CREATE TABLE Area (
ID integer PRIMARY KEY,
Name varchar(50),
ParentID integer
);

INSERT INTO Area VALUES (2000,"Water area",NULL);
INSERT INTO Area VALUES (2100,"Environmental area",2000);
INSERT INTO Area VALUES (2420,"Jurisdiction area",2000);
INSERT INTO Area VALUES (2200,"Fishing statistical area",2000);
INSERT INTO Area VALUES (2101,"Inland/Marine",2100);
INSERT INTO Area VALUES (2102,"Ocean",2100);
INSERT INTO Area VALUES (2103,"North/South/Equatorial",2100);
INSERT INTO Area VALUES (2201,"FAO statistical area",2200);
INSERT INTO Area VALUES (2202,"Areal grid system",2200);

Expected Result:

RDF:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ex: <http://example.com/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2008/05/skos#> .

ex:2000Water_area rdf:type skos:Concept;
                  skos:prefLabel "Water area".

ex:2100Environmental_area rdf:type skos:Concept;
                          skos:prefLabel "Environmental area";
                          skos:broader ex:2000Water_area.

ex:2420Jurisdiction_area rdf:type skos:Concept;
                         skos:prefLabel "Jurisdiction area";
                         skos:broader ex:2000Water_area.

ex:2200Fishing_statistical_area rdf:type skos:Concept;
                                skos:prefLabel "Fishing statistical area";
                                skos:broader ex:2000Water_area.

ex:2101Inland_Marine rdf:type skos:Concept;
                     skos:prefLabel "Inland/Marine";
                     skos:broader ex:2100Environmental_area.

ex:2102Ocean rdf:type skos:Concept;
             skos:prefLabel "Ocean";
             skos:broader ex:2100Environmental_area.

ex:2103North_South_Equatorial rdf:type skos:Concept;
                              skos:prefLabel "North South Equatorial";
                              skos:broader ex:2100Environmental_area.

ex:2201FAO_statistical_area rdf:type skos:Concept;
                            skos:prefLabel "FAO statistical area";
                            skos:broader ex:2200Fishing_statistical_area.

ex:2202Areal_grid_system rdf:type skos:Concept;
                                   skos:prefLabel "Areal grid system";
                                   skos:broader ex:2200Fishing_statistical_area.

Expected Default Mapping Result:

 


R2RML Mapping (TO DO):

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

<#TriplesMap1>
    a rr:TriplesMap;



Direct Mapping Test Cases

DMTC0000

Id: DMTC0000

Title:


Purpose:


Specification Reference: 1.30

Review Status: unreviewed

Input:

Graphical Representation:

SQL:


Expected Result:

RDF:


Expected Default Mapping Result:

 


R2RML Mapping: