graph_per_resource+.trig 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. # Resource-centric layout. This separates resources into separate named
  2. # graphs and follows the graph-per-resource pattern
  3. # (http://patterns.dataincubator.org/book/graph-per-resource.html). This aligns
  4. # quite well with the resource-centrism of LDP and of the SPARQL Graph Store
  5. # Protocol (https://www.w3.org/TR/sparql11-http-rdf-update/) which should be
  6. # used by the software implementation to minimize data structure translation.
  7. #
  8. # A graph identified by the resource UID is the current state of that resource.
  9. # Other resources (graphs) can be present representing various previous states
  10. # of the resource and are identified by the resource UUID with a `:` (colon)
  11. # and the version UID appended.
  12. # E.g. a resource with a UID of `a/b/c` will be internally stored within a
  13. # named graph `info:fcstate/a/b/c`; the subject will be `info:fcres/a/b/c`;
  14. # a previous version could be `info:fcstate/a/b/c:version1` and the publicly
  15. # exposed URL could be http://webroot.org/ldp/a/b/c`.
  16. #
  17. # The relationships between resources and thir versions and other metadata not
  18. # meant to be directly exposed by the LDP API are in one "metadata" graph.
  19. PREFIX dc: <http://purl.org/dc/elements/1.1/>
  20. PREFIX fcrepo: <http://fedora.info/definitions/v4/repository#>
  21. PREFIX fcsystem: <info:fcsystem/>
  22. PREFIX foaf: <http://xmlns.com/foaf/0.1/>
  23. PREFIX ldp: <http://www.w3.org/ns/ldp#>
  24. PREFIX ns: <http://example.edu/lakesuperior/ns#>
  25. PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
  26. # System root. It cannot be deleted.
  27. fcsystem:__root__ {
  28. <info:fcres/> a
  29. fcrepo:RepositoryRoot , fcrepo:Resource , fcrepo:Container ,
  30. ldp:Container , ldp:BasicContainer , ldp:RDFSource ;
  31. .
  32. }
  33. # Metadata graphs. Each of these is a "companion" of the content graph.
  34. # All triples that describe the stored resource state go here. Also triples
  35. # used by the application business logic are stored here.
  36. # These are a convenient way to get resource metadata (e.g. with a HEAD
  37. # request) without loading large graphs, e.g. ones with many children
  38. # or many user-provided properties.
  39. <info:fcmeta/a/b/c> {
  40. <info:fcstate/a/b/c> a fcsystem:CurrentState ;
  41. # This may be redundant if we use naming conventions, but still good LD practice.
  42. fcsystem:stateOf <info:fcres/a/b/c> ;
  43. fcsystem:hasVersion
  44. <info:fcstate/a/b/c:v1> , <info:fcstate/a/b/c:v2> , <info:fcstate/a/b/c:v3> ;
  45. .
  46. <info:fcres/a/b/c> a fcrepo:Resource ;
  47. # Timestamps are simplified for readability.
  48. fcrepo:created "2017-11-23"^^xsd:date ;
  49. fcrepo:lastModified "2017-11-27"^^xsd:date ;
  50. }
  51. <info:fcmeta/a/b/c:v1> {
  52. <info:fcstate/a/b/c:v1>
  53. fcsystem:stateOf <info:fcres/a/b/c:v1> ;
  54. fcrepo:created "2017-11-24"^^xsd:date ;
  55. .
  56. <info:fcres/a/b/c:v1> a fcrepo:Version ;
  57. fcrepo:created "2017-11-23"^^xsd:date ;
  58. fcrepo:lastModified "2017-11-23"^^xsd:date ;
  59. .
  60. }
  61. <info:fcmeta/a/b/c:v2> {
  62. <info:fcstate/a/b/c:v2>
  63. fcsystem:stateOf <info:fcres/a/b/c:v2> ;
  64. a fcrepo:Version ;
  65. fcrepo:created "2017-11-25"^^xsd:date ;
  66. .
  67. <info:fcres/a/b/c:v2> a fcrepo:Version ;
  68. fcrepo:created "2017-11-23"^^xsd:date ;
  69. fcrepo:lastModified "2017-11-24"^^xsd:date ;
  70. .
  71. }
  72. <info:fcmeta/a/b/c:v3> {
  73. <info:fcstate/a/b/c:v3>
  74. fcsystem:stateOf <info:fcres/a/b/c:v3> ;
  75. a fcrepo:Version ;
  76. fcrepo:created "2017-11-26"^^xsd:date ;
  77. .
  78. <info:fcres/a/b/c:v3> a fcrepo:Version ;
  79. fcrepo:created "2017-11-23"^^xsd:date ;
  80. fcrepo:lastModified "2017-11-25"^^xsd:date ;
  81. .
  82. }
  83. # Pairtree information not passed to the client but used to mimic
  84. # hierarchical structures.
  85. <info:fcmeta/a> {
  86. <info:fcstate/a>
  87. fcsystem:stateOf <info:fcres/a> ;
  88. .
  89. <info:fcres/a>
  90. a ldp:Container , ldp:BasicContainer , ldp:Resource , ldp:RDFSSource ;
  91. a fcrepo:Pairtree ;
  92. # fcsystem:contains only applies to Pairtrees and is used to mimic path
  93. # hierarchies.
  94. fcsystem:contains <info:fcres/a/b> ;
  95. ldp:contains <info:fcres/a/b/c> ;
  96. .
  97. }
  98. <info:fcmeta/a/b> {
  99. <info:fcstate/a/b>
  100. fcsystem:currentStateOf <info:fcres/a/b> ;
  101. .
  102. <info:fcres/a/b>
  103. a fcrepo:Pairtree ;
  104. fcsystem:contains <info:fcres/a/b/c> ;
  105. .
  106. }
  107. # Resource graph. These statements are user-provided and not used for any
  108. # application business logic.
  109. # Note that "fragments", i.e. hash URIs, are stored within the same graph.
  110. <info:fcstate/a/b/c> {
  111. <info:fcres/a/b/c> a ns:Book ;
  112. fcrepo:hasParent <info:fcres/a> ;
  113. dc:title "Moby Dick" ;
  114. dc:creator "Herman Melville" ;
  115. dc:subject "Fishing" ;
  116. .
  117. <info:fcres/a/b/c#chapter1> a ns:BookChapter ;
  118. dc:title "Loomings." ;
  119. .
  120. <info:fcres/a/b/c#chapter2> a ns:BookChapter ;
  121. dc:title "The Carpet-Bag." ;
  122. .
  123. }
  124. # Previous states (versions) of a resource.
  125. <info:fcstate/a/b/c:v1> {
  126. <info:fcres/a/b/c> a ns:Book ;
  127. fcrepo:hasParent <info:fcres/a> ;
  128. dc:title "Moby Dick" ;
  129. .
  130. }
  131. <info:fcstate/a/b/c:v2> {
  132. <info:fcres/a/b/c> a ns:Book ;
  133. fcrepo:hasParent <info:fcres/a> ;
  134. dc:title "Moby Dick" ;
  135. dc:creator "Herman Melvil" ;
  136. .
  137. }
  138. <info:fcstate/a/b/c:v3> {
  139. <info:fcres/a/b/c> a ns:Book ;
  140. fcrepo:hasParent <info:fcres/a> ;
  141. dc:title "Moby Dick" ;
  142. dc:creator "Herman Melville" ;
  143. .
  144. }