Lines of Code (LOC) Comparison for SML and R2RML

R2RML-norm has been piped through rapper for normalization of the turtle representation. The SML has been manually derived (before we created the R2RML->SML converter) based on the R2RML test suite. The table has been created using this script.
IdSML-locR2RML-locR2RML-norm-locSMLR2RMLR2RML-norm
Totals105214041569
D000-1table1column0rows-131519
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#>

Create View TriplesMap1 As
  Construct {
    ?s foaf:name ?o .
  }
  With
    ?s = uri(concat("http://example.com/", ?Name))
    ?o = plainLiteral(?Name)
  From
    Student
@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\"" ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"Name\"}"
    ] .
D001-1table1column1row-a131519
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#>

Create View TriplesMap1 As
  Construct {
    ?s foaf:name ?o .
  }
  With
    //?s = uri(concat("http://example.com/", ?Name))
    //?s = uri("http://example.com/", ?Name)
    ?s = uri(ex:, ?Name)
    ?o = plainLiteral(?Name)
  From
    Student
@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\"" ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"Name\"}"
    ] .
D001-1table1column1row-b131520
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#>

Create View TriplesMap1 As
  Construct {
    ?s foaf:name ?o .
  }
  With
    ?s = bNode(?Name)
    ?o = plainLiteral(?Name)
  From
    Student
@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\"" ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:template "{\"Name\"}" ;
        rr:termType rr:BlankNode
    ] .
D003-1table3columns1row-a142426
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      a foaf:Person ;
      ex:id ?id .
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", ?FirstName, "-", ?LastName))
  From
    [[Select "ID", "FirstName", "LastName" FROM "Student"]]
@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\""; ]
    ];
     .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
							SELECT 	\"ID\",
									\"FirstName\",
									\"LastName\"
							FROM \"Student\"
                       """ ;
        rr:sqlVersion rr:SQL1979
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ] ;
    rr:subjectMap [
        rr:class foaf:Person ;
        rr:template "http://example.com/Student/{\"ID\"}/{\"FirstName\"}-{\"LastName\"}"
    ] .
D003-1table3columns1row-b132123
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/>

Create View TriplesMap1 As
  Construct {
    ?s foaf:name ?n .
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID))
    ?n = plainLiteral(?Name)
  From
    //[[SELECT "ID", ("FirstName" || ' ' || "LastName") AS Name FROM "Student"]]
    // H2 uses the concat function
    [[SELECT "ID", CONCAT("FirstName", ' ', "LastName") AS "Name" FROM "Student"]]
@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" ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
                     SELECT \"ID\",
                            (\"FirstName\" || ' ' || \"LastName\") AS Name
                     FROM \"Student\"
                     """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "Name"
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Student/{\"ID\"}"
    ] .
D003-1table3columns1row-c131520
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/> .

Create View TriplesMap1 As
  Construct {
    ?s foaf:name ?n .
  }
  With
    ?s = uri(concat("http://example.com/Student", ?ID))
    ?n = plainLiteral(concat(?FirstName, " ", ?LastName))
  From
    Student
@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; ]
    ]
    .	
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:template "{\"FirstName\"} {\"LastName\"}" ;
            rr:termType rr:Literal
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Student{\"ID\"}"
    ] .
D004-1table2columns1row-a262735
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/>

Create View TriplesMap1 As
  Construct {
    ?s
      a ex:Student ;
      foaf:name ?n .
  }
  With
    ?s = uri(concat("http://example.com/", ?Student))
    ?n = plainLiteral(?Student)
  From
    Student_Sport


Create View TriplesMap2 As
  Construct {
    ?s
      a ex:Sport ;
      foaf:name ?n .
  }
  With
    ?s = uri(concat("http://example.com/", ?Sport))
    ?n = plainLiteral(?Sport)
  From
    Student_Sport
@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\"" ]
    ]
	.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student_Sport\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Student\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:class ex:Student ;
        rr:template "http://example.com/{\"Student\"}"
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student_Sport\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Sport\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:class ex:Sport ;
        rr:template "http://example.com/{\"Sport\"}"
    ] .
D004-1table2columns1row-b152125
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/>

/**
 * NOTE: This mapping does not have a defined result because of the literal subject.
 * See: http://www.w3.org/TR/2012/NOTE-rdb2rdf-test-cases-20120814/#R2RMLTC0004b
 */
Create View TriplesMap1 As
  Construct {
    ?s
      a ex:Student ;
      foaf:name ?n .
  }
  With
    ?s = plainLiteral(?StudentId)
    ?n = plainLiteral(?Student)
  From
    [[SELECT CONCAT('Student' || "Student") AS "StudentId", "Student" FROM "Student_Sport"]]
