Old Release

This documentation covers an old version of Fedora. Looking for another version? See all documentation.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This page provides detailed steps for creating repository content via the REST API, and SPARQL queries to demonstrate that content in the triplestore.  Much more information about the REST API is available at: REST API and Another Take on the REST API.

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:
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":
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:
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" }
  • No labels