Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions test-cases/RMLTC0000-RDB/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## RMLTC0000-RDB

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

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

**Error expected?** No

**Input**
```
DROP TABLE IF EXISTS student CASCADE ;
CREATE TABLE student (
"Name" VARCHAR(50)
);
```

**Mapping**
```
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [
rml:source <http://example.com/base/#DB_source>;
rml:referenceFormulation rml:SQL2008Table;
rml:iterator "student"
];
rml:predicateObjectMap [
rml:objectMap [
rml:reference "Name"
];
rml:predicate foaf:name
];
rml:subjectMap [
rml:template "http://example.com/{Name}"
] .

<http://example.com/base/#DB_source> a d2rq:Database;
d2rq:jdbcDSN "CONNECTIONDSN";
d2rq:jdbcDriver "org.postgresql.Driver";
d2rq:password "";
d2rq:username "postgres" .

```

**Output**
```
# empty database

```

25 changes: 25 additions & 0 deletions test-cases/RMLTC0000-RDB/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [
rml:source <http://example.com/base/#DB_source>;
rml:referenceFormulation rml:SQL2008Table;
rml:iterator "student"
];
rml:predicateObjectMap [
rml:objectMap [
rml:reference "Name"
];
rml:predicate foaf:name
];
rml:subjectMap [
rml:template "http://example.com/{Name}"
] .

<http://example.com/base/#DB_source> a d2rq:Database;
d2rq:jdbcDSN "CONNECTIONDSN";
d2rq:jdbcDriver "org.postgresql.Driver";
d2rq:password "";
d2rq:username "postgres" .
1 change: 1 addition & 0 deletions test-cases/RMLTC0000-RDB/output.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# empty database
4 changes: 4 additions & 0 deletions test-cases/RMLTC0000-RDB/resource.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DROP TABLE IF EXISTS student CASCADE ;
CREATE TABLE student (
"Name" VARCHAR(50)
);
54 changes: 54 additions & 0 deletions test-cases/RMLTC0001a-RDB/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## RMLTC0001a-RDB

**Title**: One column mapping, subject URI generation by using rr:template

**Description**: Tests: (1) one column mapping; (2) subject URI generation by using rr:tmplate; (3) one column to one property

**Error expected?** No

**Input**
```
DROP TABLE IF EXISTS student CASCADE ;
CREATE TABLE student (
"Name" VARCHAR(50)
);
INSERT INTO student values ('Venus');

```

**Mapping**
```
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [
rml:source <http://example.com/base/#DB_source>;
rml:referenceFormulation rml:SQL2008Table;
rml:iterator "student"
];
rml:predicateObjectMap [
rml:objectMap [
rml:reference "Name"
];
rml:predicate foaf:name
];
rml:subjectMap [
rml:template "http://example.com/{Name}"
] .

<http://example.com/base/#DB_source> a d2rq:Database;
d2rq:jdbcDSN "CONNECTIONDSN";
d2rq:jdbcDriver "org.postgresql.Driver";
d2rq:password "";
d2rq:username "postgres" .

```

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

```

25 changes: 25 additions & 0 deletions test-cases/RMLTC0001a-RDB/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [
rml:source <http://example.com/base/#DB_source>;
rml:referenceFormulation rml:SQL2008Table;
rml:iterator "student"
];
rml:predicateObjectMap [
rml:objectMap [
rml:reference "Name"
];
rml:predicate foaf:name
];
rml:subjectMap [
rml:template "http://example.com/{Name}"
] .

<http://example.com/base/#DB_source> a d2rq:Database;
d2rq:jdbcDSN "CONNECTIONDSN";
d2rq:jdbcDriver "org.postgresql.Driver";
d2rq:password "";
d2rq:username "postgres" .
1 change: 1 addition & 0 deletions test-cases/RMLTC0001a-RDB/output.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example.com/Venus> <http://xmlns.com/foaf/0.1/name> "Venus" .
5 changes: 5 additions & 0 deletions test-cases/RMLTC0001a-RDB/resource.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DROP TABLE IF EXISTS student CASCADE ;
CREATE TABLE student (
"Name" VARCHAR(50)
);
INSERT INTO student values ('Venus');
54 changes: 54 additions & 0 deletions test-cases/RMLTC0001b-RDB/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## RMLTC0001b-RDB

**Title**: One column mapping, generation of a BlankNode subject by using rr:termType

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

**Error expected?** No

**Input**
```
DROP TABLE IF EXISTS student CASCADE ;
CREATE TABLE student (
name VARCHAR(50)
);
INSERT INTO student values ('Venus');