@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\"" ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
       SELECT ('Student' || \"Student\") AS StudentId,
				\"Student\"
         FROM \"Student_Sport\"
       """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Student\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:class ex:Student ;
        rr:column "StudentId" ;
        rr:termType rr:Literal
    ] .
D005-1table3columns3rows2duplicates-a151620
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      a foaf:Person ;
      ex:owes ?a .
  }
  With
    ?s = uri(concat("http://example.com/", ?fname, ";", ?lname))
    ?a = typedLiteral(?amount, xsd:double)
  From
    IOUs
@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\""; ]
    ];

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"IOUs\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"amount\""
        ] ;
        rr:predicate ex:owes
    ] ;
    rr:subjectMap [
        rr:class foaf:Person ;
        rr:template "http://example.com/{\"fname\"};{\"lname\"}"
    ] .
D005-1table3columns3rows2duplicates-b212731
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#>

// Note: There is no special "@base" construct in Sparqlify-ML as there is in Turtle
// The workaround is to simple use a namespace prefix 
Prefix base: <http://example.com/base/>
Prefix ious: <http://example.com/base/IOUs#>

Create View TriplesMap1 As
  Construct {
    ?s
      a base:IOUs ;
      ious:fname ?fn ;
      ious:lname ?ln ;
      ious:amount ?a .
  }
  With
    ?s  = bNode(concat(?fname, "_", ?lname))
    ?fn = plainLiteral(?fname)
    ?ln = plainLiteral(?lname)
    ?a  = typedLiteral(?amount, xsd:double) // Maybe introduce an "auto" keyword / URI for the dataype
  From
    IOUs
@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\""; ]
    ];
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"IOUs\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"fname\""
        ] ;
        rr:predicate <http://example.com/base/IOUs#fname>
    ], [
        rr:objectMap [
            rr:column "\"lname\""
        ] ;
        rr:predicate <http://example.com/base/IOUs#lname>
    ], [
        rr:objectMap [
            rr:column "\"amount\""
        ] ;
        rr:predicate <http://example.com/base/IOUs#amount>
    ] ;
    rr:subjectMap [
        rr:class <http://example.com/base/IOUs> ;
        rr:template "{\"fname\"}_{\"lname\"}" ;
        rr:termType rr:BlankNode
    ] .
D006-1table1primarykey1column1row-a101624
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/> .

Create View TriplesMap1 As
  Construct {
    Graph <http://example.com/graph/student> {
      ex:BadStudent ex:description "Bad Student" .
    }
  }
@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"; ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:constant "Bad Student"
        ] ;
        rr:predicateMap [
            rr:constant ex:description
        ]
    ] ;
    rr:subjectMap [
        rr:constant ex:BadStudent ;
        rr:graphMap [
            rr:constant <http://example.com/graph/student>
        ]
    ] .
D007-1table1primarykey2columns1row-a131617
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/>

Create View TriplesMap1 As
  Construct {
    ?s a foaf:Person
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", ?Name)) 
  From
    Student
@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; 
	];
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"
    ] .
D007-1table1primarykey2columns1row-b182323
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/>

Create View TriplesMap1 As
  Construct {
    Graph ex:PersonGraph {
      ?s
        a foaf:Person ;
        foaf:name ?n
    }
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", ?Name))
    ?n = plainLiteral(?Name)
  From
    Student
@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\"" ]
    ]

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:graph ex:PersonGraph ;
        rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"
    ] .
D007-1table1primarykey2columns1row-c182425
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/>

Create View TriplesMap1 As
  Construct {
    ?s
      a foaf:Person, ex:Student ;
      foaf:name ?n ;
      ex:id ?i
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", ?Name))
    ?n = plainLiteral(?Name)
    ?i = typedLiteral(?ID, xsd:integer)
  From
    Student
@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\"" ]
    ]

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ], [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:class ex:Student, foaf:Person ;
        rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"
    ] .
D007-1table1primarykey2columns1row-d193330
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/>

Create View TriplesMap1 As
  Construct {
    ?s
      a foaf:Person ;
      a ex:Student ;
      foaf:name ?n ;
      ex:id ?i
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", ?Name))
    ?n = plainLiteral(?Name)
    ?i = typedLiteral(?ID, xsd:integer)
  From
    Student
@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\"" ]
    ]

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:object ex:Student ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ], [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"
    ] .
D007-1table1primarykey2columns1row-e202426
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/>

Create View TriplesMap1 As
  Construct {
    Graph ex:PersonGraph {
      ?s
        a foaf:Person ;
        foaf:name ?n ;
        ex:id ?i
    }
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", ?Name))
    ?n = plainLiteral(?Name)
    ?i = typedLiteral(?ID, xsd:integer)
  From
    Student
@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\"" ]
    ]

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ], [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:class foaf:Person ;
        rr:graph ex:PersonGraph ;
        rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"
    ] .
D007-1table1primarykey2columns1row-f202828
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/>

// TODO Where is the difference to D007-e?
Create View TriplesMap1 As
  Construct {
    Graph ex:PersonGraph {
      ?s
        a foaf:Person ;
        ex:id ?i ;
        foaf:name ?n
    }
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", ?Name))
    ?n = plainLiteral(?Name)
    ?i = typedLiteral(?ID, xsd:integer)
  From
    Student
@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\"" ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ], [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:graph ex:PersonGraph ;
        rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"
    ] .
D007-1table1primarykey2columns1row-g162323
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/> .


// TODO Probably add support for internally mapping
// rr:defaultGraph to Jena's Quad.defaultGraphNodeGenerated
Create View TriplesMap1 As
  Construct {
    //Graph rr:defaultGraph {
      ?s
        a foaf:Person ;
        foaf:name ?n
    //}
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", ?Name))
    ?n = plainLiteral(?Name)
  From
    Student
@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\"" ]
    ]

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:graph rr:defaultGraph ;
        rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"
    ] .
D008-1table1compositeprimarykey3columns1row-a243335
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/>

Prefix spy: <http://aksw.org/sparqlify/>

// TODO urlEncode currently not supported anymore
Create View TriplesMap1 As
  Construct {
    Graph ?g {
      ?s
        rdf:type foaf:Person ;
        ex:id ?i ;
        foaf:name ?n ;
        ex:Sport ?sp
    }
  }
  With
    ?g = uri(concat("http://example.com/graph/Student/", ?ID, "/", spy:urlEncode(?Name)))
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", spy:urlEncode(?Name)))
    ?i = typedLiteral(?ID, xsd:integer)
    ?n = plainLiteral(?Name)
    ?sp = plainLiteral(?Sport)
  From
    Student
 
@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\"" ]
    ]
	
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Sport\""
        ] ;
        rr:predicate ex:Sport
    ], [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ], [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:graphMap [
            rr:template "http://example.com/graph/Student/{\"ID\"}/{\"Name\"}"
        ] ;
        rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"
    ] .
D008-1table1compositeprimarykey3columns1row-b304646
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://example.com/activity/>
Prefix xsd: <http://www.w3.org/2001/XMLSchema#>
//@base <http://example.com/base/>

Prefix spy: <http://aksw.org/sparqlify/>

Create View TriplesMap2 As
  Construct {
    ?s rdf:type activity:Sport
  }
  With
    ?s = uri(concat("http://example.com/", ?Sport))
  From
    Student


Create View TriplesMap1 As
  Construct {
    ?s
      rdf:type foaf:Person ;
      ex:id ?i ;
      foaf:name ?n ;
      ex:Sport ?sp
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", spy:urlEncode(?Name)))
    ?i = typedLiteral(?ID, xsd:integer)
    ?n = plainLiteral(?Name)
    ?sp = uri(concat("http://example.com/", ?Sport))
    // TODO references ?sp = TriplesMap2.?s ON this.?person_id = that.?id
  From
    Student
		
/* 
    rr:predicateObjectMap
    [ 
      rr:predicate		ex:Sport ;
      rr:objectMap		<RefObjectMap1>
    ]
    
 .

 
<RefObjectMap1>
	a rr:RefObjectMap;
	rr:parentTriplesMap <TriplesMap2> ;
.
*/
@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://example.com/activity/> .
@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> ;
.


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

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

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ], [
        rr:objectMap <http://example.com/base/RefObjectMap1> ;
        rr:predicate ex:Sport
    ], [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:object activity:Sport ;
        rr:predicate rdf:type
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"Sport\"}"
    ] .
D008-1table1compositeprimarykey3columns1row-c171719
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/>

Prefix spy: <http://aksw.org/sparqlify/>

Create View TriplesMap1 As
  Construct {
    ?s
      foaf:name ?n ;
      ex:name ?n
  }
  With
    ?s = uri(concat("http://example.com/Student/", ?ID, "/", spy:urlEncode(?Name)))
    ?n = plainLiteral(?Name)
  From
    Student
@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\"" ]
    ];
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate ex:name, foaf:name
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Student/{\"ID\"}/{\"Name\"}"
    ] .
D009-2tables1primarykey1foreignkey-a263844
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/> .


Create View TriplesMap1 As
  Construct {
    ?s
      foaf:name ?n ;
      <http://example.com/ontology/practises> ?p
  }
  With
    ?s = uri(concat("http://example.com/resource/student_", ?ID))
    ?n = plainLiteral(?Name)
    //?p = TriplesMap2.?s On this.?Sport = that.?ID
    ?p = uri(concat("http://example.com/resource/sport_", ?Sport))
  From
    Student        
	//[[Select a."ID", a. From "Student" a JOIN "Sport" b ON (b."ID" = a."Sport")]]


Create View TriplesMap2 As
  Construct {
    ?s rdfs:label ?l
  }
  With
    ?s = uri(concat("http://example.com/resource/sport_", ?ID))
    ?l = plainLiteral(?Name)
  From
    Sport
@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\""; ];
    ];
	.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ], [
        rr:objectMap [
            a rr:RefObjectMap ;
            rr:joinCondition [
                rr:child "\"Sport\"" ;
                rr:parent "\"ID\""
            ] ;
            rr:parentTriplesMap <http://example.com/base/TriplesMap2>
        ] ;
        rr:predicate <http://example.com/ontology/practises>
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/resource/student_{\"ID\"}"
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Sport\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate rdfs:label
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/resource/sport_{\"ID\"}"
    ] .
D009-2tables1primarykey1foreignkey-b375050
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/> .

Create View TriplesMap1 As
  Construct {
    Graph <http://example.com/graph/students> {
      ?s a <http://example.com/ontology/Student> .
      ?s <http://example.com/ontology/practises> ?o
    }
    Graph <http://example.com/graph/students> {
      ?s foaf:name ?n
    }
    Graph <http://example.com/graph/practise> {
      ?s <http://example.com/ontology/practises> ?o
    }
  }
  With
    ?s = uri(concat("http://example.com/resource/student_", ?ID))
    ?n = plainLiteral(?Name)
    ?o = uri(concat("http://example.com/resource/sport_", ?Sport))
    // TODO Reference rr:join
    //?sp = ref TriplesMaps2.?s On this.?Sport = that.?ID) 
  From
    Student

Create View TriplesMap2 As
  Construct {
    Graph <http://example.com/graph/sports> {
      ?s
        a <http://example.com/ontology/Sport> ;
        rdfs:label ?n
    }
  }
  With
    ?s = uri(concat("http://example.com/resource/sport_", ?ID))
    ?n = plainLiteral(?Name)
  From
    Sport
@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\""; ];
    ];
	.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:graph <http://example.com/graph/students> ;
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ], [
        rr:graph <http://example.com/graph/practise> ;
        rr:objectMap [
            a rr:RefObjectMap ;
            rr:joinCondition [
                rr:child "\"Sport\"" ;
                rr:parent "\"ID\""
            ] ;
            rr:parentTriplesMap <http://example.com/base/TriplesMap2>
        ] ;
        rr:predicate <http://example.com/ontology/practises>
    ] ;
    rr:subjectMap [
        rr:class <http://example.com/ontology/Student> ;
        rr:graph <http://example.com/graph/students> ;
        rr:template "http://example.com/resource/student_{\"ID\"}"
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Sport\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate rdfs:label
    ] ;
    rr:subjectMap [
        rr:class <http://example.com/ontology/Sport> ;
        rr:graph <http://example.com/graph/sports> ;
        rr:template "http://example.com/resource/sport_{\"ID\"}"
    ] .
D009-2tables1primarykey1foreignkey-c152024
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/> .

Prefix spy: <http://aksw.org/sparqlify/>

Create View TriplesMap1 As
  Construct {
    ?s foaf:name ?n
  }
  With
    ?s = uri(concat("http://example.com/resource/student_", spy:urlEncode(?Name)))
    ?n = plainLiteral(?Name)
  From
    [[SELECT "Name", COUNT("Sport") FROM "Student" GROUP BY "Name"]]
@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\""; ];
    ];
  .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
        SELECT \"Name\", COUNT(\"Sport\")
        FROM \"Student\"
        GROUP BY \"Name\"
        """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/resource/student_{\"Name\"}"
    ] .
D009-2tables1primarykey1foreignkey-d182529
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/> .

Prefix spy: <http://aksw.org/sparqlify/>

Create View TriplesMap1 As
  Construct {
    ?s
      foaf:name ?n ;
      ex:numSport ?c 
  }
  With
    ?s = uri(concat("http://example.com/resource/student_", spy:urlEncode(?Name)))
    ?n = plainLiteral(?Name)
    ?c = typedLiteral(?SPORTCOUNT, xsd:integer)
  FROM
    [[SELECT "Name", COUNT("Sport") as SPORTCOUNT FROM "Student" GROUP BY "Name"]]
@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"; ];
    ];
  .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
        SELECT \"Name\", COUNT(\"Sport\") as SPORTCOUNT
        FROM \"Student\"
        GROUP BY \"Name\"
        """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ], [
        rr:objectMap [
            rr:column "SPORTCOUNT"
        ] ;
        rr:predicate ex:numSport
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/resource/student_{\"Name\"}"
    ] .
D010-1table1primarykey3colums3rows-a131519
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/> .

Create View TriplesMap1 As
  Construct {
    ?s ex:name ?n .
  }
  With
    ?s = uri(concat("http://example.com/", ?"Country Code"))
    ?n = plainLiteral(?Name)
  From
    "Country Info"
@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\"" ]
 	]
 	.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Country Info\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate ex:name
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"Country Code\"}"
    ] .
D010-1table1primarykey3colums3rows-b141519
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/> .

Prefix spy: <http://aksw.org/sparqlify/>

Create View TriplesMap1 As
  Construct {
    ?s ex:name ?n
  }
  With
    ?s = uri(concat("http://example.com/", ?"Country Code", "/", spy:urlEncode(?Name)))
    ?n = plainLiteral(?Name)
  From
    "Country Info"
@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\"" ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Country Info\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate ex:name
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"Country Code\"}/{\"Name\"}"
    ] .
D010-1table1primarykey3colums3rows-c141520
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/> .

Prefix spy: <http://aksw.org/sparqlify/>


Create View TriplesMap1 As
  Construct {
	?s ex:code ?o
  }
  With
    ?s = uri(concat("http://example.com/", ?"Country Code", "/", spy:urlEncode(?Name)))
    ?o = plainLiteral(concat("{{{ ", ?"ISO 3166", " }}}"))
  From
    "Country Info"
@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; ]
	]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Country Info\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:template "\\{\\{\\{ {\"ISO 3166\"} \\}\\}\\}" ;
            rr:termType rr:Literal
        ] ;
        rr:predicate ex:code
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"Country Code\"}/{\"Name\"}"
    ] .
D011-M2MRelations-a405462
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      ex:id ?i ;
      ex:firstName ?fn ;
      ex:lastName ?ln ;
      ex:plays ?p
  }
  With
    ?s = uri(concat("http://example.com/", ?ID, "/", ?FirstName, ";", ?LastName))
    ?i = typedLiteral(?ID, xsd:integer)
    ?fn = plainLiteral(?FirstName)
    ?ln = plainLiteral(?LastName)
    ?p = uri(concat("http://example.com", "/", ?Sport_ID, "/", ?Description))
  From [[
       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"
  ]] // TODO Added quotes to column aliases. H2 turns them to uppercase


Create View TriplesMap2 As
  Construct {
    ?s
      ex:id ?i ;
      ex:description ?d
  }
  With
    ?s = uri(concat("http://example.com/", ?ID, "/", ?Description))
    ?i = typedLiteral(?ID, xsd:integer)
    ?d = plainLiteral(?Description)
  From
    Sport  
@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\"" ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<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:predicateObjectMap [
        rr:objectMap [
            rr:template "http://example.com/{Sport_ID}/{Description}"
        ] ;
        rr:predicate ex:plays
    ], [
        rr:objectMap [
            rr:column "ID"
        ] ;
        rr:predicate ex:id
    ], [
        rr:objectMap [
            rr:column "FirstName"
        ] ;
        rr:predicate ex:firstName
    ], [
        rr:objectMap [
            rr:column "LastName"
        ] ;
        rr:predicate ex:lastName
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{ID}/{FirstName};{LastName}"
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Sport\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ], [
        rr:objectMap [
            rr:column "\"Description\""
        ] ;
        rr:predicate ex:description
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"ID\"}/{\"Description\"}"
    ] .
D011-M2MRelations-b374357
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      ex:firstName ?fn ;
      ex:lastName ?ln
  }
  With
    ?s = uri(concat("http://example.com/student/", ?ID))
    ?fn = plainLiteral(?FirstName)
    ?ln = plainLiteral(?LastName) 
  From
    Student
    
Create View TriplesMap2 As
  Construct {
    ?s
      ex:id ?i ;
      ex:description ?d 
  }
  With
    ?s = uri(concat("http://example.com/sport/", ?ID))
    ?i = typedLiteral(?ID, xsd:integer)
    ?d = plainLiteral(?Description)
  From
    Sport

Create View LinkMap_1_2 As
  Construct {
    ?s ex:plays ?o
  }
  With
    ?s = uri(concat("http://example.com/student/", ?ID_Student))
    ?o = uri(concat("http://example.com/sport/", ?ID_Sport))
  From
    Student_Sport
   
   
@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\"}" ];
   ].
   
   
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/LinkMap_1_2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student_Sport\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:template "http://example.com/sport/{\"ID_Sport\"}"
        ] ;
        rr:predicate ex:plays
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/student/{\"ID_Student\"}"
    ] .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"FirstName\""
        ] ;
        rr:predicate ex:firstName
    ], [
        rr:objectMap [
            rr:column "\"LastName\""
        ] ;
        rr:predicate ex:lastName
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/student/{\"ID\"}"
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Sport\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ], [
        rr:objectMap [
            rr:column "\"Description\""
        ] ;
        rr:predicate ex:description
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/sport/{\"ID\"}"
    ] .
D012-2tables2duplicates0nulls-a162526
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      foaf:name ?o ;
      ex:amount ?a
  }
  With
    ?s = bNode(concat(?fname, "_", ?lname, "_", ?amount))
    ?o = plainLiteral(concat(?fname, " ", ?lname))
    ?a = typedLiteral(?amount, xsd:double)
  From
    IOUs
@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\"";
      ]
    ];
	.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"IOUs\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:template "{\"fname\"} {\"lname\"}" ;
            rr:termType rr:Literal
        ] ;
        rr:predicate foaf:name
    ], [
        rr:objectMap [
            rr:column "\"amount\""
        ] ;
        rr:predicate ex:amount
    ] ;
    rr:subjectMap [
        rr:template "{\"fname\"}_{\"lname\"}_{\"amount\"}" ;
        rr:termType rr:BlankNode
    ] .
D012-2tables2duplicates0nulls-b243436
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/>

Create View TriplesMap1 As
  Construct {
    ?s
      foaf:name ?n
  }
  With
    ?s = bNode(concat(?fname, "_", ?lname))
    ?n = plainLiteral(concat(?fname, " ", ?lname))
  From
    IOUs


Create View TriplesMap2 As
  Construct {
    ?s
      ex:city ?c
  }
  With
    ?s = bNode(concat(?fname, "_", ?lname))
    ?c = plainLiteral(?city)
  From
    Lives
@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\""; ]
    ];
	.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"IOUs\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:template "{\"fname\"} {\"lname\"}" ;
            rr:termType rr:Literal
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:template "{\"fname\"}_{\"lname\"}" ;
        rr:termType rr:BlankNode
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Lives\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"city\""
        ] ;
        rr:predicate ex:city
    ] ;
    rr:subjectMap [
        rr:template "{\"fname\"}_{\"lname\"}" ;
        rr:termType rr:BlankNode
    ] .
D012-2tables2duplicates0nulls-e375461
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#>
Prefix base: <http://example.com/base/>

Prefix ious: <http://example.com/base/IOUs#>

Create View TriplesMap1 As
  Construct {
    ?s
      rdf:type base:IOUs ;
      ious:fname ?fn ;
      ious:lname ?ln ;
      ious:amount ?a
  }
  With
    ?s = bNode(concat(?fname, "_", ?lname, "_", ?amount))
    ?fn = plainLiteral(?fname)
    ?ln = plainLiteral(?lname)
    ?a = typedLiteral(?amount, xsd:double)
  From
    IOUs
	
	
Create View TriplesMap2 As
  Construct {
    ?s
      rdf:type base:Lives ;
      ious:fname ?fn ;
      ious:lname ?ln ;
      ious:city ?c
  }
  With
    ?s = bNode(concat(?fname, "_", ?lname, "_", ?city))
    ?fn = plainLiteral(?fname)
    ?ln = plainLiteral(?lname)
    ?c = plainLiteral(?city) 
  From
    Lives
@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\""; ]
    ];
	.	
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"IOUs\""
    ] ;
    rr:predicateObjectMap [
        rr:object <http://example.com/base/IOUs> ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"fname\""
        ] ;
        rr:predicate <http://example.com/base/IOUs#fname>
    ], [
        rr:objectMap [
            rr:column "\"lname\""
        ] ;
        rr:predicate <http://example.com/base/IOUs#lname>
    ], [
        rr:objectMap [
            rr:column "\"amount\""
        ] ;
        rr:predicate <http://example.com/base/IOUs#amount>
    ] ;
    rr:subjectMap [
        rr:template "{\"fname\"}_{\"lname\"}_{\"amount\"}" ;
        rr:termType rr:BlankNode
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Lives\""
    ] ;
    rr:predicateObjectMap [
        rr:object <http://example.com/base/Lives> ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"fname\""
        ] ;
        rr:predicate <http://example.com/base/IOUs#fname>
    ], [
        rr:objectMap [
            rr:column "\"lname\""
        ] ;
        rr:predicate <http://example.com/base/IOUs#lname>
    ], [
        rr:objectMap [
            rr:column "\"city\""
        ] ;
        rr:predicate <http://example.com/base/IOUs#city>
    ] ;
    rr:subjectMap [
        rr:template "{\"fname\"}_{\"lname\"}_{\"city\"}" ;
        rr:termType rr:BlankNode
    ] .
D013-1table1primarykey3columns2rows1nullvalue-a151619
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/> .

Prefix spy: <http://aksw.org/sparqlify/>

Create View TriplesMap1 As
  Construct {
    ?s ex:BirthDay ?o
  }
  With
    ?s = uri(concat("http://example.com/Person/", ?ID, "/", ?Name, "/", spy:urlEncode(?DateOfBirth)))
    ?o = plainLiteral(?DateOfBirth)
  From
    Person
@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\"" ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Person\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"DateOfBirth\""
        ] ;
        rr:predicate ex:BirthDay
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Person/{\"ID\"}/{\"Name\"}/{\"DateOfBirth\"}"
    ] .
D014-3tables1primarykey1foreignkey-a192126
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      dept:location ?o
  }
  With
    ?s = bNode(?deptId)
    ?o = plainLiteral(?loc)
  From
    [[
       SELECT ('Department' || "deptno") AS "deptId"
            , "deptno"
            , "dname"
            , "loc"
       FROM "DEPT"
    ]]
// TODO Inverse Expression support
/*
    rr:subjectMap [ rr:column "\"deptId\""; rr:termType rr:BlankNode;
                    rr:inverseExpression "{\"deptno\"} = substr({\"deptId\"},length('Department')+1)"];
*/
@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\"" ]
    ];
 
.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix dept: <http://example.com/dept#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
       SELECT ('Department' || \"deptno\") AS \"deptId\"
            , \"deptno\"
            , \"dname\"
            , \"loc\"
       FROM \"DEPT\"
       """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"loc\""
        ] ;
        rr:predicate dept:location
    ] ;
    rr:subjectMap [
        rr:column "\"deptId\"" ;
        rr:inverseExpression "{\"deptno\"} = substr({\"deptId\"},length('Department')+1)" ;
        rr:termType rr:BlankNode
    ] .
