Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Create a few sample objects with either a PDF or a text file, or both attached as datastreams (these commands assume you have two files named test.pdf and test.txt in your current working directory, please substitute working filenames as needed):

Code Block
languagebash
curl -X POST http://localhost:8080/rest/objects/101?mixin=fedora:object
curl -X POST -H "Content-type: application/pdf" --data-binary @test.pdf \
    http://localhost:8080/rest/objects/101/master/fcr:content
curl -X POST http://localhost:8080/rest/objects/102?mixin=fedora:object
curl -X POST -H "Content-type: text/plain" --data-binary @test.txt \
    http://localhost:8080/rest/objects/102/master/fcr:content
curl -X POST http://localhost:8080/rest/objects/103?mixin=fedora:object
curl -X POST -H "Content-type: application/pdf" --data-binary @test.pdf \
    http://localhost:8080/rest/objects/103/master/fcr:content
curl -X POST -H "Content-type: text/plain" --data-binary @test.txt \
    http://localhost:8080/rest/objects/103/text/fcr:content

...

Code Block
languagesql
prefix fcrepo: <http://fedora.info/definitions/v4/repository#>
select ?object where { ?ds fcrepo:mixinTypes "fedora:datastream" .
    ?ds fcrepo:hasParent ?object . filter(str(?ds)=concat(str(?object)+,'/text')) }

Find objects with a PDF datastream:

...

Code Block
languagesql
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
  { ?obj rels:isMemberOfCollection ?c .
    <http://localhost:8080/rest/objects/col1> rels:hasPart ?c1 . ?c1 rels:hasPart ?c }
}