1 package org.simantics.db.layer0.variable;
3 import java.util.Collection;
5 import org.simantics.databoard.binding.Binding;
6 import org.simantics.db.ReadGraph;
7 import org.simantics.db.WriteGraph;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.db.layer0.exception.NonWritableVariableException;
11 public interface VariableProperties<Key> {
14 * Gets a named property of this variable. A property corresponds to a '#' in URI notation
16 Variable getProperty(ReadGraph graph, Key key) throws DatabaseException;
17 Variable getPossibleProperty(ReadGraph graph, Key key) throws DatabaseException;
19 Collection<Variable> getProperties(ReadGraph graph, Key key) throws DatabaseException;
22 * Convenience method for getting the value of a named property.
24 <T> T getPropertyValue(ReadGraph graph, Key key) throws DatabaseException;
25 <T> T getPossiblePropertyValue(ReadGraph graph, Key key) throws DatabaseException;
27 * Convenience method for getting the value of a named property.
29 <T> T getPropertyValue(ReadGraph graph, Key key, Binding binding) throws DatabaseException;
30 <T> T getPossiblePropertyValue(ReadGraph graph, Key key, Binding binding) throws DatabaseException;
33 * Writes a value to the given property using the given binding.
35 * @throws NonWritableVariableException if the variable is not writable
36 * @throws DatabaseException in any other error conditions
38 void setPropertyValue(WriteGraph graph, Key key, Object value, Binding binding) throws DatabaseException;
40 * Writes a value to the given property using the default binding based on
43 * @throws NonWritableVariableException if the variable is not writable
44 * @throws DatabaseException in any other error conditions
46 void setPropertyValue(WriteGraph graph, Key key, Object value) throws DatabaseException;