20.12. Relationship properties

Update relationship properties

Figure 20.45. Starting Graph

Figure 20.46. Final Graph

Example request

  • PUT http://localhost:7474/db/data/relationship/224/properties
  • Accept: application/json; charset=UTF-8
  • Content-Type: application/json
{
  "jim" : "tobias"
}

Example response

  • 204: No Content

Remove properties from a relationship

Figure 20.47. Starting Graph

Figure 20.48. Final Graph

Example request

  • DELETE http://localhost:7474/db/data/relationship/20/properties
  • Accept: application/json; charset=UTF-8

Example response

  • 204: No Content

Remove property from a relationship

See the example request below.

Figure 20.49. Starting Graph

Figure 20.50. Final Graph

Example request

  • DELETE http://localhost:7474/db/data/relationship/23/properties/cost
  • Accept: application/json; charset=UTF-8

Example response

  • 204: No Content

Remove non-existent property from a relationship

Attempting to remove a property that doesn’t exist results in an error.

Figure 20.51. Starting Graph

Example request

  • DELETE http://localhost:7474/db/data/relationship/21/properties/non-existent
  • Accept: application/json; charset=UTF-8

Example response

  • 404: Not Found
  • Content-Type: application/json; charset=UTF-8
{
  "message": "(92)-[LOVES,21]-\u003e(93) does not have a property \"non-existent\"",
  "exception": "NoSuchPropertyException",
  "fullname": "org.neo4j.server.rest.web.NoSuchPropertyException",
  "stackTrace": [
    "org.neo4j.server.rest.web.DatabaseActions.removeRelationshipProperty(DatabaseActions.java:661)",
    "org.neo4j.server.rest.web.RestfulGraphDatabase.deleteRelationshipProperty(RestfulGraphDatabase.java:812)",
    "java.lang.reflect.Method.invoke(Method.java:497)",
    "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:145)",
    "org.neo4j.server.rest.dbms.AuthorizationDisabledFilter.doFilter(AuthorizationDisabledFilter.java:48)",
    "org.neo4j.server.rest.web.CollectUserAgentFilter.doFilter(CollectUserAgentFilter.java:69)",
    "java.lang.Thread.run(Thread.java:745)"
  ],
  "errors": [
    {
      "code": "Neo.ClientError.Statement.PropertyNotFound",
      "message": "(92)-[LOVES,21]-\u003e(93) does not have a property \"non-existent\""
    }
  ]
}

Remove properties from a non-existing relationship

Attempting to remove all properties from a relationship which doesn’t exist results in an error.

Example request

  • DELETE http://localhost:7474/db/data/relationship/1234/properties
  • Accept: application/json; charset=UTF-8

