@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix ex: <http://example.com/ns#> .
@prefix rrf: <http://kdeg.scss.tcd.ie/ns/rrf#>
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<#TriplesMap1>
    rr:logicalTable [ rr:tableName "PERSON" ];

    rr:subjectMap [
        rr:template "http://data.example.com/person/{ID}";
    ];
    
    rr:predicateObjectMap [
        rr:predicate ex:name;
        rr:objectMap [ 
        	rrf:gather (
        		[ rr:column "TITLE" ]
        		[ rr:column "FNAME" ] 
        		[ rr:column "LNAME" ]  
        	) ;
        	rr:termType rdf:Bag ;
        ];
    ]
    
    .
    
 <#TriplesMap2>
    rr:logicalTable [ rr:tableName "PET" ];

    rr:subjectMap [
        rr:template "http://data.example.com/person/{OWNER}";
    ];
    
    rr:predicateObjectMap [
        rr:predicate ex:owns;
        rr:objectMap [ 
        	rr:template "http://data.example.com/pet/{ID}";
        ];
		rr:objectMap [ 
        	rr:column "ID";
        	rrf:collectAs rdf:List ;
        ];
    ];
    
    rr:predicateObjectMap [
        rr:predicate ex:ownsSeqSeperate;
        rr:objectMap [ 
        	rr:template "http://data.example.com/pet/{ID}";
        	rrf:collectAs rdf:Seq ;
        ];
    ] ;
    
	rr:predicateObjectMap [
        rr:predicate ex:ownsBagRefObjectMap;
        rr:objectMap [ 
        	rr:parentTriplesMap <#PET>;
            rr:joinCondition [
                rr:child "ID";
                rr:parent "ID";
            ];
        	rrf:collectAs rdf:Bag ;
        ];
    ]
    
    .
    
 <#PET>
    rr:logicalTable [ rr:tableName "PET" ];

    rr:subjectMap [
        rr:template "http://data.example.com/pet-test/{ID}";
        rr:class ex:Pet ;
    ];
    
    .