org.fcrepo.server.rest
Class RelationshipResource

java.lang.Object
  extended by org.fcrepo.server.rest.BaseRestResource
      extended by org.fcrepo.server.rest.RelationshipResource

public class RelationshipResource
extends BaseRestResource

A rest controller to handle CRUD operations for the Fedora relationships API.

Since:
3.4.0
Version:
$Id$
Author:
Edwin Shin

Field Summary
 
Fields inherited from class org.fcrepo.server.rest.BaseRestResource
apiAService, apiMService, datastreamFilenameHelper, fedoraServer, fedoraServerHost, FORM, headers, HTML, mapper, servletRequest, TEXT_HTML, TEXT_XML, uriInfo, XML, ZIP
 
Constructor Summary
RelationshipResource()
           
 
Method Summary
 javax.ws.rs.core.Response addRelationship(String pid, String subject, String predicate, String object, boolean isLiteral, String datatype)
          Add a relationship.
 javax.ws.rs.core.Response getRelationships(String pid, String subject, String predicate, String format)
          Get relationships asserted by the object denoted by pid.
 javax.ws.rs.core.Response purgeRelationship(String pid, String subject, String predicate, String object, boolean isLiteral, String datatype)
          Delete a relationship.
 
Methods inherited from class org.fcrepo.server.rest.BaseRestResource
buildResponse, getContext, getSerializer, handleException, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationshipResource

public RelationshipResource()
Method Detail

getRelationships

public javax.ws.rs.core.Response getRelationships(String pid,
                                                  String subject,
                                                  String predicate,
                                                  String format)
Get relationships asserted by the object denoted by pid.

Parameters:
pid - The pid of the Fedora object, e.g. demo:1.
subject - The subject uri. If null, defaults to the URI form of pid, e.g. info:fedora/demo:1.
predicate - The predicate uri or null to match any predicate.
format - one of "rdf/xml", "n-triples", "turtle", or "sparql". If null, defaults to rdf/xml.
Returns:
the relationships in the specified format.

addRelationship

public javax.ws.rs.core.Response addRelationship(String pid,
                                                 String subject,
                                                 String predicate,
                                                 String object,
                                                 boolean isLiteral,
                                                 String datatype)
Add a relationship.

POST /objects/{pid}/relationships/new ? subject predicate object isLiteral datatype

Successful Response: Status: 200 OK


purgeRelationship

public javax.ws.rs.core.Response purgeRelationship(String pid,
                                                   String subject,
                                                   String predicate,
                                                   String object,
                                                   boolean isLiteral,
                                                   String datatype)
Delete a relationship.

DELETE /objects/{pid}/relationships ? subject predicate object isLiteral datatype

Successful Response: Status: 200 OK



Copyright © 2011 DuraSpace. All Rights Reserved.