-package org.simantics.db.layer0.variable;\r
-\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.databoard.type.Datatype;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.exception.NoSingleResultException;\r
-import org.simantics.db.layer0.exception.MissingVariableValueException;\r
-import org.simantics.db.layer0.exception.VariableException;\r
-\r
-public class StandardGraphResourcePropertyVariable extends StandardGraphPropertyVariable {\r
- \r
- public StandardGraphResourcePropertyVariable(ReadGraph graph, Variable parent, Resource parentResource, Resource property) throws DatabaseException {\r
- super(graph, parent, null, parentResource, property);\r
- }\r
-\r
- @Override\r
- public <T> T getValue(ReadGraph graph) throws DatabaseException {\r
- if (parentResource == null)\r
- throw new VariableException("Variable is not represented by any resource (URI=" + getPossibleURI(graph) + ").");\r
- try {\r
- return (T)graph.getSingleObject(parentResource, property.predicate);\r
- } catch (NoSingleResultException e) {\r
- System.err.println("No object for " + parentResource + " " + property);\r
- throw new MissingVariableValueException(getPossibleURI(graph));\r
- } \r
- }\r
-\r
- @Override\r
- public <T> T getValue(ReadGraph graph, Binding binding) throws DatabaseException {\r
- if (parentResource == null)\r
- throw new VariableException("Variable is not represented by any resource (URI=" + getPossibleURI(graph) + ").");\r
- try {\r
- return (T)graph.getSingleObject(parentResource, property.predicate);\r
- } catch (NoSingleResultException e) {\r
- System.err.println("No object for " + parentResource + " " + property);\r
- throw new MissingVariableValueException(getPossibleURI(graph));\r
- } \r
- }\r
- \r
- @Override\r
- public Datatype getDatatype(ReadGraph graph) throws DatabaseException {\r
- return null;\r
- }\r
- \r
-}\r
+package org.simantics.db.layer0.variable;
+
+import org.simantics.databoard.binding.Binding;
+import org.simantics.databoard.type.Datatype;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.exception.NoSingleResultException;
+import org.simantics.db.layer0.exception.MissingVariableValueException;
+import org.simantics.db.layer0.exception.VariableException;
+
+public class StandardGraphResourcePropertyVariable extends StandardGraphPropertyVariable {
+
+ public StandardGraphResourcePropertyVariable(ReadGraph graph, Variable parent, Resource parentResource, Resource property) throws DatabaseException {
+ super(graph, parent, null, parentResource, property);
+ }
+
+ @Override
+ public <T> T getValue(ReadGraph graph) throws DatabaseException {
+ if (parentResource == null)
+ throw new VariableException("Variable is not represented by any resource (URI=" + getPossibleURI(graph) + ").");
+ try {
+ return (T)graph.getSingleObject(parentResource, property.predicate);
+ } catch (NoSingleResultException e) {
+ System.err.println("No object for " + parentResource + " " + property);
+ throw new MissingVariableValueException(getPossibleURI(graph));
+ }
+ }
+
+ @Override
+ public <T> T getValue(ReadGraph graph, Binding binding) throws DatabaseException {
+ if (parentResource == null)
+ throw new VariableException("Variable is not represented by any resource (URI=" + getPossibleURI(graph) + ").");
+ try {
+ return (T)graph.getSingleObject(parentResource, property.predicate);
+ } catch (NoSingleResultException e) {
+ System.err.println("No object for " + parentResource + " " + property);
+ throw new MissingVariableValueException(getPossibleURI(graph));
+ }
+ }
+
+ @Override
+ public Datatype getDatatype(ReadGraph graph) throws DatabaseException {
+ return null;
+ }
+
+}