Example response

  • 404: Not Found
  • Content-Type: application/json; charset=UTF-8
{
  "message": "org.neo4j.graphdb.NotFoundException: Relationship 1234 not found",
  "exception": "RelationshipNotFoundException",
  "fullname": "org.neo4j.server.rest.web.RelationshipNotFoundException",
  "stackTrace": [
    "org.neo4j.server.rest.web.DatabaseActions.relationship(DatabaseActions.java:179)",
    "org.neo4j.server.rest.web.DatabaseActions.removeAllRelationshipProperties(DatabaseActions.java:651)",
    "org.neo4j.server.rest.web.RestfulGraphDatabase.deleteAllRelationshipProperties(RestfulGraphDatabase.java:792)",
    "java.lang.reflect.Method.invoke(Method.java:497)",
    "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:145)",
    "org.neo4j.server.rest.dbms.AuthorizationDisabledFilter.doFilter(AuthorizationDisabledFilter.java:48)",
    "org.neo4j.server.rest.web.CollectUserAgentFilter.doFilter(CollectUserAgentFilter.java:69)",
    "java.lang.Thread.run(Thread.java:745)"
  ],
  "cause": {
    "exception": "NotFoundException",
    "cause": {
      "exception": "EntityNotFoundException",
      "fullname": "org.neo4j.kernel.api.exceptions.EntityNotFoundException",
      "stackTrace": [
        "org.neo4j.kernel.impl.api.store.DiskLayer.relationshipVisit(DiskLayer.java:432)",
        "org.neo4j.kernel.impl.api.store.CacheLayer.relationshipVisit(CacheLayer.java:326)",
        "org.neo4j.kernel.impl.api.StateHandlingStatementOperations.relationshipVisit(StateHandlingStatementOperations.java:1409)",
        "org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.relationshipVisit(ConstraintEnforcingEntityOperations.java:416)",
        "org.neo4j.kernel.impl.api.OperationsFacade.relationshipVisit(OperationsFacade.java:493)",
        "org.neo4j.kernel.impl.factory.GraphDatabaseFacade.getRelationshipById(GraphDatabaseFacade.java:300)",
        "org.neo4j.server.rest.web.DatabaseActions.relationship(DatabaseActions.java:175)",
        "org.neo4j.server.rest.web.DatabaseActions.removeAllRelationshipProperties(DatabaseActions.java:651)",
        "org.neo4j.server.rest.web.RestfulGraphDatabase.deleteAllRelationshipProperties(RestfulGraphDatabase.java:792)",
        "java.lang.reflect.Method.invoke(Method.java:497)",
        "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:145)",
        "org.neo4j.server.rest.dbms.AuthorizationDisabledFilter.doFilter(AuthorizationDisabledFilter.java:48)",
        "org.neo4j.server.rest.web.CollectUserAgentFilter.doFilter(CollectUserAgentFilter.java:69)",
        "java.lang.Thread.run(Thread.java:745)"
      ],
      "message": "Unable to load RELATIONSHIP with id 1234.",
      "errors": [
        {
          "code": "Neo.ClientError.Statement.EntityNotFound",
          "message": "Unable to load RELATIONSHIP with id 1234."
        }
      ]
    },
    "fullname": "org.neo4j.graphdb.NotFoundException",
    "stackTrace": [
      "org.neo4j.kernel.impl.factory.GraphDatabaseFacade.getRelationshipById(GraphDatabaseFacade.java:305)",
      "org.neo4j.server.rest.web.DatabaseActions.relationship(DatabaseActions.java:175)",
      "org.neo4j.server.rest.web.DatabaseActions.removeAllRelationshipProperties(DatabaseActions.java:651)",
      "org.neo4j.server.rest.web.RestfulGraphDatabase.deleteAllRelationshipProperties(RestfulGraphDatabase.java:792)",
      "java.lang.reflect.Method.invoke(Method.java:497)",
      "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:145)",
      "org.neo4j.server.rest.dbms.AuthorizationDisabledFilter.doFilter(AuthorizationDisabledFilter.java:48)",
      "org.neo4j.server.rest.web.CollectUserAgentFilter.doFilter(CollectUserAgentFilter.java:69)",
      "java.lang.Thread.run(Thread.java:745)"
    ],
    "message": "Relationship 1234 not found",
    "errors": [
      {
        "code": "Neo.ClientError.Statement.EntityNotFound",
        "message": "Relationship 1234 not found"
      }
    ]
  },
  "errors": [
    {
      "code": "Neo.ClientError.Statement.EntityNotFound",
      "message": "org.neo4j.graphdb.NotFoundException: Relationship 1234 not found"
    }
  ]
}

Remove property from a non-existing relationship

Attempting to remove a property from a relationship which doesn’t exist results in an error.

Example request

  • DELETE http://localhost:7474/db/data/relationship/1234/properties/cost
  • Accept: application/json; charset=UTF-8