```

**Mapping**
```
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [ a rml:LogicalSource;
rml:iterator "SELECT Name FROM student";
rml:referenceFormulation rml:SQL2008Query;
rml:source <http://example.com/base/#DB_source>
];
rml:predicateObjectMap [
rml:objectMap [
rml:reference "name"
];
rml:predicate foaf:name
];
rml:subjectMap [
rml:template "http://example.com/{name}"
] .

<http://example.com/base/#DB_source> a d2rq:Database;
d2rq:jdbcDSN "CONNECTIONDSN";
d2rq:jdbcDriver "org.postgresql.Driver";
d2rq:password "";
d2rq:username "postgres" .

```

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

```

26 changes: 26 additions & 0 deletions test-cases/RMLTC0001b-RDB/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [
rml:source <http://example.com/base/#DB_source>;
rml:referenceFormulation rml:SQL2008Table;
rml:iterator "student"
];
rml:predicateObjectMap [
rml:objectMap [
rml:reference "name"
];
rml:predicate foaf:name
];
rml:subjectMap [
rml:template "{name}";
rml:termType rml:BlankNode
] .

<http://example.com/base/#DB_source> a d2rq:Database;
d2rq:jdbcDSN "CONNECTIONDSN";
d2rq:jdbcDriver "org.postgresql.Driver";
d2rq:password "";
d2rq:username "postgres" .
2 changes: 2 additions & 0 deletions test-cases/RMLTC0001b-RDB/output.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_:Venus <http://xmlns.com/foaf/0.1/name> "Venus" .

5 changes: 5 additions & 0 deletions test-cases/RMLTC0001b-RDB/resource.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DROP TABLE IF EXISTS student CASCADE ;
CREATE TABLE student (
name VARCHAR(50)
);
INSERT INTO student values ('Venus');
65 changes: 65 additions & 0 deletions test-cases/RMLTC0002a-RDB/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## RMLTC0002a-RDB

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

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

**Error expected?** No

**Input**
```
DROP TABLE IF EXISTS student CASCADE ;
CREATE TABLE student (
"ID" INTEGER,
"Name" VARCHAR(50)
);
INSERT INTO student values ('10', 'Venus');


```

**Mapping**
```
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [
rml:referenceFormulation rml:SQL2008Table;
rml:source <http://example.com/base/#DB_source>;
rml:iterator "student"
];
rml:predicateObjectMap [
rml:objectMap [
rml:reference "ID"
];
rml:predicate ex:id
], [
rml:objectMap [
rml:reference "Name"
];
rml:predicate foaf:name
];
rml:subjectMap [
rml:class foaf:Person;
rml:template "http://example.com/{ID}/{Name}"
] .

<http://example.com/base/#DB_source> a d2rq:Database;
d2rq:jdbcDSN "CONNECTIONDSN";
d2rq:jdbcDriver "org.postgresql.Driver";
d2rq:password "";
d2rq:username "postgres" .

```

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

```

32 changes: 32 additions & 0 deletions test-cases/RMLTC0002a-RDB/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rml: <http://w3id.org/rml/> .

<http://example.com/base/TriplesMap1> a rml:TriplesMap;
rml:logicalSource [
rml:referenceFormulation rml:SQL2008Table;
rml:source <http://example.com/base/#DB_source>;
rml:iterator "student"
];
rml:predicateObjectMap [
rml:objectMap [
rml:reference "ID"
];
rml:predicate ex:id
], [
rml:objectMap [
rml:reference "Name"
];
rml:predicate foaf:name
];
rml:subjectMap [
rml:class foaf:Person;
rml:template "http://example.com/{ID}/{Name}"
] .

<http://example.com/base/#DB_source> a d2rq:Database;
d2rq:jdbcDSN "CONNECTIONDSN";
d2rq:jdbcDriver "org.postgresql.Driver";
d2rq:password "";
d2rq:username "postgres" .
3 changes: 3 additions & 0 deletions test-cases/RMLTC0002a-RDB/output.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<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> .
7 changes: 7 additions & 0 deletions test-cases/RMLTC0002a-RDB/resource.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DROP TABLE IF EXISTS student CASCADE ;
CREATE TABLE student (
"ID" INTEGER,
"Name" VARCHAR(50)
);
INSERT INTO student values ('10', 'Venus');

Loading