class DatabaseMetadataService {

    @GET
    @Produces( MediaType.APPLICATION_JSON )
    public Response getRelationshipTypes( @QueryParam( "in_use" ) @DefaultValue( "true" ) boolean inUse )
    {
        try
        {
            GraphDatabaseAPI db = database.getGraph();
            Iterable<RelationshipType> relationshipTypes = inUse
                                                           ? db.getAllRelationshipTypesInUse()
                                                           : db.getAllRelationshipTypes();
            return Response.ok()
                    .type( MediaType.APPLICATION_JSON )
                    .entity( generateJsonRepresentation( relationshipTypes ) )
                    .build();
        }
        finally
        {
            representationWriteHandler.onRepresentationFinal();
        }
    }

    public  DatabaseMetadataService( @Context Database database );

}