...
Finding Objects by Datastream Name or MIME Type
Create a few sample objects with either a PDF or a text file, or both attached as datastreams:
Code Block |
---|
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 |
Find objects with a datastream named "text":
Code Block |
---|
prefix fcrepo: <http://fedora.info/definitions/v4/repository#> select ?object where { ?ds fcrepo:mixinTypes "fedora:datastream" . ?ds fcrepo:hasParent ?object . filter(str(?ds)=str(?object)+'/text') } |
Find objects with a PDF datastream:
Code Block |
---|
prefix fcrepo: <http://fedora.info/definitions/v4/repository#> select ?object where { ?ds fcrepo:mixinTypes "fedora:datastream" . ?ds fcrepo:hasParent ?object . ?ds fcrepo:hasContent ?content . ?content fcrepo:mimeType "application/pdf" } |