D014-3tables1primarykey1foreignkey-b76112121
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      dept:deptno ?d ;
      dept:name ?n ;
      dept:location ?l ;
      dept:COMPANY "EXAMPLE Corporation"
  }
  With
    ?s = bNode(?deptId)
    ?d = typedLiteral(?deptno, xsd:integer)
    ?n = plainLiteral(?dname)
    ?l = plainLiteral(?loc)
  From [[
       SELECT ('Department' || "deptno") AS "deptId"
            , "deptno"
            , "dname"
            , "loc"
       FROM "DEPT"
  ]]
/*
TODO Inverse Expression support 
    rr:subjectMap [ rr:column "deptId"; rr:termType rr:BlankNode;
                    rr:inverseExpression "{\"deptno\"} = substr({deptId},length('Department')+1)" ];
*/


Create View TriplesMap2 As
  Construct {
    ?s
      emp:jobtype ?j ; 
      rdf:type ?j ;
      emp:emptype ?e ;
      rdf:type ?e ;
      emp:empno ?eno ;
      emp:name ?en ;
      emp:job ?ej ;
      emp:deptNum ?dno ;
      emp:etype ?et ;
      //emp:c_ref_deptno ?ref
  }
  With
    ?s = uri(?empURI)
    ?j = uri(?jobTypeURI)
    ?e = uri(?empTypeURI)
    ?eno = typedLiteral(?empno, xsd:integer)
    ?en = plainLiteral(?ename)
    ?ej = plainLiteral(?job)
    ?dno = typedLiteral(?deptno, xsd:integer)
    ?et = plainLiteral(?etype)
    //?ref = bNode(?deptno)
  From [[
       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" 
  ]]

