Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Adding recursive query using SPARQL 1.1 syntax (hasPart+)

...

Find objects directly or indirectly attached (down to the third levelrecursive retrieval along the rels:hasPart chain):

Code Block
languagesql
title3f. Select Objects Directly Or Indirectly Linked To A Collection
prefix rels: <http://fedora.info/definitions/v4/rels-ext#>
select ?obj where {
  { ?obj rels:isMemberOfCollection <http://localhost:8080/rest/objects/col1> }
  UNION
  { ?obj rels:isMemberOfCollection ?c .
    <http://localhost:8080/rest/objects/col1> rels:hasPart+ ?c }
  UNION
  { col . ?obj rels:isMemberOfCollection ?c .
    <http://localhost:8080/rest/objects/col1> rels:hasPart ?c1 . ?c1 rels:hasPart ?ccol }
}
Expected Results
obj
<http://localhost:8080/rest/objects/obj1>
<http://localhost:8080/rest/objects/obj2>
<http://localhost:8080/rest/objects/obj3>

...