mapping.ttl 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. @base <http://data.example.com/> .
  2. @prefix rr: <http://www.w3.org/ns/r2rml#> .
  3. @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
  4. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
  5. @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
  6. @prefix prov: <http://www.w3.org/ns/prov#> .
  7. @prefix owl: <http://www.w3.org/2002/07/owl#> .
  8. @prefix foaf: <http://xmlns.com/foaf/0.1/> .
  9. @prefix dcterms: <http://purl.org/dc/terms/> .
  10. @prefix ont: <http://adaptcentre.ie/consent/voc.owl#> .
  11. <#PurposeTM>
  12. rr:logicalTable [ rr:tableName "Purpose" ] ;
  13. rr:subjectMap [
  14. rr:template "http://data.example.com/purpose/{id}" ;
  15. rr:class ont:Puropose ;
  16. rr:class prov:Entity ;
  17. ] ;
  18. rr:predicateObjectMap [
  19. rr:predicate rdfs:label ;
  20. rr:objectMap [ rr:column "description" ] ;
  21. ] .
  22. <#UserTM>
  23. rr:logicalTable [ rr:tableName "User" ] ;
  24. rr:subjectMap [
  25. rr:template "http://data.example.com/user/{id}" ;
  26. rr:class ont:Consenting_Party ;
  27. rr:class prov:Agent ;
  28. ] ;
  29. rr:predicateObjectMap [
  30. rr:predicate foaf:mbox ;
  31. rr:objectMap [ rr:template "mailto:{email}" ; rr:termType rr:IRI ; ] ;
  32. ] .
  33. <#PolicyTM>
  34. rr:logicalTable [ rr:sqlQuery "SELECT *, DATE_FORMAT(dateGenerated, '%Y-%m-%dT%H:%i:%s') AS dateGenerated FROM Policy WHERE isPublished" ] ;
  35. rr:subjectMap [
  36. rr:template "http://data.example.com/policy/{id}" ;
  37. rr:class ont:Policy ;
  38. rr:class prov:Entity ;
  39. ] ;
  40. rr:predicateObjectMap [
  41. rr:predicate rdfs:label ;
  42. rr:objectMap [ rr:template "Policy of {system} (v{version})" ; rr:termType rr:Literal ; ] ;
  43. ] ;
  44. rr:predicateObjectMap [
  45. rr:predicate prov:wasRevisionOf ;
  46. rr:objectMap [ rr:template "http://data.example.com/policy/{oldVersion_id}" ; rr:termType rr:IRI ; ] ;
  47. ] ;
  48. rr:predicateObjectMap [
  49. rr:predicate dcterms:created ;
  50. rr:objectMap [ rr:column "dateGenerated" ; rr:datatype xsd:dateTime ; ] ;
  51. ] .
  52. <#InclusionTM>
  53. rr:logicalTable [ rr:sqlQuery "SELECT i.* FROM Inclusion i INNER JOIN Policy p ON i.policy_id = p.id WHERE p.isPublished" ] ;
  54. rr:subjectMap [
  55. rr:template "http://data.example.com/inclusion/{id}" ;
  56. rr:class ont:Inclusion ;
  57. ] ;
  58. rr:predicateObjectMap [
  59. rr:predicate ont:ofPolicy ;
  60. rr:objectMap [ rr:template "http://data.example.com/policy/{policy_id}" ; rr:termType rr:IRI ; ] ;
  61. ] ;
  62. rr:predicateObjectMap [
  63. rr:predicate ont:ofPurpose ;
  64. rr:objectMap [ rr:template "http://data.example.com/purpose/{purpose_id}" ; rr:termType rr:IRI ; ] ;
  65. ] .
  66. <#ConsentTM>
  67. rr:logicalTable [ rr:sqlQuery """SELECT *,
  68. DATE_FORMAT(registeredOn, '%Y-%m-%dT%H:%i:%s') AS registeredOn,
  69. DATE_FORMAT(validUntil, '%Y-%m-%dT%H:%i:%s') AS validUntil,
  70. (status = 0) AS isGiven FROM Consent""" ] ;
  71. rr:subjectMap [
  72. rr:template "http://data.example.com/consent/{id}" ;
  73. rr:class ont:Consent ;
  74. rr:class prov:Entity ;
  75. ] ;
  76. rr:predicateObjectMap [
  77. rr:predicate ont:registeredOn ;
  78. rr:objectMap [ rr:column "registeredOn" ; rr:datatype xsd:dateTime ; ] ;
  79. ] ;
  80. rr:predicateObjectMap [
  81. rr:predicate ont:validUntil ;
  82. rr:objectMap [ rr:column "validUntil" ; rr:datatype xsd:dateTime ; ] ;
  83. ] ;
  84. rr:predicateObjectMap [
  85. rr:predicate ont:givenBy ;
  86. rr:predicate prov:wasAttributedTo ;
  87. rr:objectMap [ rr:template "http://data.example.com/user/{user_id}" ; rr:termType rr:IRI ; ] ;
  88. ] ;
  89. rr:predicateObjectMap [
  90. rr:predicate ont:forInclusion ;
  91. rr:objectMap [ rr:template "http://data.example.com/inclusion/{inclusion_id}" ; rr:termType rr:IRI ; ] ;
  92. ] ;
  93. rr:predicateObjectMap [
  94. rr:predicate prov:wasRevisionOf ;
  95. rr:objectMap [ rr:template "http://data.example.com/consent/{oldVersion_id}" ; rr:termType rr:IRI ; ] ;
  96. ] ;
  97. rr:predicateObjectMap [
  98. rr:predicate ont:isGiven ;
  99. rr:objectMap [ rr:column "isGiven" ; rr:datatype xsd:boolean ; ] ;
  100. ] .