// TODO Add Ref Support
Create View TODO_Add_Ref_Support
  As Construct{
    ?s emp:c_ref_deptno ?o
  }
  With
    ?s = uri(?empURI)
    ?o = bNode(?deptId)
  From [[
       SELECT
         ('http://example.com/emp/' || "a"."empno") AS "empURI",
         ('Department' || "b"."deptno") AS "deptId"
       FROM
         "EMP" "a"
         JOIN "DEPT" "b" ON ("b"."deptno" = "a"."deptno")
  ]]
@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\"";
        ];
      ];
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
       SELECT ('Department' || \"deptno\") AS deptId
            , \"deptno\"
            , \"dname\"
            , \"loc\"
       FROM \"DEPT\"
       """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"deptno\""
        ] ;
        rr:predicate dept:deptno
    ], [
        rr:objectMap [
            rr:column "\"dname\""
        ] ;
        rr:predicate dept:name
    ], [
        rr:objectMap [
            rr:column "\"loc\""
        ] ;
        rr:predicate dept:location
    ], [
        rr:object "EXAMPLE Corporation" ;
        rr:predicate dept:COMPANY
    ] ;
    rr:subjectMap [
        rr:column "deptId" ;
        rr:inverseExpression "{\"deptno\"} = substr({deptId},length('Department')+1)" ;
        rr:termType rr:BlankNode
    ] .

<http://example.com/base/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:predicateObjectMap [
        rr:objectMap [
            rr:column "jobTypeURI" ;
            rr:termType rr:IRI
        ] ;
        rr:predicate emp:jobtype
    ], [
        rr:objectMap [
            rr:column "jobTypeURI" ;
            rr:termType rr:IRI
        ] ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "empTypeURI" ;
            rr:termType rr:IRI
        ] ;
        rr:predicate emp:emptype
    ], [
        rr:objectMap [
            rr:column "empTypeURI" ;
            rr:termType rr:IRI
        ] ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"empno\""
        ] ;
        rr:predicate emp:empno
    ], [
        rr:objectMap [
            rr:column "\"ename\""
        ] ;
        rr:predicate emp:name
    ], [
        rr:objectMap [
            rr:column "\"job\""
        ] ;
        rr:predicate emp:job
    ], [
        rr:objectMap [
            rr:column "\"deptno\""
        ] ;
        rr:predicate emp:deptNum
    ], [
        rr:objectMap [
            rr:column "\"etype\""
        ] ;
        rr:predicate emp:etype
    ], [
        rr:objectMap [
            a rr:RefObjectMap ;
            rr:joinCondition [
                rr:child "\"deptno\"" ;
                rr:parent "\"deptno\""
            ] ;
            rr:parentTriplesMap <http://example.com/base/TriplesMap1>
        ] ;
        rr:predicate emp:c_ref_deptno
    ] ;
    rr:subjectMap [
        rr:column "empURI"
    ] .
D014-3tables1primarykey1foreignkey-c61109107
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      dept:deptno ?dno ;
      dept:name ?dn ;
      dept:location ?dl ;
      dept:COMPANY "EXAMPLE Corporation"
  }
  With
    ?s = bNode(?deptId)
    ?dno = typedLiteral(?deptno, xsd:positiveInteger)
    ?dn = plainLiteral(?dname)
    ?dl = plainLiteral(?loc)
  From [[
       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)"];
*/


Create View TriplesMap2 As
  Construct {
    ?s
      emp:jobtype ?j ;
      rdf:type ?j ;
      emp:emptype ?et ;
      rdf:type ?et ;
      emp:empno ?eno ;
      emp:name ?en ;
      emp:job ?job ;
      emp:deptNum ?dno ;
      emp:etype ?etn
  }
  With
    ?s = uri(concat("http://example.com/emp/", ?empno))
    ?j = uri(concat("http://example.com/emp/job/", ?job))
    ?et = uri(concat("http://example.com/emp/etype/", ?etype))
    ?eno = typedLiteral(?empno, xsd:integer)
    ?en = plainLiteral(?ename)
    ?job = plainLiteral(?job)
    ?dno = typedLiteral(?deptno, xsd:integer)
    ?etn = plainLiteral(?etype)
  From
    EMP

Create View TODO_Ref As
  Construct {
    ?s emp:c_ref_deptno ?o
  }
  With
  	?s = uri(concat("http://example.com/emp/", ?empno))
  	?o = bNode(?deptId)
  From [[
    SELECT "a"."empno", ('Department' || "b"."deptno") AS "deptId" FROM "EMP" "a" JOIN "DEPT" "b" ON ("b"."deptno" = "a"."deptno")
  ]]
@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\"";
        ];
      ];
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
       Select ('Department' || \"deptno\") AS deptId
            , \"deptno\"
            , \"dname\"
            , \"loc\"
         from \"DEPT\"
       """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:constant "EXAMPLE Corporation"
        ] ;
        rr:predicate dept:COMPANY
    ], [
        rr:objectMap [
            rr:column "\"deptno\"" ;
            rr:datatype xsd:positiveInteger
        ] ;
        rr:predicate dept:deptno
    ], [
        rr:objectMap [
            rr:column "\"dname\""
        ] ;
        rr:predicate dept:name
    ], [
        rr:objectMap [
            rr:column "\"loc\""
        ] ;
        rr:predicate dept:location
    ] ;
    rr:subjectMap [
        rr:column "deptId" ;
        rr:inverseExpression "{\"deptno\"} = substr({deptId},length('Department')+1)" ;
        rr:termType rr:BlankNode
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"EMP\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap <http://example.com/base/jobtypeObjectMap> ;
        rr:predicate emp:jobtype
    ], [
        rr:objectMap <http://example.com/base/jobtypeObjectMap> ;
        rr:predicate rdf:type
    ], [
        rr:objectMap <http://example.com/base/emptypeObjectMap> ;
        rr:predicate emp:emptype
    ], [
        rr:objectMap <http://example.com/base/emptypeObjectMap> ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"empno\""
        ] ;
        rr:predicate emp:empno
    ], [
        rr:objectMap [
            rr:column "\"ename\""
        ] ;
        rr:predicate emp:name
    ], [
        rr:objectMap [
            rr:column "\"job\""
        ] ;
        rr:predicate emp:job
    ], [
        rr:objectMap [
            rr:column "\"deptno\""
        ] ;
        rr:predicate emp:deptNum
    ], [
        rr:objectMap [
            rr:column "\"etype\""
        ] ;
        rr:predicate emp:etype
    ], [
        rr:objectMap [
            a rr:RefObjectMap ;
            rr:joinCondition [
                rr:child "\"deptno\"" ;
                rr:parent "\"deptno\""
            ] ;
            rr:parentTriplesMap <http://example.com/base/TriplesMap1>
        ] ;
        rr:predicate emp:c_ref_deptno
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/emp/{\"empno\"}"
    ] .

<http://example.com/base/emptypeObjectMap>
    a rr:ObjectMap ;
    rr:template "http://example.com/emp/etype/{\"etype\"}" .

<http://example.com/base/jobtypeObjectMap>
    a rr:ObjectMap ;
    rr:template "http://example.com/emp/job/{\"job\"}" .
D014-3tables1primarykey1foreignkey-d202326
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/> .

Create View TriplesMap4 As
  Construct {
    ?s ex:role ?o
  }
  With
    ?s = uri(concat("http://data.example.com/employee/", ?empno))
    ?o = uri(concat("http://data.example.com/roles/", ?ROLE))
  From [[
        SELECT "EMP".*, (CASE "job"
            WHEN 'CLERK' THEN 'general-office'
            WHEN 'NIGHTGUARD' THEN 'security'
            WHEN 'ENGINEER' THEN 'engineering'
        END) AS ROLE FROM "EMP"
  ]]
@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}" ];
    ].
    
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@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#> .