Example response

  • 404: Not Found
  • Content-Type: application/json; charset=UTF-8
{
  "message": "org.neo4j.graphdb.NotFoundException: Relationship 1234 not found",
  "exception": "RelationshipNotFoundException",
  "fullname": "org.neo4j.server.rest.web.RelationshipNotFoundException",
  "stackTrace": [
    "org.neo4j.server.rest.web.DatabaseActions.relationship(DatabaseActions.java:179)",
    "org.neo4j.server.rest.web.DatabaseActions.removeRelationshipProperty(DatabaseActions.java:657)",
    "org.neo4j.server.rest.web.RestfulGraphDatabase.deleteRelationshipProperty(RestfulGraphDatabase.java:812)",
    "java.lang.reflect.Method.invoke(Method.java:497)",
    "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:145)",
    "org.neo4j.server.rest.dbms.AuthorizationDisabledFilter.doFilter(AuthorizationDisabledFilter.java:48)",
    "org.neo4j.server.rest.web.CollectUserAgentFilter.doFilter(CollectUserAgentFilter.java:69)",
    "java.lang.Thread.run(Thread.java:745)"
  ],
  "cause": {
    "exception": "NotFoundException",
    "cause": {
      "exception": "EntityNotFoundException",
      "fullname": "org.neo4j.kernel.api.exceptions.EntityNotFoundException",
      "stackTrace": [
        "org.neo4j.kernel.impl.api.store.DiskLayer.relationshipVisit(DiskLayer.java:432)",
        "org.neo4j.kernel.impl.api.store.CacheLayer.relationshipVisit(CacheLayer.java:326)",
        "org.neo4j.kernel.impl.api.StateHandlingStatementOperations.relationshipVisit(StateHandlingStatementOperations.java:1409)",
        "org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.relationshipVisit(ConstraintEnforcingEntityOperations.java:416)",
        "org.neo4j.kernel.impl.api.OperationsFacade.relationshipVisit(OperationsFacade.java:493)",
        "org.neo4j.kernel.impl.factory.GraphDatabaseFacade.getRelationshipById(GraphDatabaseFacade.java:300)",
        "org.neo4j.server.rest.web.DatabaseActions.relationship(DatabaseActions.java:175)",
        "org.neo4j.server.rest.web.DatabaseActions.removeRelationshipProperty(DatabaseActions.java:657)",
        "org.neo4j.server.rest.web.RestfulGraphDatabase.deleteRelationshipProperty(RestfulGraphDatabase.java:812)",
        "java.lang.reflect.Method.invoke(Method.java:497)",
        "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:145)",
        "org.neo4j.server.rest.dbms.AuthorizationDisabledFilter.doFilter(AuthorizationDisabledFilter.java:48)",
        "org.neo4j.server.rest.web.CollectUserAgentFilter.doFilter(CollectUserAgentFilter.java:69)",
        "java.lang.Thread.run(Thread.java:745)"
      ],
      "message": "Unable to load RELATIONSHIP with id 1234.",
      "errors": [
        {
          "code": "Neo.ClientError.Statement.EntityNotFound",
          "message": "Unable to load RELATIONSHIP with id 1234."
        }
      ]
    },
    "fullname": "org.neo4j.graphdb.NotFoundException",
    "stackTrace": [
      "org.neo4j.kernel.impl.factory.GraphDatabaseFacade.getRelationshipById(GraphDatabaseFacade.java:305)",
      "org.neo4j.server.rest.web.DatabaseActions.relationship(DatabaseActions.java:175)",
      "org.neo4j.server.rest.web.DatabaseActions.removeRelationshipProperty(DatabaseActions.java:657)",
      "org.neo4j.server.rest.web.RestfulGraphDatabase.deleteRelationshipProperty(RestfulGraphDatabase.java:812)",
      "java.lang.reflect.Method.invoke(Method.java:497)",
      "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:145)",
      "org.neo4j.server.rest.dbms.AuthorizationDisabledFilter.doFilter(AuthorizationDisabledFilter.java:48)",
      "org.neo4j.server.rest.web.CollectUserAgentFilter.doFilter(CollectUserAgentFilter.java:69)",
      "java.lang.Thread.run(Thread.java:745)"
    ],
    "message": "Relationship 1234 not found",
    "errors": [
      {
        "code": "Neo.ClientError.Statement.EntityNotFound",
        "message": "Relationship 1234 not found"
      }
    ]
  },
  "errors": [
    {
      "code": "Neo.ClientError.Statement.EntityNotFound",
      "message": "org.neo4j.graphdb.NotFoundException: Relationship 1234 not found"
    }
  ]
}