01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2007.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.http.protocol.transaction.operations;
07:
08: import org.openrdf.model.Resource;
09: import org.openrdf.model.URI;
10: import org.openrdf.model.Value;
11: import org.openrdf.repository.RepositoryConnection;
12: import org.openrdf.repository.RepositoryException;
13:
14: /**
15: * Operation to add a statement.
16: *
17: * @author Arjohn Kampman
18: */
19: public class AddStatementOperation extends StatementOperation {
20:
21: /**
22: * Create an AddStatementOperation.
23: */
24: public AddStatementOperation(Resource subj, URI pred, Value obj,
25: Resource... contexts) {
26: super (contexts);
27:
28: assert subj != null : "subj must not be null";
29: assert pred != null : "pred must not be null";
30: assert obj != null : "obj must not be null";
31:
32: setSubject(subj);
33: setPredicate(pred);
34: setObject(obj);
35: }
36:
37: public void execute(RepositoryConnection con)
38: throws RepositoryException {
39: con.add(getSubject(), getPredicate(), getObject(),
40: getContexts());
41: }
42:
43: @Override
44: public boolean equals(Object other) {
45: if (other instanceof AddStatementOperation) {
46: return super .equals(other);
47: }
48:
49: return false;
50: }
51: }
|