<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:predicateObjectMap [
        rr:objectMap [
            rr:template "http://data.example.com/roles/{ROLE}"
        ] ;
        rr:predicate ex:role
    ] ;
    rr:subjectMap [
        rr:template "http://data.example.com/employee/{\"empno\"}"
    ] .
D015-1table3columns1composityeprimarykey3rows2languages-a293444
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/> .


Create View TriplesMap1 As
  Construct {
    ?s rdfs:label ?o
  }
  With
    ?s = uri(concat("http://example.com/", ?Code))
    ?o = plainLiteral(?Name, "en") 
  From [[
						SELECT "Code", "Name", "Lan"
						FROM "Country"
						WHERE "Lan" = 'EN';
  ]]
	
Create View TriplesMap2 As
  Construct {
    ?s rdfs:label ?o
  }
  With
    ?s = uri(concat("http://example.com/", ?Code))
    ?o = plainLiteral(?Name, "es")
  From [[
                       SELECT "Code", "Name", "Lan"
                       FROM "Country"
					   WHERE "Lan" = 'ES';
  ]]
@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" ]
    ]
    .	
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
						SELECT \"Code\", \"Name\", \"Lan\"
						FROM \"Country\"
						WHERE \"Lan\" = 'EN';
                       """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\"" ;
            rr:language "en"
        ] ;
        rr:predicate rdfs:label
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"Code\"}"
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
                       SELECT \"Code\", \"Name\", \"Lan\"
                       FROM \"Country\"
					   WHERE \"Lan\" = 'ES';
                       """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\"" ;
            rr:language "es"
        ] ;
        rr:predicate rdfs:label
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"Code\"}"
    ] .
