Fedora 4

The current development focus of the Fedora Commons digital repository software is a new version with new re-engineered internals.

REST & RDF Triples

A big change between Fedora 2.7.x and Fedora 4.0 is the introduction of a more stable and complete REST web services for Create Read Update Delete operations on Fedora Objects.

Source: https://wiki.duraspace.org/display/FF/Documentation

Example REST Calls

Fedora 4's primary method for application access and interation is through a RESTful HTTP API that uses HTTP methods like GET, POST, PUT, PATCH, and DELETE. The RESTful HTTP API also uses content negotiation for delivering RDF/XML, N-Triples, JSON-LD, plain text, and Turtle serializations to requesting applications.

Retrieve all triples for the resource

    $ wget -H "Accept: text/turtle" "http://localhost:8080/rest/path/to/resource"
Code Example
    >> import rdflib
    >> base_repo_graph = rdflib.Graph().parse("http://localhost:8080/rest/")

Creating a Fedora Object

Creating a Fedora Object can be accomplished through either POST or PUT REST API calls.

    $ wget -X POST "http://localhost:8080/rest/"
    $ curl -X POST -H "Content-Type: text/turtle" --data-binary "@body.rdf" "http://localhost:8080/rest/"
    Request Body:
    PREFIX dc: 
    <> dc:title "some-resource-title"
Code Example
     >> import urlib.request
     >> new_object_request = urllib.request.Request('http://localhost:8080/rest/', method='POST') 
     >> response = urllib.request.urlopen(new_object_request)
     >> print(response.read())
     >> new_book_uri = rdflib.URIRef('http://localhost:8080/rest/schema/Book/a2346')
     >> new_book = rdflib.Graph()
     >> new_book.add((new_book_uri, rdflib.RDFS.label, rdflib.Literal('This is a Test Label')))
     >> new_book_request = urllib.request.Request('http://localhost:8080/rest/schema/Book/a2346',
     ..     method='PUT', data=new_book.serialize(format='turtle'), headers={'Content-type': 'text/turtle'})
     >> response2 = urllib.request.urlopen(new_book_request)
     >> print(response2.read())

SPARQL Endpoint

Fedora 4 has a restriced SPARQL endpoint with a limited subset of SPARQL/Select for fielded searching.