Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
This document defines the R2RML and Direct Mapping Test Cases deliverable for the RDB2RDF Working Group as defined in the Working Group's Charter.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This is an Editor's Draft for review by W3C members and other interested parties.
Comments on this document should be sent to public-rdb2rdf-comments@w3.org, a mailing list with a public archive.
Publication as a Editor's Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
The W3C RDB2RDF Working Group is the W3C working group responsible for this document.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
Last Modified: $Date: 2012/07/16 16:42:36 $
This document defines the R2RML and Direct mapping test cases, consisting of a collection of test case documents (input and expected output) and the test case manifest document (describing each test case).
The purpose of the Test Cases is to verify and validate the specification of the R2RML language and Direct mapping. 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.
The R2RML Test Case coverage matrix is available here . The DM Test Case coverage matrix is available here .
Test cases are organized by database. We use a descriptive naming convention for the databases. For each database we have:
The associated files (sql, ttl, and nq) are available at the W3C repository.
The following picture illustrates the organization.
This section presents the set of test cases we have created. It is worth mentioning that the schema-qualified name feature is not excercise in the test cases.
Each test case is described using the Test Metadata vocabulary in RDFa.
Throughout all test cases, we use the base IRI <http://example.com/base/>:
R2RML is a mapping language for SQL 2008. Databases that do not support the standard SQL 2008 datatypes cannot pass the tests. Section 10 of the R2RML specification already discusses how you are supposed to deal with vendor-specific types. Implemenetors who are interested in supporting R2RML over non-SQL-compatible databases like PostgreSQL essentially need to define a slightly modified flavour of R2MRL that can handle the vendor-specific aspects. To validate an implementation of such a modified R2RML flavour, implementors obviously need a slightly modified test suite. It is not the responsibility of the WG to produce such R2RML flavours or modified test suites. On the other hand, several WG members will be interested in producing some of those, and of course it would be good if they collaborate and share results, and the WG mailing lists are a good place to discuss such work.
Title: One table, a column, zero rows, no primary key
Graphical representation:
Name VARCHAR(50) |
---|
SQL:
CREATE TABLE "Student" ( "Name" varchar(50) );
File: D000-1table1column0rows
Title: Direct mapping of an empty table
Purpose: Tests if an empty table produces an empty RDF graph
Specification reference: #no-pk
Review status: unreviewed
Input: D000-1table1column0rows
Expected result: DirectGraphTC0000
RDF:
# empty graph
Title: one table, one column, zero rows
Purpose: Tests if an empty table produces an empty RDF graph
Specification reference: #physical-tables
Review status: unreviewed
Input: D000-1table1column0rows
Expected result: mapped.nq
RDF:
Subject | Predicate | Object | Graph |
---|
R2RML mapping: R2RMLTC0000
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\""; ] ; rr:subjectMap [ rr:template "http://example.com/{\"Name\"}" ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: One table, one column, one row, no primary key
Graphical representation:
Name VARCHAR(50) |
---|
Venus |
SQL:
CREATE TABLE "Student" ( "Name" varchar(50) ); INSERT INTO "Student" ("Name") VALUES ('Venus');
File: D001-1table1column1row
Title: Direct mapping that generates a BlankNode
Purpose: Tests: (1) one column mapping, no primary key; (2) generation of a "BlankNode" subject; (3) one column to one property
Specification reference: #no-pk
Review status: unreviewed
Input: D001-1table1column1row
Expected result: DirectGraphTC0001
RDF:
@base <http://example.com/base/> . _:a <Student#Name> "Venus". _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> .
Title: One column mapping, subject URI generation by using rr:template
Purpose: Tests: (1) one column mapping; (2) subject URI generation by using rr:tmplate; (3) one column to one property
Specification reference: #dfn-template-valued-term-map
Review status: unreviewed
Input: D001-1table1column1row
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Venus> | <http://xmlns.com/foaf/0.1/name> | "Venus" | |
R2RML mapping: R2RMLTC0001a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/{\"Name\"}" ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: One column mapping, generation of a BlankNode subject by using rr:termType
Purpose: Tests: (1) one column mapping; (2) generation of a BlankNode subject by using rr:termType; (3) one column to one property
Specification reference: #termtype
Review status: unreviewed
Input: D001-1table1column1row
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
_:Venus | <http://xmlns.com/foaf/0.1/name> | "Venus" | |
R2RML mapping: R2RMLTC0001b
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "{\"Name\"}"; rr:termType rr:BlankNode ]; rr:predicateObjectMap [ rr:predicate foaf:name; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: One table, two columns, one row, no primary key
Graphical representation:
ID INTEGER |
Name VARCHAR(15) |
---|---|
10 | Venus |
SQL:
CREATE TABLE "Student" ( "ID" INTEGER, "Name" VARCHAR(15) ); INSERT INTO "Student" ("ID", "Name") VALUES(10,'Venus');
File: D002-1table2columns1row
Title: Two columns mapping, generation of a BlankNode subject
Purpose: Tests: (1) two columns mapping; (2) generation of a BlankNode subject; (3) one column to one property
Specification reference: #no-pk
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: DirectGraphTC0002
RDF:
@base <http://example.com/base/> . _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> . _:a <Student#ID> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . _:a <Student#Name> "Venus" .
Title: Two columns mapping, generation of a subject URI by the concatenation of two column values
Purpose: 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
Specification reference: #from-template
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> | |
R2RML mapping: R2RMLTC0002a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/{\"ID\"}/{\"Name\"}"; rr:class foaf:Person ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: Two columns mapping, generation of a BlankNode subject by using rr:template and rr:termType
Purpose: Tests: (1) two column mapping, no primary key; (2) generation of a BlankNode subject by using rr:template; (3) one column to one property
Specification reference: #termtype
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
_:students10 | <http://xmlns.com/foaf/0.1/name> | "Venus" | |
R2RML mapping: R2RMLTC0002b
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\""; ]; rr:subjectMap [ rr:template "students{\"ID\"}"; rr:termType rr:BlankNode; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: Two columns mapping, an undefined SQL identifier
Purpose: Tests the presence of an undefined SQL identifier
Specification reference: #dfn-sql-identifier
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0002c
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/{\"ID\"}/{\"Name\"}"; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"IDs\""; ] ] .
Title: Two columns mapping, generation of a BlankNode subject by using a SQL Query that concatenates two columns
Purpose: Tests (1) two column mapping, no primary key; (2) generation of a BlankNode subject by using a SQL Query that concatenates two columns; (3) one column to one property
Specification reference: #dfn-sql-query
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: mappedd.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
_:Student10 | <http://xmlns.com/foaf/0.1/name> | "Venus" | |
R2RML mapping: R2RMLTC0002d
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ Select ('Student' || "ID" ) AS StudentId , "ID" , "Name" from "Student" """ ]; rr:subjectMap [ rr:column "StudentId"; rr:termType rr:BlankNode; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: Two columns mapping, an undefined rr:tableName
Purpose: Tests the presence of an undefined rr:tableName
Specification reference: #dfn-sql-identifier
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0002e
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Students\"" ]; rr:subjectMap [ rr:template "http://example.com/{\"ID\"}/{\"Name\"}"; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; .
Title: Two columns mapping, delimited identifiers referenced as regular identifiers
Purpose: Tests the presence of delimited identifiers referenced as regular identifiers. Within rr:template ID is ok, but Name is not
Specification reference: #from-template
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0002f
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/{ID}/{Name}"; rr:class foaf:Person ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: Two columns mapping, invalid SQL query
Purpose: Tests the presence of an invalid SQL query
Specification reference: #dfn-sql-identifier
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0002g
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ THIS IS NOT A VALID SQL QUERY """ ]; rr:subjectMap [ rr:column "StudentId"; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; .
Title: Two columns mapping, duplicate column name in SELECT
Purpose: Tests the presence of duplicate column names in the SELECT list of the SQL query
Specification reference: #dfn-sql-identifier
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0002h
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ Select ('Student' || ID ) AS StudentId , "ID" , "Name" , 1 AS "ID" from "Student" """ ]; rr:subjectMap [ rr:column "StudentId"; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; .
Title: Two columns mapping, SQL Version identifier
Purpose: Tests the presence of a SQL Version identifier
Specification reference: #dfn-sql-version-identifier
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: mappedi.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/10/Venus> | <http://xmlns.com/foaf/0.1/name> | "Venus" | |
R2RML mapping: R2RMLTC0002i
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "ID", "Name" FROM "Student" """; rr:sqlVersion rr:SQL2008 ]; rr:subjectMap [ rr:template "http://example.com/{\"ID\"}/{\"Name\"}"; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: Two columns mapping, qualified column names
Purpose: Tests the presence of qualified column names in the SELECT list of the SQL query
Specification reference: #dfn-schema-qualified-name
Review status: unreviewed
Input: D002-1table2columns1row
Expected result: mappedj.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/10/Venus> | <http://xmlns.com/foaf/0.1/name> | "Venus" | |
R2RML mapping: R2RMLTC0002j
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "Student"."ID", "Student"."Name" FROM "Student" """ ]; rr:subjectMap [ rr:template "http://example.com/{\"ID\"}/{\"Name\"}"; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: One table, three columns, one row, no primary key
Graphical representation:
ID INTEGER |
FirstName VARCHAR(50) |
LastName VARCHAR(50) |
---|---|---|
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');
File: D003-1table3columns1row
Title: Three columns mapping, generation of a BlankNode
Purpose: Tests: (1) three columns mapping; (2) generation of a "BlankNode" subject; (3) one column to one property
Specification reference: #no-pk
Review status: unreviewed
Input: D003-1table3columns1row
Expected result: DirectGraphTC0003
RDF:
@base <http://example.com/base/> . _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> . _:a <Student#ID> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . _:a <Student#FirstName> "Venus" . _:a <Student#LastName> "Williams" .
Title: Three columns mapping, undefined SQL Version identifier
Purpose: Tests the presence of an undefined SQL Version identifier
Specification reference: #dfn-sql-version-identifier
Review status: unreviewed
Input: D003-1table3columns1row
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0003a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "ID", "FirstName", "LastName" FROM "Student" """; rr:sqlVersion rr:SQL1979 ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"FirstName\"}-{\"LastName\"}"; rr:class foaf:Person ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; .
Title: Three columns mapping, concatenation of columns, by using a rr:sqlQuery to produce literal
Purpose: Tests: (1) three column mapping; and (2) concatenation of columns to produce literal, by using a rr:sqlQuery
Specification reference: #dfn-sql-query
Review status: unreviewed
Input: D003-1table3columns1row
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Student/10> | <http://xmlns.com/foaf/0.1/name> | "Venus Williams" | |
R2RML mapping: R2RMLTC0003b
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "ID", ("FirstName" || ' ' || "LastName") AS Name FROM "Student" """ ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "Name" ] ] .
Title: Three columns mapping, by using a rr:template to produce literal
Purpose: Tests: (1) three column mapping; and (2) the use of rr:template to produce literal
Specification reference: #from-template
Review status: unreviewed
Input: D003-1table3columns1row
Expected result: mappedc.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Student10> | <http://xmlns.com/foaf/0.1/name> | "Venus Williams" | |
R2RML mapping: R2RMLTC0003c
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/Student{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:template "{\"FirstName\"} {\"LastName\"}"; rr:termType rr:Literal; ] ] .
Title: One table, two columns, one row, projection, no primary key
Graphical representation:
Student VARCHAR(50) |
Sport VARCHAR(50) |
---|---|
Venus | Tennis |
SQL:
CREATE TABLE "Student_Sport"( "Student" varchar(50), "Sport" varchar(50) ); INSERT INTO "Student_Sport" ("Student","Sport") VALUES ('Venus', 'Tennis');
File: D004-1table2columns1row
Title: Two column mapping, generation of a BlankNode subject
Purpose: Tests: (1) two column mapping (2) generation of a "BlankNode" subject
Specification reference: #no-pk
Review status: unreviewed
Input: D004-1table2columns1row
Expected result: DirectGraphTC0004
RDF:
@base <http://example.com/base/> . _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student_Sport> . _:a <Student_Sport#Student> "Venus" . _:a <Student_Sport#Sport> "Tennis" .
Title: Two column mapping, from one row table to two different triples
Purpose: 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 rr:class
Specification reference: #typing
Review status: unreviewed
Input: D004-1table2columns1row
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> | |
R2RML mapping: R2RMLTC0004a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student_Sport\"" ]; rr:subjectMap [ rr:template "http://example.com/{\"Student\"}"; rr:class ex:Student ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Student\"" ] ] . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student_Sport\"" ]; rr:subjectMap [ rr:template "http://example.com/{\"Sport\"}"; rr:class ex:Sport ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Sport\"" ] ] .
Title: Two column mapping, presence of rr:termType rr:Literal on rr:subjectMap
Purpose: Tests: (1) two column mapping (2) the presence of rr:termType rr:Literal on rr:subjectMap, which is invalid
Specification reference: #termtype
Review status: unreviewed
Input: D004-1table2columns1row
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0004b
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT ('Student' || "Student") AS StudentId, "Student" FROM "Student_Sport" """; ] ; rr:subjectMap [ rr:column "StudentId"; rr:termType rr:Literal; rr:class ex:Student ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Student\"" ] ] .
Title: One table, three columns, three rows, two duplicate tuples, no primary key
Graphical representation:
fname VARCHAR(20) |
lname VARCHAR(20) |
amount DOUBLE |
---|---|---|
Bob | Smith | 30.0E0 |
Sue | Jones | 20.0E0 |
Bob | Smith | 30.0E0 |
SQL:
CREATE TABLE "IOUs" ( "fname" VARCHAR(20), "lname" VARCHAR(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);
Title: Generation of BlankNodes from duplicate tuples
Purpose: Tests the generation of Blank Nodes for duplicate tuples
Specification reference: #no-pk
Review status: unreviewed
Input: D005-1table3columns3rows2duplicates
Expected result: DirectGraphTC0005
RDF:
@base <http://example.com/base/> . _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <IOUs> . _:a <IOUs#fname> "Bob" . _:a <IOUs#lname> "Smith" . _:a <IOUs#amount> "3.0E1"^^<http://www.w3.org/2001/XMLSchema#double> . _:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <IOUs> . _:b <IOUs#fname> "Sue" . _:b <IOUs#lname> "Jones" . _:b <IOUs#amount> "2.0E1"^^<http://www.w3.org/2001/XMLSchema#double> . _:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <IOUs> . _:c <IOUs#fname> "Bob" . _:c <IOUs#lname> "Smith" . _:c <IOUs#amount> "3.0E1"^^<http://www.w3.org/2001/XMLSchema#double> .
Title: Typing of resources
Purpose: Tests the typing of resources
Specification reference: #typing
Review status: unreviewed
Input: D005-1table3columns3rows2duplicates
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> | "3.0E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
<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> | "2.0E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
R2RML mapping: R2RMLTC0005a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"IOUs\"" ]; rr:subjectMap [ rr:template "http://example.com/{\"fname\"};{\"lname\"}"; rr:class foaf:Person ]; rr:predicateObjectMap [ rr:predicate ex:owes ; rr:objectMap [ rr:column "\"amount\""; ] ]; .
Title: Default mapping
Purpose: Tests the generation of a default mapping for tables without a primary key
Specification reference: #default-mappings
Review status: unreviewed
Input: D005-1table3columns3rows2duplicates
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
_:BobSmith | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://example.com/base/IOUs> | |
_:BobSmith | <http://example.com/base/IOUs#fname> | "Bob" | |
_:BobSmith | <http://example.com/base/IOUs#lname> | "Smith" | |
_:BobSmith | <http://example.com/base/IOUs#amount> | "3.0E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
_:SueJones | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://example.com/base/IOUs> | |
_:SueJones | <http://example.com/base/IOUs#fname> | "Sue" | |
_:SueJones | <http://example.com/base/IOUs#lname> | "Jones" | |
_:SueJones | <http://example.com/base/IOUs#amount> | "2.0E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
R2RML mapping: R2RMLTC0005b
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"IOUs\"" ]; rr:subjectMap [ rr:template "{\"fname\"}_{\"lname\"}"; rr:class <IOUs>; rr:termType rr:BlankNode; ]; rr:predicateObjectMap [ rr:predicate <IOUs#fname> ; rr:objectMap [ rr:column "\"fname\""; ] ]; rr:predicateObjectMap [ rr:predicate <IOUs#lname> ; rr:objectMap [ rr:column "\"lname\""; ] ]; rr:predicateObjectMap [ rr:predicate <IOUs#amount> ; rr:objectMap [ rr:column "\"amount\""; ] ]; .
Title: One table, one primary key, one column, one row
Graphical representation:
Name (PK) VARCHAR(50) |
---|
Venus |
SQL:
CREATE TABLE "Student" ( "Name" varchar(50) PRIMARY KEY ); INSERT INTO "Student" ("Name") VALUES ('Venus');
Title: Generation of subjects
Purpose: Tests the generation of subjects
Specification reference: #lead-ex
Review status: unreviewed
Input: D006-1table1primarykey1column1row
Expected result: DirectGraphTC0006
RDF:
@base <http://example.com/base/> . <Student/Name=Venus> <Student#Name> "Venus" . <Student/Name=Venus> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> .
Title: Long form of R2RML by using rr:constant in rr:subjectMap, rr:predicateMap, rr:objectMap and rr:graphMap
Purpose: Tests the use of rr:constant in rr:subjectMap, rr:predicateMap, rr:objectMap and rr:graphMap
Specification reference: #constant
Review status: unreviewed
Input: D006-1table1primarykey1column1row
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/BadStudent> | <http://example.com/description> | "Bad Student" | <http://example.com/graph/student> |
R2RML mapping: R2RMLTC0006a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:constant ex:BadStudent; rr:graphMap [ rr:constant <http://example.com/graph/student> ]; ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant ex:description ]; rr:objectMap [ rr:constant "Bad Student"; ] ] .
Title: One table, one primary key, two columns, one row
Graphical representation:
ID (PK) INTEGER |
Name VARCHAR(50) |
---|---|
10 | Venus |
SQL:
CREATE TABLE "Student" ( "ID" integer, "Name" varchar(50), PRIMARY KEY ("ID") ); INSERT INTO "Student" ("ID", "Name") VALUES(10,'Venus');
Title: Generation of a subject
Purpose: Tests the generation of a subject
Specification reference: #lead-ex
Review status: unreviewed
Input: D007-1table1primarykey2columns1row
Expected result: DirectGraphTC0007
RDF:
@base <http://example.com/base/> . <Student/ID=10> <Student#ID> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student/ID=10> <Student#Name> "Venus" . <Student/ID=10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> .
Title: Typing resources by relying on rdf:type predicate
Purpose: Tests the typing resources by relying on rdf:type predicate
Specification reference: #typing
Review status: unreviewed
Input: D007-1table1primarykey2columns1row
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Student/10/Venus> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
R2RML mapping: R2RMLTC0007a
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; ]; rr:predicateObjectMap [ rr:predicate rdf:type ; rr:object foaf:Person; ]; .
Title: Assigning triples to Named Graphs
Purpose: Tests the generation of triples to a named graph
Specification reference: #named-graphs
Review status: unreviewed
Input: D007-1table1primarykey2columns1row
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> |
R2RML mapping: R2RMLTC0007b
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\""; ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; rr:graph ex:PersonGraph; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; rr:predicateObjectMap [ rr:predicate foaf:name; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: One column mapping, using rr:class
Purpose: Tests subjectmap with more than one class IRIs, rr:class
Specification reference: #typing
Review status: unreviewed
Input: D007-1table1primarykey2columns1row
Expected result: mappedc.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> | |
R2RML mapping: R2RMLTC0007c
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; rr:class foaf:Person,ex:Student; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: One column mapping, specifying an rr:predicateObjectMap with rdf:type
Purpose: Tests subjectmap with an alternative of having rr:class, i.e., by specifying an rr:predicateObjectMap with predicate rdf:type
Specification reference: #typing
Review status: unreviewed
Input: D007-1table1primarykey2columns1row
Expected result: mappedd.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> | |
R2RML mapping: R2RMLTC0007d
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object ex:Student; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: One column mapping, using rr:graphMap and rr:class
Purpose: Tests subjectmap with rr:graphMap and rr:class
Specification reference: #named-graphs
Review status: unreviewed
Input: D007-1table1primarykey2columns1row
Expected result: mappede.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> |
R2RML mapping: R2RMLTC0007e
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; rr:graph ex:PersonGraph ; rr:class foaf:Person ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: One column mapping, using rr:graphMap and specifying an rr:predicateObjectMap with rdf:type
Purpose: Tests subjectmap with rr:graphMap and specifying an rr:predicateObjectMap with predicate rdf:type
Specification reference: #named-graphs
Review status: unreviewed
Input: D007-1table1primarykey2columns1row
Expected result: mappedf.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> |
R2RML mapping: R2RMLTC0007f
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; rr:graph ex:PersonGraph ; ]; rr:predicateObjectMap [ rr:predicate rdf:type ; rr:object foaf:Person ; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: Assigning triples to the default graph
Purpose: Tests the generation of triples to the default graph
Specification reference: #named-graphs
Review status: unreviewed
Input: D007-1table1primarykey2columns1row
Expected result: mappedg.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Student/10/Venus> | <http://xmlns.com/foaf/0.1/name> | "Venus" | |
<http://example.com/Student/10/Venus> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
R2RML mapping: R2RMLTC0007g
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\""; ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; rr:graph rr:defaultGraph; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; rr:predicateObjectMap [ rr:predicate foaf:name; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: Assigning triples to a non-IRI named graph
Purpose: Tests the generation of triples to a non-IRI named graph, which is an error
Specification reference: #named-graphs
Review status: unreviewed
Input: D007-1table1primarykey2columns1row
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0007h
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\""; ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; rr:graphMap [ rr:column "\"Name\""; rr:termType rr:Literal; ] ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; rr:predicateObjectMap [ rr:predicate foaf:name; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: One table, a composite primary key, three columns, one row
Graphical representation:
ID (PK) INTEGER |
Name (PK) VARCHAR(50) |
Sport VARCHAR(50) |
---|---|---|
10 | Venus Williams | Tennis |
SQL:
CREATE TABLE "Student" ( "ID" integer, "Name" varchar(50), "Sport" varchar (50), PRIMARY KEY ("ID","Name") ); INSERT INTO "Student" ("ID", "Name","Sport") VALUES(10,'Venus Williams','Tennis');
Title: Generation of direct graph from a table with composite primary key
Purpose: Tests the generation of a direct graph from a table with a composite primary key
Specification reference: #lead-ex
Review status: unreviewed
Input: D008-1table1compositeprimarykey3columns1row
Expected result: DirectGraphTC0008
RDF:
@base <http://example.com/base/> . <Student/ID=10;Name=Venus%20Williams> <Student#ID> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student/ID=10;Name=Venus%20Williams> <Student#Name> "Venus Williams" . <Student/ID=10;Name=Venus%20Williams> <Student#Sport> "Tennis" . <Student/ID=10;Name=Venus%20Williams> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> .
Title: Generation of triples to a target graph by using rr:graphMap and rr:template
Purpose: Test that results of the mapping can be directed to a target graph by using rr:graphMap and rr:template
Specification reference: #named-graphs
Review status: unreviewed
Input: D008-1table1compositeprimarykey3columns1row
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> |
R2RML mapping: R2RMLTC0008a
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; rr:graphMap [ rr:template "http://example.com/graph/Student/{\"ID\"}/{\"Name\"}"; ] ]; rr:predicateObjectMap [ rr:predicate rdf:type ; rr:object foaf:Person; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ]; rr:predicateObjectMap [ rr:predicate ex:Sport ; rr:objectMap [ rr:column "\"Sport\"" ] ] .
Title: Generation of triples referencing object map
Purpose: Tests the mapping specification referencing object map without join
Specification reference: #dfn-referencing-object-map
Review status: unreviewed
Input: D008-1table1compositeprimarykey3columns1row
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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://activity.com/Sport> | |
R2RML mapping: R2RMLTC0008b
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ex: <http://example.com/> . @prefix activity: <http://activity.com/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/{\"Sport\"}"; ]; rr:predicateObjectMap [ rr:predicate rdf:type ; rr:object activity:Sport ; ]; . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; ]; rr:predicateObjectMap [ rr:predicate rdf:type ; rr:object foaf:Person ; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ]; rr:predicateObjectMap [ rr:predicate ex:Sport ; rr:objectMap <RefObjectMap1> ] . <RefObjectMap1> a rr:RefObjectMap; rr:parentTriplesMap <TriplesMap2> ; .
Title: Generation of triples by using multiple predicateMaps within a rr:predicateObjectMap
Purpose: Tests the generation of triples by using multiple predicateMaps within a rr:predicateObjectMap
Specification reference: #physical-tables
Review status: unreviewed
Input: D008-1table1compositeprimarykey3columns1row
Expected result: mappedc.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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" | |
R2RML mapping: R2RMLTC0008c
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:predicate ex:name ; rr:objectMap [ rr:column "\"Name\"" ] ]; .
Title: Two tables, a primary key, a foreign key
Graphical representation:
ID (PK) INTEGER |
Sport (FK) INTEGER |
Name VARCHAR(50) |
---|---|---|
10 | 100 | Venus Williams |
20 | NULL | Demi Moore |
ID (PK) INTEGER |
Name VARCHAR(50) |
---|---|
100 | Tennis |
SQL:
CREATE TABLE "Sport" ( "ID" integer, "Name" varchar (50), PRIMARY KEY ("ID") ); CREATE TABLE "Student" ( "ID" integer, "Name" varchar(50), "Sport" integer, PRIMARY KEY ("ID"), FOREIGN KEY("Sport") REFERENCES "Sport"("ID") ); INSERT INTO "Sport" ("ID", "Name") VALUES (100,'Tennis'); INSERT INTO "Student" ("ID", "Name", "Sport") VALUES (10,'Venus Williams', 100); INSERT INTO "Student" ("ID", "Name", "Sport") VALUES (20,'Demi Moore', NULL);
Title: Two tables 1 primary key 1 foreign key
Purpose: Tests two tables with a primary key and a foreign key
Specification reference: #fk-candidate
Review status: unreviewed
Input: D009-2tables1primarykey1foreignkey
Expected result: DirectGraphTC0009
RDF:
@base <http://example.com/base/> . <Student/ID=10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> . <Student/ID=10> <Student#ID> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student/ID=10> <Student#Name> "Venus Williams" . <Student/ID=10> <Student#Sport> "100"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student/ID=10> <Student#ref-Sport> <Sport/ID=100> . <Student/ID=20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> . <Student/ID=20> <Student#ID> "20"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student/ID=20> <Student#Name> "Demi Moore" . <Sport/ID=100> <Sport#ID> "100"^^<http://www.w3.org/2001/XMLSchema#integer> . <Sport/ID=100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Sport> . <Sport/ID=100> <Sport#Name> "Tennis" .
Title: Generation of triples from foreign key relations
Purpose: Test foreign key relationships among logical tables
Specification reference: #foreign-key
Review status: unreviewed
Input: D009-2tables1primarykey1foreignkey
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> | |
R2RML mapping: R2RMLTC0009a
RDF:
@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#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/resource/student_{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\""; ]; ]; rr:predicateObjectMap [ rr:predicate <http://example.com/ontology/practises> ; rr:objectMap [ a rr:RefObjectMap ; rr:parentTriplesMap <TriplesMap2>; rr:joinCondition [ rr:child "\"Sport\"" ; rr:parent "\"ID\"" ; ] ]; ]; . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Sport\"" ]; rr:subjectMap [ rr:template "http://example.com/resource/sport_{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate rdfs:label ; rr:objectMap [ rr:column "\"Name\""; ]; ]; .
Title: Generation of triples to multiple graphs
Purpose: Test that results from distinct parts of the mapping can be directed to different target graphs.
Specification reference: #named-graphs
Review status: unreviewed
Input: D009-2tables1primarykey1foreignkey
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> |
R2RML mapping: R2RMLTC0009b
RDF:
@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#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/resource/student_{\"ID\"}"; rr:class <http://example.com/ontology/Student>; rr:graph <http://example.com/graph/students> ; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\""; ]; rr:graph <http://example.com/graph/students> ; ]; rr:predicateObjectMap [ rr:predicate <http://example.com/ontology/practises> ; rr:objectMap [ a rr:RefObjectMap ; rr:parentTriplesMap <TriplesMap2>; rr:joinCondition [ rr:child "\"Sport\"" ; rr:parent "\"ID\"" ; ] ]; rr:graph <http://example.com/graph/practise> ; ]; . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Sport\"" ]; rr:subjectMap [ rr:template "http://example.com/resource/sport_{\"ID\"}"; rr:class <http://example.com/ontology/Sport>; rr:graph <http://example.com/graph/sports> ; ]; rr:predicateObjectMap [ rr:predicate rdfs:label ; rr:objectMap [ rr:column "\"Name\""; ]; ]; .
Title: Unnamed column in a logical table
Purpose: Test a logical table with unnamed column.
Specification reference: #dfn-sql-query
Review status: unreviewed
Input: D009-2tables1primarykey1foreignkey
Expected result: mappedc.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/resource/student_Venus%20Williams> | <http://xmlns.com/foaf/0.1/name> | "Venus Williams" | |
<http://example.com/resource/student_Demi%20Moore> | <http://xmlns.com/foaf/0.1/name> | "Demi Moore" | |
R2RML mapping: R2RMLTC0009c
RDF:
@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#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "Name", COUNT("Sport") FROM "Student" GROUP BY "Name" """ ]; rr:subjectMap [ rr:template "http://example.com/resource/student_{\"Name\"}"; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\""; ]; ]; .
Title: Named column in logical table
Purpose: Test a logical table named column.
Specification reference: #dfn-sql-query
Review status: unreviewed
Input: D009-2tables1primarykey1foreignkey
Expected result: mappedd.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/resource/student_Venus%20Williams> | <http://xmlns.com/foaf/0.1/name> | "Venus Williams" | |
<http://example.com/resource/student_Venus%20Williams> | <http://example.com/numSport> | "1"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/resource/student_Demi%20Moore> | <http://xmlns.com/foaf/0.1/name> | "Demi Moore" | |
<http://example.com/resource/student_Demi%20Moore> | <http://example.com/numSport> | "0"^^<http://www.w3.org/2001/XMLSchema#integer> | |
R2RML mapping: R2RMLTC0009d
RDF:
@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#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "Name", COUNT("Sport") as SPORTCOUNT FROM "Student" GROUP BY "Name" """ ]; rr:subjectMap [ rr:template "http://example.com/resource/student_{\"Name\"}"; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\""; ]; ]; rr:predicateObjectMap [ rr:predicate ex:numSport ; rr:objectMap [ rr:column "SPORTCOUNT"; ]; ]; .
Title: One table, a primary key, three columns, three rows
Graphical representation:
Country Code (PK) INTEGER |
Name VARCHAR(100) |
ISO 3166 VARCHAR(10) |
---|---|---|
1 | Bolivia, Plurinational State of | BO |
2 | Ireland | IE |
3 | Saint Martin (French part) | MF |
SQL:
CREATE TABLE "Country Info" ( "Country Code" INTEGER PRIMARY KEY, "Name" VARCHAR(100), "ISO 3166" VARCHAR(10) ); INSERT INTO "Country Info" ("Country Code", "Name", "ISO 3166") VALUES (1, 'Bolivia, Plurinational State of', 'BO'); INSERT INTO "Country Info" ("Country Code", "Name", "ISO 3166") VALUES (2, 'Ireland', 'IE'); INSERT INTO "Country Info" ("Country Code", "Name", "ISO 3166") VALUES (3, 'Saint Martin (French part)', 'MF');
Title: Generation of direct graph for table names with spaces
Purpose: Tests the generation of the direct graph for table names with spaces
Specification reference: #lead-ex
Review status: unreviewed
Input: D010-1table1primarykey3colums3rows
Expected result: DirectGraphTC0010
RDF:
@base <http://example.com/base/> . <Country%20Info/Country%20Code=1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Country%20Info> . <Country%20Info/Country%20Code=1> <Country%20Info#Country%20Code> "1"^^<http://www.w3.org/2001/XMLSchema#integer> . <Country%20Info/Country%20Code=1> <Country%20Info#Name> "Bolivia, Plurinational State of" . <Country%20Info/Country%20Code=1> <Country%20Info#ISO%203166> "BO" . <Country%20Info/Country%20Code=2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Country%20Info> . <Country%20Info/Country%20Code=2> <Country%20Info#Country%20Code> "2"^^<http://www.w3.org/2001/XMLSchema#integer> . <Country%20Info/Country%20Code=2> <Country%20Info#Name> "Ireland" . <Country%20Info/Country%20Code=2> <Country%20Info#ISO%203166> "IE" . <Country%20Info/Country%20Code=3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Country%20Info> . <Country%20Info/Country%20Code=3> <Country%20Info#Country%20Code> "3"^^<http://www.w3.org/2001/XMLSchema#integer> . <Country%20Info/Country%20Code=3> <Country%20Info#Name> "Saint Martin (French part)" . <Country%20Info/Country%20Code=3> <Country%20Info#ISO%203166> "MF" .
Title: Template with table column with special chars
Purpose: Tests a template with blank space in column value
Specification reference: #dfn-template-valued-term-map
Review status: unreviewed
Input: D010-1table1primarykey3colums3rows
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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)" | |
R2RML mapping: R2RMLTC0010a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Country Info\""; ] ; rr:subjectMap [ rr:template "http://example.com/{\"Country Code\"}" ]; rr:predicateObjectMap [ rr:predicate ex:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: Template with table columns with special chars
Purpose: Tests a template with special chars in column value
Specification reference: #dfn-template-valued-term-map
Review status: unreviewed
Input: D010-1table1primarykey3colums3rows
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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(French%20part)> | <http://example.com/name> | "Saint Martin (French part)" | |
R2RML mapping: R2RMLTC0010b
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Country Info\""; ] ; rr:subjectMap [ rr:template "http://example.com/{\"Country Code\"}/{\"Name\"}" ]; rr:predicateObjectMap [ rr:predicate ex:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: Template with table columns with special chars and backslashes
Purpose: Tests a template with special chars in column value and backslash escapes in string templates
Specification reference: #dfn-template-valued-term-map
Review status: unreviewed
Input: D010-1table1primarykey3colums3rows
Expected result: mappedc.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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(French%20part)> | <http://example.com/code> | "{{{ MF }}}" | |
R2RML mapping: R2RMLTC0010c
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Country Info\""; ] ; rr:subjectMap [ rr:template "http://example.com/{\"Country Code\"}/{\"Name\"}" ]; rr:predicateObjectMap [ rr:predicate ex:code ; rr:objectMap [ rr:template "\\{\\{\\{ {\"ISO 3166\"} \\}\\}\\}"; rr:termType rr:Literal; ] ] .
Title: Database with many to many relations
Graphical representation:
ID (PK) INTEGER |
FirstName VARCHAR(50) |
LastName VARCHAR(50) |
---|---|---|
10 | Venus | Williams |
11 | Fernando | Alonso |
12 | David | Villa |
ID_Student (PFK) INTEGER |
ID_Sport (PFK) INTEGER |
---|---|
10 | 110 |
11 | 111 |
11 | 112 |
12 | 111 |
ID (PK) INTEGER |
Description VARCHAR(50) |
---|---|
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);
File: D011-M2MRelations
Title: Many to Many relations
Purpose: Tests the generation of triples from tables M to M relations
Specification reference: #lead-ex
Review status: unreviewed
Input: D011-M2MRelations
Expected result: DirectGraphTC0011
RDF:
@base <http://example.com/base/> . <Student/ID=10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> . <Student/ID=10> <Student#FirstName> "Venus". <Student/ID=10> <Student#ID> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student/ID=10> <Student#LastName> "Williams" . <Student/ID=11> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> . <Student/ID=11> <Student#FirstName> "Fernando". <Student/ID=11> <Student#ID> "11"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student/ID=11> <Student#LastName> "Alonso" . <Student/ID=12> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> . <Student/ID=12> <Student#FirstName> "David". <Student/ID=12> <Student#ID> "12"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student/ID=12> <Student#LastName> "Villa" . <Student_Sport/ID_Student=10;ID_Sport=110> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student_Sport> . <Student_Sport/ID_Student=10;ID_Sport=110> <Student_Sport#ID_Student> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student_Sport/ID_Student=10;ID_Sport=110> <Student_Sport#ref-ID_Student> <Student/ID=10> . <Student_Sport/ID_Student=10;ID_Sport=110> <Student_Sport#ID_Sport> "110"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student_Sport/ID_Student=10;ID_Sport=110> <Student_Sport#ref-ID_Sport> <Sport/ID=110> . <Student_Sport/ID_Student=11;ID_Sport=111> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student_Sport> . <Student_Sport/ID_Student=11;ID_Sport=111> <Student_Sport#ID_Student> "11"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student_Sport/ID_Student=11;ID_Sport=111> <Student_Sport#ref-ID_Student> <Student/ID=11> . <Student_Sport/ID_Student=11;ID_Sport=111> <Student_Sport#ID_Sport> "111"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student_Sport/ID_Student=11;ID_Sport=111> <Student_Sport#ref-ID_Sport> <Sport/ID=111> . <Student_Sport/ID_Student=11;ID_Sport=112> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student_Sport> . <Student_Sport/ID_Student=11;ID_Sport=112> <Student_Sport#ID_Student> "11"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student_Sport/ID_Student=11;ID_Sport=112> <Student_Sport#ref-ID_Student> <Student/ID=11> . <Student_Sport/ID_Student=11;ID_Sport=112> <Student_Sport#ID_Sport> "112"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student_Sport/ID_Student=11;ID_Sport=112> <Student_Sport#ref-ID_Sport> <Sport/ID=112> . <Student_Sport/ID_Student=12;ID_Sport=111> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student_Sport> . <Student_Sport/ID_Student=12;ID_Sport=111> <Student_Sport#ID_Student> "12"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student_Sport/ID_Student=12;ID_Sport=111> <Student_Sport#ref-ID_Student> <Student/ID=12> . <Student_Sport/ID_Student=12;ID_Sport=111> <Student_Sport#ID_Sport> "111"^^<http://www.w3.org/2001/XMLSchema#integer> . <Student_Sport/ID_Student=12;ID_Sport=111> <Student_Sport#ref-ID_Sport> <Sport/ID=111> . <Sport/ID=110> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Sport> . <Sport/ID=110> <Sport#ID> "110"^^<http://www.w3.org/2001/XMLSchema#integer> . <Sport/ID=110> <Sport#Description> "Tennis" . <Sport/ID=111> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Sport> . <Sport/ID=111> <Sport#ID> "111"^^<http://www.w3.org/2001/XMLSchema#integer> . <Sport/ID=111> <Sport#Description> "Football" . <Sport/ID=112> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Sport> . <Sport/ID=112> <Sport#ID> "112"^^<http://www.w3.org/2001/XMLSchema#integer> . <Sport/ID=112> <Sport#Description> "Formula1" .
Title: M to M relation, by using a SQL query
Purpose: Tests, M to M relations, by using a SQL query
Specification reference: #r2rml-views
Review status: unreviewed
Input: D011-M2MRelations
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/110/Tennis> | <http://example.com/description> | "Tennis" | |
<http://example.com/110/Tennis> | <http://example.com/id> | "110"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/10/Venus;Williams> | <http://example.com/plays> | <http://example.com/110/Tennis> | |
<http://example.com/10/Venus;Williams> | <http://example.com/lastName> | "Williams" | |
<http://example.com/10/Venus;Williams> | <http://example.com/firstName> | "Venus" | |
<http://example.com/10/Venus;Williams> | <http://example.com/id> | "10"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/111/Football> | <http://example.com/description> | "Football" | |
<http://example.com/111/Football> | <http://example.com/id> | "111"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/12/David;Villa> | <http://example.com/plays> | <http://example.com/111/Football> | |
<http://example.com/12/David;Villa> | <http://example.com/lastName> | "Villa" | |
<http://example.com/12/David;Villa> | <http://example.com/firstName> | "David" | |
<http://example.com/12/David;Villa> | <http://example.com/id> | "12"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/112/Formula1> | <http://example.com/description> | "Formula1" | |
<http://example.com/112/Formula1> | <http://example.com/id> | "112"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/11/Fernando;Alonso> | <http://example.com/lastName> | "Alonso" | |
<http://example.com/11/Fernando;Alonso> | <http://example.com/firstName> | "Fernando" | |
<http://example.com/11/Fernando;Alonso> | <http://example.com/id> | "11"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/11/Fernando;Alonso> | <http://example.com/plays> | <http://example.com/111/Football> | |
<http://example.com/11/Fernando;Alonso> | <http://example.com/plays> | <http://example.com/112/Formula1> | |
R2RML mapping: R2RMLTC0011a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ 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:predicate ex:id ; rr:objectMap [ rr:column "ID"; ] ]; rr:predicateObjectMap [ rr:predicate ex:firstName ; rr:objectMap [ rr:column "FirstName" ] ]; rr:predicateObjectMap [ rr:predicate ex:lastName ; rr:objectMap [ rr:column "LastName" ] ]; rr:predicateObjectMap [ rr:predicate ex:plays ; rr:objectMap [ rr:template "http://example.com/{Sport_ID}/{Description}" ] ] . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Sport\"" ]; rr:subjectMap [ rr:template "http://example.com/{\"ID\"}/{\"Description\"}"; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate ex:description ; rr:objectMap [ rr:column "\"Description\"" ] ] .
Title: M to M relation, by using an additional Triples Map
Purpose: Tests, M to M relations, by using an additional Triples Map
Specification reference: #physical-tables
Review status: unreviewed
Input: D011-M2MRelations
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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> | |
R2RML mapping: R2RMLTC0011b
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\""; ] ; rr:subjectMap [ rr:template "http://example.com/student/{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate ex:firstName ; rr:objectMap [ rr:column "\"FirstName\"" ] ]; rr:predicateObjectMap [ rr:predicate ex:lastName ; rr:objectMap [ rr:column "\"LastName\"" ] ] . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Sport\""; ] ; rr:subjectMap [ rr:template "http://example.com/sport/{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate ex:description ; rr:objectMap [ rr:column "\"Description\"" ] ] . <LinkMap_1_2> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student_Sport\"" ]; rr:subjectMap [ rr:template "http://example.com/student/{\"ID_Student\"}" ]; rr:predicateObjectMap [ rr:predicate ex:plays ; rr:objectMap [ rr:template "http://example.com/sport/{\"ID_Sport\"}" ]; ].
Title: Two tables, two duplicate records, zero nulls, no primary key
Graphical representation:
fname VARCHAR(20) |
lname VARCHAR(20) |
amount DOUBLE |
---|---|---|
Bob | Smith | 30.0E0 |
Sue | Jones | 20.0E0 |
Bob | Smith | 30.0E0 |
fname VARCHAR(20) |
lname VARCHAR(20) |
city VARCHAR(20) |
---|---|---|
Bob | Smith | London |
Sue | Jones | Madrid |
Bob | Smith | London |
SQL:
CREATE TABLE "IOUs" ( "fname" VARCHAR(20), "lname" VARCHAR(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); CREATE TABLE "Lives" ( "fname" VARCHAR(20), "lname" VARCHAR(20), "city" VARCHAR(20)); INSERT INTO "Lives" ("fname", "lname", "city") VALUES ('Bob', 'Smith', 'London'); INSERT INTO "Lives" ("fname", "lname", "city") VALUES ('Sue', 'Jones', 'Madrid'); INSERT INTO "Lives" ("fname", "lname", "city") VALUES ('Bob', 'Smith', 'London');
Title: Generation of direct graph from a database without primary keys
Purpose: Test the generation of direct graph from a database without primary keys, by creating subject BlankNodes
Specification reference: #no-pk
Review status: unreviewed
Input: D012-2tables2duplicates0nulls
Expected result: DirectGraphTC0012
RDF:
@base <http://example.com/base/> . _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <IOUs> . _:a <IOUs#fname> "Bob" . _:a <IOUs#lname> "Smith" . _:a <IOUs#amount> "3.0E1"^^<http://www.w3.org/2001/XMLSchema#double> . _:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <IOUs> . _:b <IOUs#fname> "Sue" . _:b <IOUs#lname> "Jones" . _:b <IOUs#amount> "2.0E1"^^<http://www.w3.org/2001/XMLSchema#double> . _:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <IOUs> . _:c <IOUs#fname> "Bob" . _:c <IOUs#lname> "Smith" . _:c <IOUs#amount> "3.0E1"^^<http://www.w3.org/2001/XMLSchema#double> . _:d <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Lives> . _:d <Lives#fname> "Bob" . _:d <Lives#lname> "Smith" . _:d <Lives#city> "London" . _:e <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Lives> . _:e <Lives#fname> "Sue" . _:e <Lives#lname> "Jones" . _:e <Lives#city> "Madrid" . _:f <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Lives> . _:f <Lives#fname> "Bob" . _:f <Lives#lname> "Smith" . _:f <Lives#city> "London" .
Title: Duplicate tuples generate same blank node
Purpose: Tests that blank nodes with same identifier and in the same graph but generated by different logical rows are considered equivalent.
Specification reference: #blank-nodes
Review status: unreviewed
Input: D012-2tables2duplicates0nulls
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
_:BobSmith30 | <http://example.com/amount> | "3.0E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
_:BobSmith30 | <http://xmlns.com/foaf/0.1/name> | "Bob Smith" | |
_:SueJones20 | <http://example.com/amount> | "2.0E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
_:SueJones20 | <http://xmlns.com/foaf/0.1/name> | "Sue Jones" | |
R2RML mapping: R2RMLTC0012a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"IOUs\"" ]; rr:subjectMap [ rr:template "{\"fname\"}_{\"lname\"}_{\"amount\"}"; rr:termType rr:BlankNode; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:template "{\"fname\"} {\"lname\"}"; rr:termType rr:Literal ; ] ]; rr:predicateObjectMap [ rr:predicate ex:amount ; rr:objectMap [ rr:column "\"amount\""; ] ]; .
Title: Duplicate tuples generate same blank node
Purpose: Tests that blank nodes with same identifier and in the same graph but generated by different logical rows are considered equivalent.
Specification reference: #blank-nodes
Review status: unreviewed
Input: D012-2tables2duplicates0nulls
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
_: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" | |
R2RML mapping: R2RMLTC0012b
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"IOUs\"" ]; rr:subjectMap [ rr:template "{\"fname\"}_{\"lname\"}"; rr:termType rr:BlankNode ; ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:template "{\"fname\"} {\"lname\"}"; rr:termType rr:Literal ; ] ]; . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Lives\"" ]; rr:subjectMap [ rr:template "{\"fname\"}_{\"lname\"}"; rr:termType rr:BlankNode; ]; rr:predicateObjectMap [ rr:predicate ex:city ; rr:objectMap [ rr:column "\"city\""; ] ]; .
Title: TriplesMap without subjectMap
Purpose: Tests a R2RML with missing information, TriplesMap without subjectMap.
Specification reference: #dfn-template-valued-term-map
Review status: unreviewed
Input: D012-2tables2duplicates0nulls
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0012c
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"IOUs\"" ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:template "{\"fname\"} {\"lname\"}"; rr:termType rr:Literal ; ] ]; rr:predicateObjectMap [ rr:predicate ex:amount ; rr:objectMap [ rr:column "\"amount\""; ] ]; .
Title: TriplesMap with two subjectMap
Purpose: Tests a R2RML with wrong information, TriplesMap with two subjectMap.
Specification reference: #dfn-template-valued-term-map
Review status: unreviewed
Input: D012-2tables2duplicates0nulls
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0012d
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"IOUs\"" ]; rr:subjectMap [ rr:template "{\"fname\"}_{\"lname\"}_{\"amount\"}"; ]; rr:subjectMap [ rr:template "{\"amount\"}_{\"fname\"}_{\"lname\"}"; ]; rr:predicateObjectMap [ rr:predicate ex:amount ; rr:objectMap [ rr:column "\"amount\""; ] ]; .
Title: Default mapping
Purpose: Tests the generation of a default mapping for tables without a primary key.
Specification reference: #default-mappings
Review status: unreviewed
Input: D012-2tables2duplicates0nulls
Expected result: mappede.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
_:BobSmith30 | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://example.com/base/IOUs> | |
_:BobSmith30 | <http://example.com/base/IOUs#fname> | "Bob" | |
_:BobSmith30 | <http://example.com/base/IOUs#lname> | "Smith" | |
_:BobSmith30 | <http://example.com/base/IOUs#amount> | "3.0E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
_:SueJones20 | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://example.com/base/IOUs> | |
_:SueJones20 | <http://example.com/base/IOUs#fname> | "Sue" | |
_:SueJones20 | <http://example.com/base/IOUs#lname> | "Jones" | |
_:SueJones20 | <http://example.com/base/IOUs#amount> | "2.0E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
_:BobSmithLondon | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://example.com/base/Lives> | |
_:BobSmithLondon | <http://example.com/base/IOUs#fname> | "Bob" | |
_:BobSmithLondon | <http://example.com/base/IOUs#lname> | "Smith" | |
_:BobSmithLondon | <http://example.com/base/IOUs#city> | "London" | |
_:SueJonesMadrid | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://example.com/base/Lives> | |
_:SueJonesMadrid | <http://example.com/base/IOUs#fname> | "Sue" | |
_:SueJonesMadrid | <http://example.com/base/IOUs#lname> | "Jones" | |
_:SueJonesMadrid | <http://example.com/base/IOUs#city> | "Madrid" | |
R2RML mapping: R2RMLTC0012e
RDF:
@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#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"IOUs\"" ]; rr:subjectMap [ rr:template "{\"fname\"}_{\"lname\"}_{\"amount\"}"; rr:termType rr:BlankNode; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object <IOUs>; ]; rr:predicateObjectMap [ rr:predicate <IOUs#fname> ; rr:objectMap [ rr:column "\"fname\""; ] ]; rr:predicateObjectMap [ rr:predicate <IOUs#lname> ; rr:objectMap [ rr:column "\"lname\""; ] ]; rr:predicateObjectMap [ rr:predicate <IOUs#amount> ; rr:objectMap [ rr:column "\"amount\""; ] ]; . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Lives\"" ]; rr:subjectMap [ rr:template "{\"fname\"}_{\"lname\"}_{\"city\"}"; rr:termType rr:BlankNode; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object <Lives>; ]; rr:predicateObjectMap [ rr:predicate <IOUs#fname> ; rr:objectMap [ rr:column "\"fname\""; ] ]; rr:predicateObjectMap [ rr:predicate <IOUs#lname> ; rr:objectMap [ rr:column "\"lname\""; ] ]; rr:predicateObjectMap [ rr:predicate <IOUs#city> ; rr:objectMap [ rr:column "\"city\""; ] ]; .
Title: One table, one primary key, three columns, two rows, a null value
Graphical representation:
ID (PK) INTEGER |
Name VARCHAR(50) |
DateOfBirth VARCHAR(50) |
---|---|---|
1 | Alice | NULL |
2 | Bob | September, 2010 |
SQL:
CREATE TABLE "Person" ( "ID" integer, "Name" varchar(50), "DateOfBirth" varchar(50), PRIMARY KEY ("ID") ); INSERT INTO "Person" ("ID", "Name", "DateOfBirth") VALUES (1,'Alice', NULL); INSERT INTO "Person" ("ID", "Name", "DateOfBirth") VALUES (2,'Bob', 'September, 2010');
Title: Generation of a direct graph from a table with NULL values
Purpose: Tests the generation of a Direct Graph from a table with NULL values
Specification reference: #lead-ex
Review status: unreviewed
Input: D013-1table1primarykey3columns2rows1nullvalue
Expected result: DirectGraphTC0013
RDF:
@base <http://example.com/base/> . <Person/ID=1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Person> . <Person/ID=1> <Person#ID> "1"^^<http://www.w3.org/2001/XMLSchema#integer> . <Person/ID=1> <Person#Name> "Alice" . <Person/ID=2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Person> . <Person/ID=2> <Person#ID> "2"^^<http://www.w3.org/2001/XMLSchema#integer> . <Person/ID=2> <Person#Name> "Bob" . <Person/ID=2> <Person#DateOfBirth> "September, 2010" .
Title: Generation of empty triples from referenced columns that have null values
Purpose: Tests the generation of empty triples from referenced columns that have null values
Specification reference: #dfn-template-valued-term-map
Review status: unreviewed
Input: D013-1table1primarykey3columns2rows1nullvalue
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Person/2/Bob/September%2C%202010> | <http://example.com/BirthDay> | "September, 2010" | |
R2RML mapping: R2RMLTC0013a
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Person\"" ]; rr:subjectMap [ rr:template "http://example.com/Person/{\"ID\"}/{\"Name\"}/{\"DateOfBirth\"}"; ]; rr:predicateObjectMap [ rr:predicate ex:BirthDay ; rr:objectMap [ rr:column "\"DateOfBirth\"" ] ] .
Title: 3 tables, one primary key, one foreign key
Graphical representation:
empno (PK) INTEGER |
deptno (FK) INTEGER |
ename VARCHAR(100) |
job VARCHAR(30) |
etype VARCHAR(30) |
---|---|---|---|---|
7369 | 10 | SMITH | CLERK | PART_TIME |
id INTEGER |
likeType VARCHAR(30) |
likedObj VARCHAR(100) |
---|---|---|
7369 | Playing | Soccer |
7369 | Watching | Basketball |
deptno INTEGER |
dname VARCHAR(30) |
loc VARCHAR(100) |
---|---|---|
10 | APPSERVER | NEW YORK |
SQL:
CREATE TABLE "DEPT" ( "deptno" INTEGER UNIQUE, "dname" VARCHAR(30), "loc" VARCHAR(100)); INSERT INTO "DEPT" ("deptno", "dname", "loc") VALUES (10, 'APPSERVER', 'NEW YORK'); CREATE TABLE "EMP" ( "empno" INTEGER PRIMARY KEY, "ename" VARCHAR(100), "job" VARCHAR(30), "deptno" INTEGER REFERENCES "DEPT" ("deptno"), "etype" VARCHAR(30)); INSERT INTO "EMP" ("empno", "ename", "job", "deptno", "etype" ) VALUES (7369, 'SMITH', 'CLERK', 10, 'PART_TIME'); CREATE TABLE "LIKES" ( "id" INTEGER, "likeType" VARCHAR(30), "likedObj" VARCHAR(100)); INSERT INTO "LIKES" ("id", "likeType", "likedObj") VALUES (7369, 'Playing', 'Soccer'); INSERT INTO "LIKES" ("id", "likeType", "likedObj") VALUES (7369, 'Watching', 'Basketball');
Title: Generation of direct graph from a database with primary key referencing candidate key
Purpose: Test the generation of direct graph from a database with primary key referencing candidate key
Specification reference: #lead-ex
Review status: unreviewed
Input: D014-3tables1primarykey1foreignkey
Expected result: DirectGraphTC0014
RDF:
@base <http://example.com/base/> . <EMP/empno=7369> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <EMP> . <EMP/empno=7369> <EMP#empno> "7369"^^<http://www.w3.org/2001/XMLSchema#integer> . <EMP/empno=7369> <EMP#deptno> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . <EMP/empno=7369> <EMP#ref-deptno> _:c . <EMP/empno=7369> <EMP#ename> "SMITH" . <EMP/empno=7369> <EMP#job> "CLERK" . <EMP/empno=7369> <EMP#etype> "PART_TIME" . _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <LIKES> . _:a <LIKES#id> "7369"^^<http://www.w3.org/2001/XMLSchema#integer> . _:a <LIKES#likeType> "Playing" . _:a <LIKES#likedObj> "Soccer" . _:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <LIKES> . _:b <LIKES#id> "7369"^^<http://www.w3.org/2001/XMLSchema#integer> . _:b <LIKES#likeType> "Watching" . _:b <LIKES#likedObj> "Basketball" . _:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <DEPT> . _:c <DEPT#deptno> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . _:c <DEPT#dname> "APPSERVER" . _:c <DEPT#loc> "NEW YORK" .
Title: Subjectmap with rr:inverseExpression
Purpose: Tests a rr:subjectMap with rr:inverseExpression
Specification reference: #inverse
Review status: unreviewed
Input: D014-3tables1primarykey1foreignkey
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
_:Department10 | <http://example.com/dept#location> | "NEW YORK" | |
R2RML mapping: R2RMLTC0014a
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix dept: <http://example.com/dept#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT ('Department' || "deptno") AS "deptId" , "deptno" , "dname" , "loc" FROM "DEPT" """ ]; rr:subjectMap [ rr:column "\"deptId\""; rr:termType rr:BlankNode; rr:inverseExpression "{\"deptno\"} = substr({\"deptId\"},length('Department')+1)"]; rr:predicateObjectMap [ rr:predicate dept:location ; rr:objectMap [ rr:column "\"loc\"" ] ]; .
Title: Triplesmaps with rr:inverseExpression and rr:joinCondition
Purpose: Test two triplesmaps, one with a rr:inverseExpression and the other with a rr:joinCondition for foerign key relations
Specification reference: #dfn-join-condition
Review status: unreviewed
Input: D014-3tables1primarykey1foreignkey
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/emp/7369> | <http://example.com/emp#jobtype> | <http://example.com/emp/job/CLERK> | |
<http://example.com/emp/7369> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://example.com/emp/job/CLERK> | |
<http://example.com/emp/7369> | <http://example.com/emp#emptype> | <http://example.com/emp/etype/PART_TIME> | |
<http://example.com/emp/7369> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://example.com/emp/etype/PART_TIME> | |
<http://example.com/emp/7369> | <http://example.com/emp#empno> | "7369"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/emp/7369> | <http://example.com/emp#name> | "SMITH" | |
<http://example.com/emp/7369> | <http://example.com/emp#job> | "CLERK" | |
<http://example.com/emp/7369> | <http://example.com/emp#deptNum> | "10"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/emp/7369> | <http://example.com/emp#etype> | "PART_TIME" | |
<http://example.com/emp/7369> | <http://example.com/emp#c_ref_deptno> | _:Department10 | |
_:Department10 | <http://example.com/dept#deptno> | "10"^^<http://www.w3.org/2001/XMLSchema#integer> | |
_:Department10 | <http://example.com/dept#name> | "APPSERVER" | |
_:Department10 | <http://example.com/dept#location> | "NEW YORK" | |
_:Department10 | <http://example.com/dept#COMPANY> | "EXAMPLE Corporation" | |
R2RML mapping: R2RMLTC0014b
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ex: <http://example.com/ns#> . @prefix emp: <http://example.com/emp#> . @prefix dept: <http://example.com/dept#> . @prefix likes: <http://example.com/likes#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT ('Department' || "deptno") AS deptId , "deptno" , "dname" , "loc" FROM "DEPT" """ ]; rr:subjectMap [ rr:column "deptId"; rr:termType rr:BlankNode; rr:inverseExpression "{\"deptno\"} = substr({deptId},length('Department')+1)" ]; rr:predicateObjectMap [ rr:predicate dept:deptno ; rr:objectMap [ rr:column "\"deptno\""; ] ]; rr:predicateObjectMap [ rr:predicate dept:name ; rr:objectMap [ rr:column "\"dname\"" ] ]; rr:predicateObjectMap [ rr:predicate dept:location ; rr:objectMap [ rr:column "\"loc\"" ] ]; rr:predicateObjectMap [ rr:predicate dept:COMPANY ; rr:object "EXAMPLE Corporation" ] . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT ('http://example.com/emp/' || "empno") AS empURI , "empno" , "ename" , ('http://example.com/emp/job/'|| "job") AS jobTypeURI , "job" , "deptno" , ('http://example.com/emp/etype/'|| "etype") AS empTypeURI , "etype" , ('http://example.com/graph/'|| "job" || '/' || "etype") AS graphURI FROM "EMP" """ ]; rr:subjectMap [ rr:column "empURI"; ]; rr:predicateObjectMap [ rr:predicate emp:jobtype ; rr:objectMap [ rr:column "jobTypeURI"; rr:termType rr:IRI; ] ]; rr:predicateObjectMap [ rr:predicate rdf:type ; rr:objectMap [ rr:column "jobTypeURI"; rr:termType rr:IRI; ] ]; rr:predicateObjectMap [ rr:predicate emp:emptype ; rr:objectMap [ rr:column "empTypeURI"; rr:termType rr:IRI; ] ]; rr:predicateObjectMap [ rr:predicate rdf:type ; rr:objectMap [ rr:column "empTypeURI"; rr:termType rr:IRI; ] ]; rr:predicateObjectMap [ rr:predicate emp:empno ; rr:objectMap [ rr:column "\"empno\"" ] ]; rr:predicateObjectMap [ rr:predicate emp:name ; rr:objectMap [ rr:column "\"ename\"" ]; ]; rr:predicateObjectMap [ rr:predicate emp:job ; rr:objectMap [ rr:column "\"job\"" ] ]; rr:predicateObjectMap [ rr:predicate emp:deptNum ; rr:objectMap [ rr:column "\"deptno\"" ] ]; rr:predicateObjectMap [ rr:predicate emp:etype ; rr:objectMap [ rr:column "\"etype\"" ] ]; rr:predicateObjectMap [ rr:predicate emp:c_ref_deptno ; rr:objectMap [ a rr:RefObjectMap ; rr:parentTriplesMap <TriplesMap1>; rr:joinCondition [ rr:child "\"deptno\""; rr:parent "\"deptno\""; ]; ]; ] .
Title: Triplesmaps with rr:inverseExpression, rr:joinCondition, and referencing object maps
Purpose: Triplesmaps with rr:inverseExpression, rr:joinCondition, and referencing object maps
Specification reference: #foreign-key
Review status: unreviewed
Input: D014-3tables1primarykey1foreignkey
Expected result: mappedc.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/emp/7369> | <http://example.com/emp#jobtype> | <http://example.com/emp/job/CLERK> | |
<http://example.com/emp/7369> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://example.com/emp/job/CLERK> | |
<http://example.com/emp/7369> | <http://example.com/emp#emptype> | <http://example.com/emp/etype/PART_TIME> | |
<http://example.com/emp/7369> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://example.com/emp/etype/PART_TIME> | |
<http://example.com/emp/7369> | <http://example.com/emp#empno> | "7369"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/emp/7369> | <http://example.com/emp#job> | "CLERK" | |
<http://example.com/emp/7369> | <http://example.com/emp#deptNum> | "10"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/emp/7369> | <http://example.com/emp#etype> | "PART_TIME" | |
<http://example.com/emp/7369> | <http://example.com/emp#c_ref_deptno> | _:Department10 | |
<http://example.com/emp/7369> | <http://example.com/emp#name> | "SMITH" | |
_:Department10 | <http://example.com/dept#deptno> | "10"^^<http://www.w3.org/2001/XMLSchema#positiveInteger> | |
_:Department10 | <http://example.com/dept#name> | "APPSERVER" | |
_:Department10 | <http://example.com/dept#location> | "NEW YORK" | |
_:Department10 | <http://example.com/dept#COMPANY> | "EXAMPLE Corporation" | |
R2RML mapping: R2RMLTC0014c
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ex: <http://example.com/ns#> . @prefix emp: <http://example.com/emp#> . @prefix dept: <http://example.com/dept#> . @prefix likes: <http://example.com/likes#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ Select ('Department' || "deptno") AS deptId , "deptno" , "dname" , "loc" from "DEPT" """ ]; rr:subjectMap [ rr:column "deptId"; rr:termType rr:BlankNode; rr:inverseExpression "{\"deptno\"} = substr({deptId},length('Department')+1)"]; rr:predicateObjectMap [ rr:predicate dept:deptno ; rr:objectMap [ rr:column "\"deptno\""; rr:datatype xsd:positiveInteger ] ]; rr:predicateObjectMap [ rr:predicate dept:name ; rr:objectMap [ rr:column "\"dname\"" ] ]; rr:predicateObjectMap [ rr:predicate dept:location ; rr:objectMap [ rr:column "\"loc\"" ] ]; rr:predicateObjectMap [ rr:predicate dept:COMPANY ; rr:objectMap [ rr:constant "EXAMPLE Corporation"; ] ] . <jobtypeObjectMap> a rr:ObjectMap; rr:template "http://example.com/emp/job/{\"job\"}" . <emptypeObjectMap> a rr:ObjectMap; rr:template "http://example.com/emp/etype/{\"etype\"}" . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"EMP\"" ]; rr:subjectMap [ rr:template "http://example.com/emp/{\"empno\"}"; ]; rr:predicateObjectMap [ rr:predicate emp:jobtype ; rr:objectMap <jobtypeObjectMap> ]; rr:predicateObjectMap [ rr:predicate rdf:type ; rr:objectMap <jobtypeObjectMap> ]; rr:predicateObjectMap [ rr:predicate emp:emptype ; rr:objectMap <emptypeObjectMap> ]; rr:predicateObjectMap [ rr:predicate rdf:type ; rr:objectMap <emptypeObjectMap> ]; rr:predicateObjectMap [ rr:predicate emp:empno ; rr:objectMap [ rr:column "\"empno\"" ] ]; rr:predicateObjectMap [ rr:predicate emp:name ; rr:objectMap [ rr:column "\"ename\"" ]; ]; rr:predicateObjectMap [ rr:predicate emp:job ; rr:objectMap [ rr:column "\"job\"" ] ]; rr:predicateObjectMap [ rr:predicate emp:deptNum ; rr:objectMap [ rr:column "\"deptno\"" ] ]; rr:predicateObjectMap [ rr:predicate emp:etype ; rr:objectMap [ rr:column "\"etype\"" ] ]; rr:predicateObjectMap [ rr:predicate emp:c_ref_deptno ; rr:objectMap [ a rr:RefObjectMap ; rr:parentTriplesMap <TriplesMap1>; rr:joinCondition [ rr:child "\"deptno\""; rr:parent "\"deptno\""; ]; ]; ] .
Title: three tables, one primary key, one foreign key
Purpose: Test the translation of database type codes to IRIs
Specification reference: #example-translationtable
Review status: unreviewed
Input: D014-3tables1primarykey1foreignkey
Expected result: mappedd.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://data.example.com/employee/7369> | <http://example.com/ns#role> | <http://data.example.com/roles/general-office> | |
R2RML mapping: R2RMLTC0014d
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ex: <http://example.com/ns#> . @prefix emp: <http://example.com/emp#> . @prefix dept: <http://example.com/dept#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <TriplesMap4> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "EMP".*, (CASE "job" WHEN 'CLERK' THEN 'general-office' WHEN 'NIGHTGUARD' THEN 'security' WHEN 'ENGINEER' THEN 'engineering' END) AS ROLE FROM "EMP" """ ]; rr:subjectMap [ rr:template "http://data.example.com/employee/{\"empno\"}"; ]; rr:predicateObjectMap [ rr:predicate ex:role; rr:objectMap [ rr:template "http://data.example.com/roles/{ROLE}" ]; ].
Title: One table, three columns, one composite primary key, three rows, two languages
Graphical representation:
Code (PK) VARCHAR(2) |
Lan (PK) VARCHAR(10) |
Name VARCHAR(100) |
---|---|---|
BO | EN | Bolivia, Plurinational State of |
BO | ES | Estado Plurinacional de Bolivia |
IE | EN | Ireland |
IE | ES | Irlanda |
SQL:
CREATE TABLE "Country" ( "Code" VARCHAR(2), "Name" VARCHAR(100), "Lan" VARCHAR(10), PRIMARY KEY ("Code","Lan") ); INSERT INTO "Country" ("Code", "Name", "Lan") VALUES ('BO', 'Bolivia, Plurinational State of', 'EN'); INSERT INTO "Country" ("Code", "Name", "Lan") VALUES ('BO', 'Estado Plurinacional de Bolivia', 'ES'); INSERT INTO "Country" ("Code", "Name", "Lan") VALUES ('IE', 'Ireland', 'EN'); INSERT INTO "Country" ("Code", "Name", "Lan") VALUES ('IE', 'Irlanda', 'ES');
File: D015-1table3columns1composityeprimarykey3rows2languages
Title: Generation of direct graph from multi-column primary keys
Purpose: Tests the generation of direct graph from multi-column primary keys
Specification reference: #multi-key
Review status: unreviewed
Input: D015-1table3columns1composityeprimarykey3rows2languages
Expected result: DirectGraphTC0015
RDF:
@base <http://example.com/base/> . <Country/Code=BO;Lan=EN> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Country> . <Country/Code=BO;Lan=EN> <Country#Code> "BO" . <Country/Code=BO;Lan=EN> <Country#Lan> "EN" . <Country/Code=BO;Lan=EN> <Country#Name> "Bolivia, Plurinational State of" . <Country/Code=BO;Lan=ES> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Country> . <Country/Code=BO;Lan=ES> <Country#Code> "BO" . <Country/Code=BO;Lan=ES> <Country#Lan> "ES" . <Country/Code=BO;Lan=ES> <Country#Name> "Estado Plurinacional de Bolivia" . <Country/Code=IE;Lan=EN> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Country> . <Country/Code=IE;Lan=EN> <Country#Code> "IE" . <Country/Code=IE;Lan=EN> <Country#Lan> "EN" . <Country/Code=IE;Lan=EN> <Country#Name> "Ireland" . <Country/Code=IE;Lan=ES> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Country> . <Country/Code=IE;Lan=ES> <Country#Code> "IE" . <Country/Code=IE;Lan=ES> <Country#Lan> "ES" . <Country/Code=IE;Lan=ES> <Country#Name> "Irlanda" .
Title: Generation of language tags from a table with language information
Purpose: Generation of language tags from a table with language information
Specification reference: #language-tags
Review status: unreviewed
Input: D015-1table3columns1composityeprimarykey3rows2languages
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<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 | |
R2RML mapping: R2RMLTC0015a
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.com/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "Code", "Name", "Lan" FROM "Country" WHERE "Lan" = 'EN'; """ ] ; rr:subjectMap [ rr:template "http://example.com/{\"Code\"}" ]; rr:predicateObjectMap [ rr:predicate rdfs:label; rr:objectMap [ rr:column "\"Name\""; rr:language "en" ] ] . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "Code", "Name", "Lan" FROM "Country" WHERE "Lan" = 'ES'; """ ] ; rr:subjectMap [ rr:template "http://example.com/{\"Code\"}" ]; rr:predicateObjectMap [ rr:predicate rdfs:label; rr:objectMap [ rr:column "\"Name\""; rr:language "es" ] ] .
Title: Generation of language tags from a table with language information, and a term map with invalid rr:language value
Purpose: Tests a term map with an invalid rr:language value, which is an error
Specification reference: #language-tags
Review status: unreviewed
Input: D015-1table3columns1composityeprimarykey3rows2languages
Expected result: non-conforming R2RML mapping
R2RML mapping: R2RMLTC0015b
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.com/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "Code", "Name", "Lan" FROM "Country" WHERE "Lan" = 'EN'; """ ] ; rr:subjectMap [ rr:template "http://example.com/{\"Code\"}" ]; rr:predicateObjectMap [ rr:predicate rdfs:label; rr:objectMap [ rr:column "\"Name\""; rr:language "english" ] ] . <TriplesMap2> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "Code", "Name", "Lan" FROM "Country" WHERE "Lan" = 'ES'; """ ] ; rr:subjectMap [ rr:template "http://example.com/{\"Code\"}" ]; rr:predicateObjectMap [ rr:predicate rdfs:label; rr:objectMap [ rr:column "\"Name\""; rr:language "spanish" ] ] .
Title: One table, one primary key, ten columns, three rows with sql datatypes
Graphical representation:
ID (PK) INTEGER |
FirstName VARCHAR(50) |
LastName VARCHAR(50) |
Sex VARCHAR(6) |
Weight DOUBLE |
Height DOUBLE |
BirthDate DATE |
EntranceDate TIMESTAMP |
PaidInAdvance BOOLEAN |
Photo VARBINARY |
---|---|---|---|---|---|---|---|---|---|
10 | Monica | Geller | female | 80.25E0 | 1.65E0 | 1981-10-10 | 2009-10-10 12:12:22.000000 | FALSE | [Binary Data] |
11 | Rachel | Green | female | 70.22E0 | 1.7E0 | 1982-11-12 | 2008-11-12 09:45:44.000000 | TRUE | [Binary Data] |
12 | Chandler | Bing | male | 90.31E0 | 1.76E0 | 1978-04-06 | 2007-03-12 02:13:14.000000 | TRUE | [Binary Data] |
SQL:
CREATE TABLE "Patient" ( "ID" INTEGER, "FirstName" VARCHAR(50), "LastName" VARCHAR(50), "Sex" VARCHAR(6), "Weight" REAL, "Height" FLOAT, "BirthDate" DATE, "EntranceDate" TIMESTAMP, "PaidInAdvance" BOOLEAN, "Photo" VARBINARY(200), PRIMARY KEY ("ID") ); INSERT INTO "Patient" ("ID", "FirstName","LastName","Sex","Weight","Height","BirthDate","EntranceDate","PaidInAdvance","Photo") VALUES (10,'Monica','Geller','female',80.25,1.65,'1981-10-10','2009-10-10 12:12:22',FALSE, X'89504E470D0A1A0A0000000D49484452000000050000000508060000008D6F26E50000001C4944415408D763F9FFFEBFC37F062005C3201284D031F18258CD04000EF535CBD18E0E1F0000000049454E44AE426082'); INSERT INTO "Patient" ("ID", "FirstName","LastName","Sex","Weight","Height","BirthDate","EntranceDate","PaidInAdvance","Photo") VALUES (11,'Rachel','Green','female',70.22,1.70,'1982-11-12','2008-11-12 09:45:44',TRUE, X'89504E470D0A1A0A0000000D49484452000000050000000508060000008D6F26E50000001C4944415408D763F9FFFF3FC37F062005C3201284D031F18258CD04000EF535CBD18E0E1F0000000049454E44AE426082'); INSERT INTO "Patient" ("ID", "FirstName","LastName","Sex","Weight","Height","BirthDate","EntranceDate","PaidInAdvance","Photo") VALUES (12,'Chandler','Bing','male',90.31,1.76,'1978-04-06','2007-03-12 02:13:14',TRUE, X'89504E470D0A1A0A0000000D49484452000000050000000508060000008D6F26E50000001C4944415408D763F9FFFEBFC37F062005C3201284D031F18258CD04000EF535CBD18E0E1F0000000049454E44AE426082');
Title: Generation of direct graph from a database with sql datatypes
Purpose: Tests the generation of direct graph from a database with sql datatypes
Specification reference: #lead-ex
Review status: unreviewed
Input: D016-1table1primarykey10columns3rowsSQLdatatypes
Expected result: DirectGraphTC0016
RDF:
@base <http://example.com/base/> . <Patient/ID=10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Patient> . <Patient/ID=10> <Patient#ID> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . <Patient/ID=10> <Patient#FirstName> "Monica" . <Patient/ID=10> <Patient#LastName> "Geller" . <Patient/ID=10> <Patient#Sex> "female" . <Patient/ID=10> <Patient#Weight> "8.025E1"^^<http://www.w3.org/2001/XMLSchema#double> . <Patient/ID=10> <Patient#Height> "1.65E0"^^<http://www.w3.org/2001/XMLSchema#double> . <Patient/ID=10> <Patient#BirthDate> "1981-10-10"^^<http://www.w3.org/2001/XMLSchema#date> . <Patient/ID=10> <Patient#EntranceDate> "2009-10-10T12:12:22"^^<http://www.w3.org/2001/XMLSchema#dateTime> . <Patient/ID=10> <Patient#PaidInAdvance> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> . <Patient/ID=10> <Patient#Photo> "89504E470D0A1A0A0000000D49484452000000050000000508060000008D6F26E50000001C4944415408D763F9FFFEBFC37F062005C3201284D031F18258CD04000EF535CBD18E0E1F0000000049454E44AE426082"^^<http://www.w3.org/2001/XMLSchema#hexBinary> . <Patient/ID=11> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Patient> . <Patient/ID=11> <Patient#ID> "11"^^<http://www.w3.org/2001/XMLSchema#integer> . <Patient/ID=11> <Patient#FirstName> "Rachel" . <Patient/ID=11> <Patient#LastName> "Green" . <Patient/ID=11> <Patient#Sex> "female" . <Patient/ID=11> <Patient#Weight> "7.022E1"^^<http://www.w3.org/2001/XMLSchema#double> . <Patient/ID=11> <Patient#Height> "1.7E0"^^<http://www.w3.org/2001/XMLSchema#double> . <Patient/ID=11> <Patient#BirthDate> "1982-11-12"^^<http://www.w3.org/2001/XMLSchema#date> . <Patient/ID=11> <Patient#EntranceDate> "2008-11-12T09:45:44"^^<http://www.w3.org/2001/XMLSchema#dateTime> . <Patient/ID=11> <Patient#PaidInAdvance> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> . <Patient/ID=11> <Patient#Photo> "89504E470D0A1A0A0000000D49484452000000050000000508060000008D6F26E50000001C4944415408D763F9FFFF3FC37F062005C3201284D031F18258CD04000EF535CBD18E0E1F0000000049454E44AE426082"^^<http://www.w3.org/2001/XMLSchema#hexBinary> . <Patient/ID=12> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Patient> . <Patient/ID=12> <Patient#ID> "12"^^<http://www.w3.org/2001/XMLSchema#integer> . <Patient/ID=12> <Patient#FirstName> "Chandler" . <Patient/ID=12> <Patient#LastName> "Bing" . <Patient/ID=12> <Patient#Sex> "male" . <Patient/ID=12> <Patient#Weight> "9.031E1"^^<http://www.w3.org/2001/XMLSchema#double> . <Patient/ID=12> <Patient#Height> "1.76E0"^^<http://www.w3.org/2001/XMLSchema#double> . <Patient/ID=12> <Patient#BirthDate> "1978-04-06"^^<http://www.w3.org/2001/XMLSchema#date> . <Patient/ID=12> <Patient#EntranceDate> "2007-03-12T02:13:14"^^<http://www.w3.org/2001/XMLSchema#dateTime> . <Patient/ID=12> <Patient#PaidInAdvance> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> . <Patient/ID=12> <Patient#Photo> "89504E470D0A1A0A0000000D49484452000000050000000508060000008D6F26E50000001C4944415408D763F9FFFEBFC37F062005C3201284D031F18258CD04000EF535CBD18E0E1F0000000049454E44AE426082"^^<http://www.w3.org/2001/XMLSchema#hexBinary> .
Title: Table with datatypes: string and integer
Purpose: Tests the rr:termtype and datatype conversions: string and integer
Specification reference: #datatype-conversions
Review status: unreviewed
Input: D016-1table1primarykey10columns3rowsSQLdatatypes
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Patient/10> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient/10> | <http://example.com/id> | "10"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/Patient/10> | <http://example.com/firstName> | "Monica" | |
<http://example.com/Patient/10> | <http://example.com/lastName> | "Geller" | |
<http://example.com/Patient/10> | <http://example.com/gender> | "female" | |
<http://example.com/Patient/11> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient/11> | <http://example.com/id> | "11"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/Patient/11> | <http://example.com/firstName> | "Rachel" | |
<http://example.com/Patient/11> | <http://example.com/lastName> | "Green" | |
<http://example.com/Patient/11> | <http://example.com/gender> | "female" | |
<http://example.com/Patient/12> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient/12> | <http://example.com/id> | "12"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/Patient/12> | <http://example.com/firstName> | "Chandler" | |
<http://example.com/Patient/12> | <http://example.com/lastName> | "Bing" | |
<http://example.com/Patient/12> | <http://example.com/gender> | "male" | |
R2RML mapping: R2RMLTC0016a
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Patient\"" ]; rr:subjectMap [ rr:template "http://example.com/Patient/{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate ex:firstName; rr:objectMap [ rr:column "\"FirstName\""; ] ]; rr:predicateObjectMap [ rr:predicate ex:lastName; rr:objectMap [ rr:column "\"LastName\""; ] ]; rr:predicateObjectMap [ rr:predicate ex:gender; rr:objectMap [ rr:column "\"Sex\""; ] ]; .
Title: Table with datatypes: real and float
Purpose: Tests the rr:termtype and datatype conversions: real and float
Specification reference: #datatype-conversions
Review status: unreviewed
Input: D016-1table1primarykey10columns3rowsSQLdatatypes
Expected result: mappedb.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Patient10> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient10> | <http://example.com/weight> | "8.025E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
<http://example.com/Patient10> | <http://example.com/height> | "1.65E0"^^<http://www.w3.org/2001/XMLSchema#double> | |
<http://example.com/Patient11> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient11> | <http://example.com/weight> | "7.022E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
<http://example.com/Patient11> | <http://example.com/height> | "1.7E0"^^<http://www.w3.org/2001/XMLSchema#double> | |
<http://example.com/Patient12> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient12> | <http://example.com/weight> | "9.031E1"^^<http://www.w3.org/2001/XMLSchema#double> | |
<http://example.com/Patient12> | <http://example.com/height> | "1.76E0"^^<http://www.w3.org/2001/XMLSchema#double> | |
R2RML mapping: R2RMLTC0016b
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Patient\"" ]; rr:subjectMap [ rr:template "http://example.com/Patient{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; rr:predicateObjectMap [ rr:predicate ex:weight; rr:objectMap [ rr:column "\"Weight\""; ] ]; rr:predicateObjectMap [ rr:predicate ex:height; rr:objectMap [ rr:column "\"Height\""; ] ]; .
Title: Table with datatypes: date and timestamp
Purpose: Tests the rr:termtype and datatype conversions: date and timestamp
Specification reference: #datatype-conversions
Review status: unreviewed
Input: D016-1table1primarykey10columns3rowsSQLdatatypes
Expected result: mappedc.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Patient10> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient10> | <http://example.com/birthdate> | "1981-10-10"^^<http://www.w3.org/2001/XMLSchema#date> | |
<http://example.com/Patient10> | <http://example.com/entrancedate> | "2009-10-10T12:12:22"^^<http://www.w3.org/2001/XMLSchema#dateTime> | |
<http://example.com/Patient11> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient11> | <http://example.com/birthdate> | "1982-11-12"^^<http://www.w3.org/2001/XMLSchema#date> | |
<http://example.com/Patient11> | <http://example.com/entrancedate> | "2008-11-12T09:45:44"^^<http://www.w3.org/2001/XMLSchema#dateTime> | |
<http://example.com/Patient12> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient12> | <http://example.com/birthdate> | "1978-04-06"^^<http://www.w3.org/2001/XMLSchema#date> | |
<http://example.com/Patient12> | <http://example.com/entrancedate> | "2007-03-12T02:13:14"^^<http://www.w3.org/2001/XMLSchema#dateTime> | |
R2RML mapping: R2RMLTC0016c
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Patient\"" ]; rr:subjectMap [ rr:template "http://example.com/Patient{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; rr:predicateObjectMap [ rr:predicate ex:birthdate; rr:objectMap [ rr:column "\"BirthDate\""; ] ]; rr:predicateObjectMap [ rr:predicate ex:entrancedate; rr:objectMap [ rr:column "\"EntranceDate\""; ] ]; .
Title: Table with datatypes, boolean conversions
Purpose: Tests the rr:termtype and datatype conversions: boolean
Specification reference: #datatype-conversions
Review status: unreviewed
Input: D016-1table1primarykey10columns3rowsSQLdatatypes
Expected result: mappedd.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Patient10> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient10> | <http://example.com/paid> | "false"^^<http://www.w3.org/2001/XMLSchema#boolean> | |
<http://example.com/Patient11> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient11> | <http://example.com/paid> | "true"^^<http://www.w3.org/2001/XMLSchema#boolean> | |
<http://example.com/Patient12> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient12> | <http://example.com/paid> | "true"^^<http://www.w3.org/2001/XMLSchema#boolean> | |
R2RML mapping: R2RMLTC0016d
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Patient\"" ]; rr:subjectMap [ rr:template "http://example.com/Patient{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; rr:predicateObjectMap [ rr:predicate ex:paid; rr:objectMap [ rr:column "\"PaidInAdvance\""; ] ]; .
Title: Table with datatypes, binary column
Purpose: Tests the rr:termtype and datatype conversions: binary
Specification reference: #datatype-conversions
Review status: unreviewed
Input: D016-1table1primarykey10columns3rowsSQLdatatypes
Expected result: mappede.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/Patient10> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient10> | <http://example.com/photo> | <data:image/png;hex,89504E470D0A1A0A0000000D49484452000000050000000508060000008D6F26E50000001C4944415408D763F9FFFEBFC37F062005C3201284D031F18258CD04000EF535CBD18E0E1F0000000049454E44AE426082> | |
<http://example.com/Patient11> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient11> | <http://example.com/photo> | <data:image/png;hex,89504E470D0A1A0A0000000D49484452000000050000000508060000008D6F26E50000001C4944415408D763F9FFFF3FC37F062005C3201284D031F18258CD04000EF535CBD18E0E1F0000000049454E44AE426082> | |
<http://example.com/Patient12> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/Patient12> | <http://example.com/photo> | <data:image/png;hex,89504E470D0A1A0A0000000D49484452000000050000000508060000008D6F26E50000001C4944415408D763F9FFFEBFC37F062005C3201284D031F18258CD04000EF535CBD18E0E1F0000000049454E44AE426082> | |
R2RML mapping: R2RMLTC0016e
RDF:
@prefix rr: <http://www.w3.org/ns/r2rml#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Patient\"" ]; rr:subjectMap [ rr:template "http://example.com/Patient{\"ID\"}"; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; rr:predicateObjectMap [ rr:predicate ex:photo; rr:objectMap [ rr:template "data:image/png;hex,{\"Photo\"}"; ]; ]; .
Title: I18N No Special Chars
Graphical representation:
植物名 (FK) VARCHAR(10) |
使用部 (FK) VARCHAR(10) |
皿 VARCHAR(10) |
---|---|---|
しそ | 葉 | しそのとまと |
名 (PK) VARCHAR(10) |
使用部 (PK) VARCHAR(10) |
条件 VARCHAR(10) |
---|---|---|
しそ | 葉 | 新鮮な |
SQL:
CREATE TABLE "植物" ( "名" VARCHAR(10), "使用部" VARCHAR(10), "条件" VARCHAR(10), PRIMARY KEY ("名", "使用部") ); INSERT INTO "植物" ("名", "使用部", "条件") VALUES ('しそ', '葉', '新鮮な'); CREATE TABLE "成分" ( "皿" VARCHAR(10), "植物名" VARCHAR(10), "使用部" VARCHAR(10), FOREIGN KEY ("植物名", "使用部") REFERENCES "植物"("名", "使用部") ); INSERT INTO "成分" ("皿", "植物名", "使用部") VALUES ('しそのとまと', 'しそ', '葉');
File: D017-I18NnoSpecialChars
Title: I18N No Special Chars
Purpose: Test de generation of a direct graph from a I18N No Special Chars database
Specification reference: #no-pk
Review status: unreviewed
Input: D017-I18NnoSpecialChars
Expected result: DirectGraphTC0017
RDF:
@base <http://example.com/base/> . <植物/名=しそ;使用部=葉> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <植物> . <植物/名=しそ;使用部=葉> <植物#使用部> "葉" . <植物/名=しそ;使用部=葉> <植物#名> "しそ" . <植物/名=しそ;使用部=葉> <植物#条件> "新鮮な" . _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <成分> . _:a <成分#使用部> "葉" . _:a <成分#植物名> "しそ" . _:a <成分#ref-植物名;使用部> <植物/名=しそ;使用部=葉> . _:a <成分#皿> "しそのとまと" .
Title: One table, one primary key, two columns, three rows
Graphical representation:
ID INTEGER |
Name CHARACTER(15) |
---|---|
10 | Venus |
20 | Fernando |
30 | David |
SQL:
CREATE TABLE "Student" ( "ID" INTEGER, "Name" CHAR(15) ); INSERT INTO "Student" ("ID","Name") VALUES (10,'Venus'); INSERT INTO "Student" ("ID","Name") VALUES (20,'Fernando'); INSERT INTO "Student" ("ID","Name") VALUES (30,'David');
Title: Generation of triples by using CHAR datatype column
Purpose: Generation of triples by using CHAR datatype column, resulting RDF literal is space-padded.
Specification reference: #lead-ex
Review status: unreviewed
Input: D018-1table1primarykey2columns3rows
Expected result: DirectGraphTC0018
RDF:
@base <http://example.com/base/> . _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> . _:a <Student#ID> "10"^^<http://www.w3.org/2001/XMLSchema#integer> . _:a <Student#Name> "Venus " . _:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> . _:b <Student#ID> "20"^^<http://www.w3.org/2001/XMLSchema#integer> . _:b <Student#Name> "Fernando " . _:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Student> . _:c <Student#ID> "30"^^<http://www.w3.org/2001/XMLSchema#integer> . _:c <Student#Name> "David " .
Title: Generation of triples by using CHAR datatype column
Purpose: Generation of triples by using CHAR datatype column, resulting RDF literal is space-padded.
Specification reference: #from-template
Review status: unreviewed
Input: D018-1table1primarykey2columns3rows
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/10> | <http://xmlns.com/foaf/0.1/name> | "Venus " | |
<http://example.com/10> | <http://example.com/id> | "10"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/10> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/20> | <http://xmlns.com/foaf/0.1/name> | "Fernando " | |
<http://example.com/20> | <http://example.com/id> | "20"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/20> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/30> | <http://xmlns.com/foaf/0.1/name> | "David " | |
<http://example.com/30> | <http://example.com/id> | "30"^^<http://www.w3.org/2001/XMLSchema#integer> | |
<http://example.com/30> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
R2RML mapping: R2RMLTC0018a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\"" ]; rr:subjectMap [ rr:template "http://example.com/{\"ID\"}"; rr:class foaf:Person ]; rr:predicateObjectMap [ rr:predicate ex:id ; rr:objectMap [ rr:column "\"ID\""; ] ]; rr:predicateObjectMap [ rr:predicate foaf:name ; rr:objectMap [ rr:column "\"Name\"" ] ] .
Title: One table, one primary key, three columns, three rows
Graphical representation:
ID INTEGER |
FirstName VARCHAR(50) |
LastName VARCHAR(50) |
---|---|---|
10 | http://example.com/ns#Jhon | Smith |
20 | Carlos | Mendoza |
30 | Juan Daniel | Crespo |
SQL:
CREATE TABLE "Employee" ( "ID" INTEGER, "FirstName" VARCHAR(50), "LastName" VARCHAR(50) ); INSERT INTO "Employee" ("ID","FirstName","LastName") VALUES (10,'http://example.com/ns#Jhon','Smith'); INSERT INTO "Employee" ("ID","FirstName","LastName") VALUES (20,'Carlos','Mendoza'); INSERT INTO "Employee" ("ID","FirstName","LastName") VALUES (30,'Juan Daniel','Crespo');
Title: Generation of triples by using IRI value in columns
Purpose: Test the generation of triples by using IRI value in columns
Specification reference: #from-column
Review status: unreviewed
Input: D019-1table1primarykey3columns3rows
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/ns#Jhon> | <http://xmlns.com/foaf/0.1/name> | "http://example.com/ns#Jhon" | |
<http://example.com/base/Carlos> | <http://xmlns.com/foaf/0.1/name> | "Carlos" | |
R2RML mapping: R2RMLTC0019a
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "ID", "FirstName", "LastName" FROM "Employee" WHERE "ID" < 30 """ ]; rr:subjectMap [ rr:column "\"FirstName\"" ]; rr:predicateObjectMap [ rr:predicate foaf:name; rr:objectMap [ rr:column "\"FirstName\"" ]; ]; .
Title: Generation of triples by using IRI value in columns, with data error
Purpose: Test the generation of triples by using IRI value in columns, conforming R2RML mapping with data error (and no result)
Specification reference: #from-column
Review status: unreviewed
Input: D019-1table1primarykey3columns3rows
Expected result: Conforming R2RML mapping with data error
R2RML mapping: R2RMLTC0019b
RDF:
@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#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Employee\"" ]; rr:subjectMap [ rr:column "\"FirstName\"" ]; rr:predicateObjectMap [ rr:predicate foaf:name; rr:objectMap [ rr:column "\"FirstName\"" ]; ]; .
Title: One table, one column, five rows
Graphical representation:
Name VARCHAR(50) |
---|
http://company.com/Alice |
Bob |
Bob/Charles |
path/../Danny |
Emily Smith |
SQL:
CREATE TABLE "Student" ( "Name" VARCHAR(50) ); INSERT INTO "Student" ("Name") VALUES ('http://company.com/Alice'); INSERT INTO "Student" ("Name") VALUES ('Bob'); INSERT INTO "Student" ("Name") VALUES ('Bob/Charles'); INSERT INTO "Student" ("Name") VALUES ('path/../Danny'); INSERT INTO "Student" ("Name") VALUES ('Emily Smith');
File: D020-1table1column5rows
Title: Generation of triples by using IRI value in columns
Purpose: Test the generation of triples by using IRI value in columns
Specification reference: #from-template
Review status: unreviewed
Input: D020-1table1column5rows
Expected result: mappeda.nq
RDF:
Subject | Predicate | Object | Graph |
---|---|---|---|
<http://example.com/base/http%3A%2F%2Fcompany.com%2FAlice> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/base/Bob> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/base/Bob%2FCharles> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/base/path%2F..%2FDanny> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
<http://example.com/base/Emily%20Smith> | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | <http://xmlns.com/foaf/0.1/Person> | |
R2RML mapping: R2RMLTC0020a
RDF:
@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#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\""; ]; rr:subjectMap [ rr:template "{\"Name\"}"; rr:termType rr:IRI; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; .
Title: Generation of triples by using IRI value in columns, with data errors
Purpose: Test the generation of triples by using IRI value in columns, conforming R2RML mapping with data error (and no result)
Specification reference: #from-column
Review status: unreviewed
Input: D020-1table1column5rows
Expected result: Conforming R2RML mapping with data error
R2RML mapping: R2RMLTC0020b
RDF:
@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#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @base <http://example.com/base/> . <TriplesMap1> a rr:TriplesMap; rr:logicalTable [ rr:tableName "\"Student\""; ]; rr:subjectMap [ rr:column "\"Name\""; rr:termType rr:IRI; ]; rr:predicateObjectMap [ rr:predicate rdf:type; rr:object foaf:Person; ]; .
Title: Two tables, two primary keys, a foreign key, references all nulls
Graphical representation:
ID (PK) INTEGER |
attrA (FK) CHARACTER(5) |
attrB (FK) CHARACTER(5) |
---|---|---|
1100 | K2A21 | K2A11 |
1101 | K2A22 | NULL |
1102 | NULL | NULL |
PK (PK) INTEGER |
key1attr1 CHARACTER(5) |
key1attr2 CHARACTER(5) |
key2attr1 CHARACTER(5) |
key2attr2 CHARACTER(5) |
---|---|---|---|---|
1010 | K1A11 | K1A21 | K2A11 | K2A21 |
1011 | K1A12 | K1A22 | NULL | K2A22 |
1012 | K1A13 | K1A23 | NULL | NULL |
SQL:
CREATE TABLE "Target" ( "PK" INT, PRIMARY KEY("PK"), "key1attr1" CHAR(5), "key1attr2" CHAR(5), UNIQUE ("key1attr1", "key1attr2"), "key2attr1" CHAR(5), "key2attr2" CHAR(5), UNIQUE ("key2attr2", "key2attr1") ); CREATE TABLE "Source" ( "ID" INT, PRIMARY KEY("ID"), "attrA" CHAR(5), "attrB" CHAR(5), FOREIGN KEY ("attrA", "attrB") REFERENCES "Target"("key2attr2", "key2attr1") ); INSERT INTO "Target" ("PK", "key1attr1", "key1attr2", "key2attr1", "key2attr2") VALUES (1010, 'K1A11' , 'K1A21' , 'K2A11' , 'K2A21' ); INSERT INTO "Target" ("PK", "key1attr1", "key1attr2", "key2attr1", "key2attr2") VALUES (1011, 'K1A12' , 'K1A22' , NULL , 'K2A22' ); INSERT INTO "Target" ("PK", "key1attr1", "key1attr2", "key2attr1", "key2attr2") VALUES (1012, 'K1A13' , 'K1A23' , NULL , NULL ); INSERT INTO "Source" ("ID", "attrA", "attrB") VALUES (1100, 'K2A21', 'K2A11'); INSERT INTO "Source" ("ID", "attrA", "attrB") VALUES (1101, 'K2A22', NULL ); INSERT INTO "Source" ("ID", "attrA", "attrB") VALUES (1102, NULL , NULL );
Title: Generation of triples for two tables, two primary keys, a foreign key, references all nulls
Purpose: Generation of triples two tables, two primary keys, a foreign key, references all nulls
Specification reference: #lead-ex
Review status: unreviewed
Input: D021-2tables2primarykeys1foreignkeyReferencesAllNulls
Expected result: DirectGraphTC0021
RDF:
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <Target/PK=1010> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Target> . <Target/PK=1010> <Target#PK> 1010 . <Target/PK=1010> <Target#key1attr1> "K1A11" . <Target/PK=1010> <Target#key1attr2> "K1A21" . <Target/PK=1010> <Target#key2attr1> "K2A11" . <Target/PK=1010> <Target#key2attr2> "K2A21" . <Target/PK=1011> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Target> . <Target/PK=1011> <Target#PK> 1011 . <Target/PK=1011> <Target#key1attr1> "K1A12" . <Target/PK=1011> <Target#key1attr2> "K1A22" . <Target/PK=1011> <Target#key2attr2> "K2A22" . <Target/PK=1012> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Target> . <Target/PK=1012> <Target#PK> 1012 . <Target/PK=1012> <Target#key1attr1> "K1A13" . <Target/PK=1012> <Target#key1attr2> "K1A23" . <Source/ID=1100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Source> . <Source/ID=1100> <Source#ID> 1100 . <Source/ID=1100> <Source#attrA> "K2A21" . <Source/ID=1100> <Source#attrB> "K2A11" . <Source/ID=1100> <Source#ref-attrA;attrB> <Target/PK=1010> . <Source/ID=1101> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Source> . <Source/ID=1101> <Source#ID> 1101 . <Source/ID=1101> <Source#attrA> "K2A22" . <Source/ID=1102> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Source> . <Source/ID=1102> <Source#ID> 1102 .
Title: Two tables, a primary key, a foreign key, references no primary keys
Graphical representation:
ID (PK) INTEGER |
attrA (FK) CHARACTER(4) |
attrB (FK) CHARACTER(4) |
---|---|---|
1100 | K2A2 | K2A1 |
litattr1 INTEGER |
key1attr1 CHARACTER(4) |
key1attr2 CHARACTER(4) |
key2attr1 CHARACTER(4) |
key2attr2 CHARACTER(4) |
---|---|---|---|---|
1010 | K1A1 | K1A2 | K2A1 | K2A2 |
SQL:
CREATE TABLE "Target" ( "litattr1" INT, -- PRIMARY KEY("PK"), "key1attr1" CHAR(4), "key1attr2" CHAR(4), UNIQUE ("key1attr1", "key1attr2"), "key2attr1" CHAR(4), "key2attr2" CHAR(4), UNIQUE ("key2attr2", "key2attr1") ); CREATE TABLE "Source" ( "ID" INT, PRIMARY KEY("ID"), "attrA" CHAR(4), "attrB" CHAR(4), FOREIGN KEY ("attrA", "attrB") REFERENCES "Target"("key2attr2", "key2attr1") ); INSERT INTO "Target" ("litattr1", "key1attr1", "key1attr2", "key2attr1", "key2attr2") VALUES (1010 , 'K1A1' , 'K1A2' , 'K2A1' , 'K2A2'); INSERT INTO "Source" ("ID", "attrA", "attrB") VALUES (1100, 'K2A2' , 'K2A1' );
File: D022-2tables1primarykey1foreignkeyReferencesNoPrimaryKey
Title: Generation of triples from two tables, a primary key, a foreign key, references no primary keys
Purpose: Generation of triples from two tables, a primary key, a foreign key, references no primary keys
Specification reference: #lead-ex
Review status: unreviewed
Input: D022-2tables1primarykey1foreignkeyReferencesNoPrimaryKey
Expected result: DirectGraphTC0022
RDF:
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Target> . _:a <Target#litattr1> 1010 . _:a <Target#key1attr1> "K1A1" . _:a <Target#key1attr2> "K1A2" . _:a <Target#key2attr1> "K2A1" . _:a <Target#key2attr2> "K2A2" . <Source/ID=1100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Source> . <Source/ID=1100> <Source#ID> 1100 . <Source/ID=1100> <Source#attrA> "K2A2" . <Source/ID=1100> <Source#attrB> "K2A1" . <Source/ID=1100> <Source#ref-attrA;attrB> _:a .
Title: Two tables, two primary keys, two foreign keys, references to a key other than primary key
Graphical representation:
ID (PK) INTEGER |
attrA (FK) CHARACTER(4) |
attrB (FK) CHARACTER(4) |
---|---|---|
1100 | K2A2 | K2A1 |
PK (PK) INTEGER |
key1attr1 CHARACTER(4) |
key1attr2 CHARACTER(4) |
key2attr1 CHARACTER(4) |
key2attr2 CHARACTER(4) |
---|---|---|---|---|
1010 | K1A1 | K1A2 | K2A1 | K2A2 |
SQL:
CREATE TABLE "Target" ( "PK" INT, PRIMARY KEY("PK"), "key1attr1" CHAR(4), "key1attr2" CHAR(4), UNIQUE ("key1attr1", "key1attr2"), "key2attr1" CHAR(4), "key2attr2" CHAR(4), UNIQUE ("key2attr2", "key2attr1") ); CREATE TABLE "Source" ( "ID" INT, PRIMARY KEY("ID"), "attrA" CHAR(4), "attrB" CHAR(4), FOREIGN KEY ("attrA", "attrB") REFERENCES "Target"("key2attr2", "key2attr1") ); INSERT INTO "Target" ("PK", "key1attr1", "key1attr2", "key2attr1", "key2attr2") VALUES (1010, 'K1A1' , 'K1A2' , 'K2A1' , 'K2A2' ); INSERT INTO "Source" ("ID", "attrA", "attrB") VALUES (1100, 'K2A2' , 'K2A1' );
File: D023-2tables2primarykeys2foreignkeysReferencesToNon-primarykeys
Title: Generation of triples for two tables, two primary keys, two foreign keys, references to a key other than primary key
Purpose: Generation of triples from two tables, two primary keys, two foreign keys, references to a key other than primary key
Specification reference: #lead-ex
Review status: unreviewed
Input: D023-2tables2primarykeys2foreignkeysReferencesToNon-primarykeys
Expected result: DirectGraphTC0023
RDF:
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <Target/PK=1010> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Target> . <Target/PK=1010> <Target#PK> 1010 . <Target/PK=1010> <Target#key1attr1> "K1A1" . <Target/PK=1010> <Target#key1attr2> "K1A2" . <Target/PK=1010> <Target#key2attr1> "K2A1" . <Target/PK=1010> <Target#key2attr2> "K2A2" . <Source/ID=1100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Source> . <Source/ID=1100> <Source#ID> 1100 . <Source/ID=1100> <Source#attrA> "K2A2" . <Source/ID=1100> <Source#attrB> "K2A1" . <Source/ID=1100> <Source#ref-attrA;attrB> <Target/PK=1010> .
Title: Two tables, two primary keys, a foreign key to a row with some NULLs in the key.
Graphical representation:
ID (PK) INTEGER |
attrA (FK) CHARACTER(5) |
attrB (FK) CHARACTER(5) |
---|---|---|
1100 | K2A21 | K2A11 |
1101 | K2A22 | NULL |
PK (PK) INTEGER |
key1attr1 CHARACTER(5) |
key1attr2 CHARACTER(5) |
key2attr1 CHARACTER(5) |
key2attr2 CHARACTER(5) |
---|---|---|---|---|
1010 | K1A11 | K1A21 | K2A11 | K2A21 |
1011 | K1A12 | K1A22 | NULL | K2A22 |
SQL:
CREATE TABLE "Target" ( "PK" INT, PRIMARY KEY("PK"), "key1attr1" CHAR(5), "key1attr2" CHAR(5), UNIQUE ("key1attr1", "key1attr2"), "key2attr1" CHAR(5), "key2attr2" CHAR(5), UNIQUE ("key2attr2", "key2attr1") ); CREATE TABLE "Source" ( "ID" INT, PRIMARY KEY("ID"), "attrA" CHAR(5), "attrB" CHAR(5), FOREIGN KEY ("attrA", "attrB") REFERENCES "Target"("key2attr2", "key2attr1") ); INSERT INTO "Target" ("PK", "key1attr1", "key1attr2", "key2attr1", "key2attr2") VALUES (1010, 'K1A11' , 'K1A21' , 'K2A11' , 'K2A21' ); INSERT INTO "Target" ("PK", "key1attr1", "key1attr2", "key2attr1", "key2attr2") VALUES (1011, 'K1A12' , 'K1A22' , NULL , 'K2A22' ); INSERT INTO "Source" ("ID", "attrA", "attrB") VALUES (1100, 'K2A21', 'K2A11'); INSERT INTO "Source" ("ID", "attrA", "attrB") VALUES (1101, 'K2A22', NULL );
File: D024-2tables2primarykeys1foreignkeyToARowWithSomeNulls
Title: Generation of triples from two tables, two primary keys, a foreign key to a row with some NULLs in the key.
Purpose: Generation of triples from two tables, two primary keys, a foreign key to a row with some NULLs in the key.
Specification reference: #lead-ex
Review status: unreviewed
Input: D024-2tables2primarykeys1foreignkeyToARowWithSomeNulls
Expected result: DirectGraphTC0024
RDF:
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <Target/PK=1010> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Target> . <Target/PK=1010> <Target#PK> 1010 . <Target/PK=1010> <Target#key1attr1> "K1A11" . <Target/PK=1010> <Target#key1attr2> "K1A21" . <Target/PK=1010> <Target#key2attr1> "K2A11" . <Target/PK=1010> <Target#key2attr2> "K2A21" . <Target/PK=1011> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Target> . <Target/PK=1011> <Target#PK> 1011 . <Target/PK=1011> <Target#key1attr1> "K1A12" . <Target/PK=1011> <Target#key1attr2> "K1A22" . <Target/PK=1011> <Target#key2attr2> "K2A22" . <Source/ID=1100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Source> . <Source/ID=1100> <Source#ID> 1100 . <Source/ID=1100> <Source#attrA> "K2A21" . <Source/ID=1100> <Source#attrB> "K2A11" . <Source/ID=1100> <Source#ref-attrA;attrB> <Target/PK=1010> . <Source/ID=1101> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Source> . <Source/ID=1101> <Source#ID> 1101 . <Source/ID=1101> <Source#attrA> "K2A22" .
Title: Three tables, three primary keys, three foreign keys
Graphical representation:
deptName (FK) VARCHAR(50) |
deptCity (FK) VARCHAR(50) |
lead (FK) INTEGER |
name VARCHAR(50) |
---|---|---|---|
accounting | Cambridge | 8 | pencil survey |
accounting | Cambridge | 8 | eraser survey |
ID (PK) INTEGER |
city VARCHAR(10) |
state CHARACTER(2) |
---|---|---|
18 | Cambridge | MA |
worker (PFK) INTEGER |
project (PFK) VARCHAR(50) |
deptName (FK) VARCHAR(50) |
deptCity (FK) VARCHAR(50) |
deptName (FK) VARCHAR(50) |
deptCity (FK) VARCHAR(50) |
---|---|---|---|---|---|
7 | pencil survey | accounting | Cambridge | accounting | Cambridge |
ID (PK) INTEGER |
manager (FK) INTEGER |
name VARCHAR(50) |
city VARCHAR(50) |
---|---|---|---|
23 | 8 | accounting | Cambridge |
ID (PK) INTEGER |
addr (FK) INTEGER |
deptName (FK) VARCHAR(50) |
deptCity (FK) VARCHAR(50) |
fname VARCHAR(10) |
---|---|---|---|---|
7 | 18 | accounting | Cambridge | Bob |
8 | NULL | NULL | NULL | Sue |
SQL:
CREATE TABLE "Addresses" ( "ID" INT, PRIMARY KEY("ID"), "city" VARCHAR(10), "state" CHAR(2) ); CREATE TABLE "Department" ( "ID" INT, PRIMARY KEY("ID"), "name" VARCHAR(50), "city" VARCHAR(50), UNIQUE ("name", "city"), "manager" INT ); CREATE TABLE "People" ( "ID" INT, PRIMARY KEY("ID"), "fname" VARCHAR(10), "addr" INT, FOREIGN KEY ("addr") REFERENCES "Addresses"("ID"), "deptName" VARCHAR(50), "deptCity" VARCHAR(50) ); ALTER TABLE "Department" ADD FOREIGN KEY("manager") REFERENCES "People"("ID"); ALTER TABLE "People" ADD FOREIGN KEY("deptName", "deptCity") REFERENCES "Department"("name", "city"); INSERT INTO "Addresses" ("ID", "city", "state") VALUES (18, 'Cambridge', 'MA'); INSERT INTO "People" ("ID", "fname", "addr", "deptName", "deptCity" ) VALUES (8, 'Sue', NULL, NULL, NULL); INSERT INTO "Department" ("ID", "name", "city", "manager") VALUES (23, 'accounting', 'Cambridge', 8); INSERT INTO "People" ("ID", "fname", "addr", "deptName", "deptCity" ) VALUES (7, 'Bob', 18, 'accounting', 'Cambridge'); CREATE TABLE "Projects" ( "lead" INT, "name" VARCHAR(50), UNIQUE ("lead", "name"), "deptName" VARCHAR(50), "deptCity" VARCHAR(50), UNIQUE ("name", "deptName", "deptCity"), FOREIGN KEY ("deptName", "deptCity") REFERENCES "Department"("name", "city") ); CREATE TABLE "TaskAssignments" ( "worker" INT, "project" VARCHAR(50), PRIMARY KEY ("worker", "project"), "deptName" VARCHAR(50), "deptCity" VARCHAR(50), FOREIGN KEY ("project", "deptName", "deptCity") REFERENCES "Projects"("name", "deptName", "deptCity"), FOREIGN KEY ("deptName", "deptCity") REFERENCES "Department"("name", "city") ); ALTER TABLE "Projects" ADD FOREIGN KEY("lead") REFERENCES "People"("ID"); ALTER TABLE "TaskAssignments" ADD FOREIGN KEY("worker") REFERENCES "People"("ID"); INSERT INTO "Projects" ("lead", "name", "deptName", "deptCity" ) VALUES (8, 'pencil survey', 'accounting', 'Cambridge'); INSERT INTO "Projects" ("lead", "name", "deptName", "deptCity" ) VALUES (8, 'eraser survey', 'accounting', 'Cambridge'); INSERT INTO "TaskAssignments" ("worker", "project", "deptName", "deptCity" ) VALUES (7, 'pencil survey', 'accounting', 'Cambridge');
Title: Generation of triples from three tables, three primary keys, three foreign keys
Purpose: Generation of triples from three tables, three primary keys, three foreign keys
Specification reference: #lead-ex
Review status: unreviewed
Input: D025-3tables3primarykeys3foreignkeys
Expected result: DirectGraphTC0025
RDF:
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @base <http://example.com/base/> . <People/ID=7> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <People> . <People/ID=7> <People#ID> 7 . <People/ID=7> <People#fname> "Bob" . <People/ID=7> <People#addr> 18 . <People/ID=7> <People#ref-addr> <Addresses/ID=18> . <People/ID=7> <People#deptName> "accounting" . <People/ID=7> <People#deptCity> "Cambridge" . <People/ID=7> <People#ref-deptName;deptCity> <Department/ID=23> . <People/ID=8> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <People> . <People/ID=8> <People#ID> 8 . <People/ID=8> <People#fname> "Sue" . <Addresses/ID=18> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Addresses> . <Addresses/ID=18> <Addresses#ID> 18 . <Addresses/ID=18> <Addresses#city> "Cambridge" . <Addresses/ID=18> <Addresses#state> "MA" . <Department/ID=23> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Department> . <Department/ID=23> <Department#ID> 23 . <Department/ID=23> <Department#name> "accounting" . <Department/ID=23> <Department#city> "Cambridge" . <Department/ID=23> <Department#manager> 8; . <Department/ID=23> <Department#ref-manager> <People/ID=8> . _:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Projects> . _:c <Projects#lead> 8 . _:c <Projects#ref-lead> <People/ID=8> . _:c <Projects#name> "pencil survey" . _:c <Projects#deptName> "accounting" . _:c <Projects#deptCity> "Cambridge" . _:c <Projects#ref-deptName;deptCity> <Department/ID=23> . _:d <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <Projects> . _:d <Projects#lead> 8 . _:d <Projects#ref-lead> <People/ID=8> . _:d <Projects#name> "eraser survey" . _:d <Projects#deptName> "accounting" . _:d <Projects#deptCity> "Cambridge" . _:d <Projects#ref-deptName;deptCity> <Department/ID=23> . <TaskAssignments/worker=7;project=pencil%20survey> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <TaskAssignments> . <TaskAssignments/worker=7;project=pencil%20survey> <TaskAssignments#worker> 7 . <TaskAssignments/worker=7;project=pencil%20survey> <TaskAssignments#ref-worker> <People/ID=7> . <TaskAssignments/worker=7;project=pencil%20survey> <TaskAssignments#project> "pencil survey" . <TaskAssignments/worker=7;project=pencil%20survey> <TaskAssignments#deptName> "accounting" . <TaskAssignments/worker=7;project=pencil%20survey> <TaskAssignments#deptCity> "Cambridge" . <TaskAssignments/worker=7;project=pencil%20survey> <TaskAssignments#ref-deptName;deptCity> <Department/ID=23> . <TaskAssignments/worker=7;project=pencil%20survey> <TaskAssignments#ref-project;deptName;deptCity> _:c .