D015-1table3columns1composityeprimarykey3rows2languages-b293444
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/> .

Create View TriplesMap1 As
  Construct {
    ?s rdfs:label 
  }
  With
    ?s = uri(concat("http://example.com/", ?Code))
    ?o = plainLiteral(?Name, "english")
  From [[
                       SELECT "Code", "Name", "Lan"
                       FROM "Country"
					   WHERE "Lan" = 'EN';
  ]]
	
Create View TriplesMap2 As
  Construct {
    ?s rdfs:label ?o
  }
  With
    ?s = uri(concat("http://example.com/", ?Code))
    ?o = plainLiteral(?Name, "spanish")
  From [[
                       SELECT "Code", "Name", "Lan"
                       FROM "Country"
					   WHERE "Lan" = 'ES';
  ]]
@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" ]
    ]
    .	
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
                       SELECT \"Code\", \"Name\", \"Lan\"
                       FROM \"Country\"
					   WHERE \"Lan\" = 'EN';
                       """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\"" ;
            rr:language "english"
        ] ;
        rr:predicate rdfs:label
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"Code\"}"
    ] .

<http://example.com/base/TriplesMap2>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
                       SELECT \"Code\", \"Name\", \"Lan\"
                       FROM \"Country\"
					   WHERE \"Lan\" = 'ES';
                       """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Name\"" ;
            rr:language "spanish"
        ] ;
        rr:predicate rdfs:label
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/{\"Code\"}"
    ] .
