1
0

03.mapping.ttl 746 B

1234567891011121314151617181920212223242526272829303132
  1. @prefix rr: <http://www.w3.org/ns/r2rml#> .
  2. @prefix ex: <http://example.com/ns#> .
  3. <#TriplesMap1>
  4. rr:logicalTable [ rr:tableName "EMP" ];
  5. rr:subjectMap [
  6. rr:template "http://data.example.com/employee/{EMPNO}";
  7. ];
  8. rr:predicateObjectMap [
  9. rr:predicate ex:department;
  10. rr:objectMap [
  11. rr:parentTriplesMap <#TriplesMap2>;
  12. rr:joinCondition [
  13. rr:child "DEPTNO";
  14. rr:parent "DEPTNO";
  15. ];
  16. ];
  17. ].
  18. <#TriplesMap2>
  19. rr:logicalTable <#DeptTableView>;
  20. rr:subjectMap [
  21. rr:template "http://data.example.com/department/{DEPTNO}";
  22. ].
  23. <#DeptTableView> rr:sqlQuery """
  24. SELECT DEPTNO,
  25. DNAME,
  26. LOC,
  27. (SELECT COUNT(*) FROM EMP WHERE EMP.DEPTNO=DEPT.DEPTNO) AS STAFF
  28. FROM DEPT
  29. """.