graph_per_resource.trig 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. # Metadata graph. This is a companion of the content graph.
  27. fcsystem:meta {
  28. <info:fcstate/a/b/c> a fcrepo:Resource ;
  29. # This may be redundant if we use naming conventions, but still good LD practice.
  30. fcsystem:currentStateOf <info:fcres/a/b/c> ;
  31. fcsystem:hasVersion
  32. <info:fcstate/a/b/c:v1> , <info:fcstate/a/b/c:v2> , <info:fcstate/a/b/c:v3> ;
  33. .
  34. <info:fcstate/a/b/c:v1> a fcrepo:Version ;
  35. fcrepo:created "2017-12-24T20:57:51.952535+00:00"^^xsd:dateTime .
  36. <info:fcstate/a/b/c:v2> a fcrepo:Version ;
  37. fcrepo:created "2017-12-25T20:57:51.952535+00:00"^^xsd:dateTime .
  38. <info:fcstate/a/b/c:v3> a fcrepo:Version ;
  39. fcrepo:created "2017-12-26T20:57:51.952535+00:00"^^xsd:dateTime .
  40. # Pairtree information not passed to the client but used to mimic
  41. # hierarchical structures.
  42. <info:fcstate/a>
  43. a fcrepo:Pairtree ;
  44. fcsystem:contains <info:fcres/a/b> ;
  45. .
  46. <info:fcstate/a/b>
  47. a fcrepo:Pairtree ;
  48. fcsystem:contains <info:fcres/a/b/c> ;
  49. .
  50. }
  51. # System root. It cannot be deleted.
  52. fcsystem:root {
  53. fcsystem:root a
  54. fcrepo:RepositoryRoot , fcrepo:Resource , fcrepo:Container ,
  55. ldp:Container , ldp:BasicContainer , ldp:RDFSource ;
  56. .
  57. }
  58. # Resource graph. These statements are returned to the client.
  59. # Note that "fragments" or hash URIs are stored within the same graph.
  60. <info:fcstate/a/b/c> {
  61. <info:fcres/a/b/c> a ns:Book ;
  62. fcrepo:hasParent <info:fcres/a> ;
  63. dc:title "Moby Dick" ;
  64. dc:creator "Herman Melville" ;
  65. dc:subject "Fishing" ;
  66. .
  67. <info:fcres/a/b/c#chapter1> a ns:BookChapter ;
  68. dc:title "Loomings." ;
  69. .
  70. <info:fcres/a/b/c#chapter2> a ns:BookChapter ;
  71. dc:title "The Carpet-Bag." ;
  72. .
  73. }
  74. # Previous states (versions) of a resource.
  75. <info:fcstate/a/b/c:v1> {
  76. <info:fcres/a/b/c> a ns:Book ;
  77. fcrepo:hasParent <info:fcres/a> ;
  78. dc:title "Moby Dick" ;
  79. .
  80. }
  81. <info:fcstate/a/b/c:v2> {
  82. <info:fcres/a/b/c> a ns:Book ;
  83. fcrepo:hasParent <info:fcres/a> ;
  84. dc:title "Moby Dick" ;
  85. dc:creator "Herman Melvil" ;
  86. .
  87. }
  88. <info:fcstate/a/b/c:v3> {
  89. <info:fcres/a/b/c> a ns:Book ;
  90. fcrepo:hasParent <info:fcres/a> ;
  91. dc:title "Moby Dick" ;
  92. dc:creator "Herman Melville" ;
  93. .
  94. }
  95. # Only the direct link to the LDP-contained resource is explicitly asserted.
  96. <info:fcstate/a> {
  97. <info:fcres/a> a ldp:Container , ldp:BasicContainer , ldp:Resource , ldp:RDFSSource ;
  98. ldp:contains <info:fcres/a/b/c> .
  99. }