D016-1table1primarykey10columns3rowsSQLdatatypes-a223637
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/>

Create View TriplesMap1 As
  Construct {
    ?s
      rdf:type foaf:Person ;
      ex:id ?id ;
      ex:firstName ?fn ;
      ex:lastName ?ln ;
      ex:gender ?sex
  }
  With
    ?s = uri(concat("http://example.com/Patient/", ?ID))
    ?id = typedLiteral(?ID, xsd:integer)
    ?fn = plainLiteral(?FirstName)
    ?ln = plainLiteral(?LastName)
    ?sex = plainLiteral(?Sex)
  From
    Patient
@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\""; ]
    ];

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Patient\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"Sex\""
        ] ;
        rr:predicate ex:gender
    ], [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ], [
        rr:objectMap [
            rr:column "\"FirstName\""
        ] ;
        rr:predicate ex:firstName
    ], [
        rr:objectMap [
            rr:column "\"LastName\""
        ] ;
        rr:predicate ex:lastName
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Patient/{\"ID\"}"
    ] .
D016-1table1primarykey10columns3rowsSQLdatatypes-b182627
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      rdf:type foaf:Person ;
      ex:weight ?w ;
      ex:height ?h
  }
  With
    ?s = uri(concat("http://example.com/Patient", ?ID))
    ?w = typedLiteral(?Weight, xsd:double)
    ?h = typedLiteral(?Height, xsd:double) 
  From
    Patient
@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\""; ]
    ];

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Patient\""
    ] ;
    rr:predicateObjectMap [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"Weight\""
        ] ;
        rr:predicate ex:weight
    ], [
        rr:objectMap [
            rr:column "\"Height\""
        ] ;
        rr:predicate ex:height
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Patient{\"ID\"}"
    ] .
D016-1table1primarykey10columns3rowsSQLdatatypes-c182627
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      rdf:type foaf:Person ;
      ex:birthdate ?bd ;
      ex:entrancedate ?ed ;
  }
  With
    ?s = uri(concat("http://example.com/Patient", ?ID))
    ?bd = typedLiteral(?BirthDate, xsd:date)
    ?ed = typedLiteral(?EntranceDate, xsd:dateTime)
  From
    Patient
@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\""; ]
    ];

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Patient\""
    ] ;
    rr:predicateObjectMap [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"BirthDate\""
        ] ;
        rr:predicate ex:birthdate
    ], [
        rr:objectMap [
            rr:column "\"EntranceDate\""
        ] ;
        rr:predicate ex:entrancedate
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Patient{\"ID\"}"
    ] .
D016-1table1primarykey10columns3rowsSQLdatatypes-d162122
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      rdf:type foaf:Person ;
      ex:paid ?pia
  }
  With
    ?s = uri(concat("http://example.com/Patient", ?ID))
    ?pia = typedLiteral(?PaidInAdvance, xsd:boolean) 
  From
	Patient
@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\"";  ]
    ];

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Patient\""
    ] ;
    rr:predicateObjectMap [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:column "\"PaidInAdvance\""
        ] ;
        rr:predicate ex:paid
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Patient{\"ID\"}"
    ] .
D016-1table1primarykey10columns3rowsSQLdatatypes-e162122
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/> .

Create View TriplesMap1 As
  Construct {
    ?s
      rdf:type foaf:Person ;
      ex:photo ?o
  }
  With
    ?s = uri(concat("http://example.com/Patient", ?ID))
    ?o = uri(concat("data:image/png;hex,", ?Photo))
  From
    Patient
@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\"}"; ];
    ];

    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Patient\""
    ] ;
    rr:predicateObjectMap [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ], [
        rr:objectMap [
            rr:template "data:image/png;hex,{\"Photo\"}"
        ] ;
        rr:predicate ex:photo
    ] ;
    rr:subjectMap [
        rr:template "http://example.com/Patient{\"ID\"}"
    ] .
D018-1table1primarykey2columns3rows-a182125
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/> .

Prefix spy: <http://aksw.org/sparqlify/>

Create View TriplesMap1 As
  Construct {
    ?s
      a foaf:Person ;
      ex:id ?id ;
      foaf:name ?n
  }
  With
    ?s = uri(concat("http://example.com/", ?ID))
    ?id = typedLiteral(?ID, xsd:integer)
    
    // TODO Automatically add the rightPad expression on char datatype
    // on effective view generation step
    ?n = plainLiteral(spy:rightPad(?Name, 15))
  From
    Student
@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\"" ]
    ]
    .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"ID\""
        ] ;
        rr:predicate ex:id
    ], [
        rr:objectMap [
            rr:column "\"Name\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:class foaf:Person ;
        rr:template "http://example.com/{\"ID\"}"
    ] .
D019-1table1primarykey3columns3rows-a292123
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 base: <http://example.com/base/>

Create View TriplesMap1 As
  Construct {
    ?s foaf:name ?o
  }
  With
    ?s = uri(?FirstName)
    ?o = plainLiteral(?FirstName)
  From [[ 
                       SELECT "ID", "FirstName", "LastName" 
                       FROM "Employee"
                       WHERE "ID" < 30 AND "FirstName" LIKE '%://%'
  ]]


/**
 * IMHO the concept of magically prepending non-URI cell values with a base URI when generating URIs
 * is somewhat flawed, but oh well ...
 * 
 * TODO Implementation wise this is no problem: just add
 * "(NOT) LIKE '%://%'" to every SQL selection
 * 
 * 
 *
 */
Create View TriplesMap1_ex As
  Construct {
    ?s foaf:name ?o
  }
  With
    ?s = uri(concat("http://example.com/base/", ?FirstName))
    ?o = plainLiteral(?FirstName)
  From [[ 
                       SELECT "ID", "FirstName", "LastName" 
                       FROM "Employee"
                       WHERE "ID" < 30 AND "FirstName" NOT LIKE '%://%'
  ]]
@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\"" ];
    ];
.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:sqlQuery """
                       SELECT \"ID\", \"FirstName\", \"LastName\" 
                       FROM \"Employee\"
                       WHERE \"ID\" < 30
                       """
    ] ;
    rr:predicateObjectMap [
        rr:objectMap [
            rr:column "\"FirstName\""
        ] ;
        rr:predicate foaf:name
    ] ;
    rr:subjectMap [
        rr:column "\"FirstName\""
    ] .
D020-1table1column5rows-a141618
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/> .

Prefix spy: <http://aksw.org/sparqlify/>

Create View TriplesMap1_ex As
  Construct {
    ?s rdf:type foaf:Person
  }
  With
    ?s = uri("http://example.com/base/", spy:urlEncode(?Name))
  From
    Student 
    
@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;
    ];
.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .

<http://example.com/base/TriplesMap1>
    a rr:TriplesMap ;
    rr:logicalTable [
        rr:tableName "\"Student\""
    ] ;
    rr:predicateObjectMap [
        rr:object foaf:Person ;
        rr:predicate rdf:type
    ] ;
    rr:subjectMap [
        rr:template "{\"Name\"}" ;
        rr:termType rr:IRI
    ] .