]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/ReadGraph.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / ReadGraph.java
diff --git a/bundles/org.simantics.db/src/org/simantics/db/ReadGraph.java b/bundles/org.simantics.db/src/org/simantics/db/ReadGraph.java
new file mode 100644 (file)
index 0000000..46c504f
--- /dev/null
@@ -0,0 +1,1074 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.db;\r
+\r
+import java.util.Collection;\r
+import java.util.Set;\r
+\r
+import org.simantics.databoard.accessor.Accessor;\r
+import org.simantics.databoard.binding.Binding;\r
+import org.simantics.databoard.binding.mutable.Variant;\r
+import org.simantics.databoard.type.Datatype;\r
+import org.simantics.databoard.util.binary.RandomAccessBinary;\r
+import org.simantics.db.adaption.Adapter;\r
+import org.simantics.db.exception.AdaptionException;\r
+import org.simantics.db.exception.AssumptionException;\r
+import org.simantics.db.exception.BindingException;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.exception.DoesNotContainValueException;\r
+import org.simantics.db.exception.ManyObjectsForFunctionalRelationException;\r
+import org.simantics.db.exception.NoInverseException;\r
+import org.simantics.db.exception.NoSingleResultException;\r
+import org.simantics.db.exception.ResourceNotFoundException;\r
+import org.simantics.db.exception.ServiceException;\r
+import org.simantics.db.exception.ValidationException;\r
+import org.simantics.db.procedure.SyncListener;\r
+import org.simantics.db.procedure.SyncMultiListener;\r
+import org.simantics.db.procedure.SyncMultiProcedure;\r
+import org.simantics.db.procedure.SyncProcedure;\r
+import org.simantics.db.procedure.SyncSetListener;\r
+import org.simantics.db.request.MultiRead;\r
+import org.simantics.db.request.Read;\r
+import org.simantics.scl.compiler.types.Type;\r
+\r
+/**\r
+ * \r
+ * For accessing and manipulating the graph data in synchronous manner. A client\r
+ * receives ReadGraph instances for performing requests in {@link Read} and\r
+ * {@link MultiRead} as well as for reacting to request results using\r
+ * {@link SyncProcedure}, {@link SyncListener}, {@link SyncMultiProcedure},\r
+ * {@link SyncMultiListener} and {@link SyncSetListener}\r
+ * <p>\r
+ * ReadGraph instances are stateful and may not be stored and used outside the\r
+ * supplier method activation. The methods receiving ReadGraph should not block\r
+ * for long periods of time since that may delay the processing of other\r
+ * requests. For an asynchronous counterpart with the same functionality as\r
+ * ReadGraph see {@link AsyncReadGraph}\r
+ * \r
+ * <p>\r
+ * All collections returned by the methods on this interface must not be\r
+ * modified by clients unless explicitly stated otherwise.\r
+ * \r
+ * @version 0.7\r
+ * @author Antti Villberg\r
+ * @see RequestProcessor\r
+ * @see AsyncRequestProcessor\r
+ * @see AsyncReadGraph\r
+ * @see Resource\r
+ * @see Statement\r
+ * @noimplement\r
+ */\r
+public interface ReadGraph extends AsyncReadGraph, RequestProcessor {\r
+\r
+    /**\r
+     * \r
+     * @see AsyncReadGraph#forURI\r
+     */\r
+    String getURI(Resource resource) throws AssumptionException, ValidationException, ServiceException;\r
+    String getPossibleURI(Resource resource) throws ValidationException, ServiceException;\r
+\r
+    /**\r
+     * Gets a unique resource associated to the given identifier. See <a\r
+     * href="https://www.simantics.org/wiki/index.php/URI">Simantics Wiki page\r
+     * on URIs</a> for more details.\r
+     * \r
+     * @param uri the identifier\r
+     * @return the resource\r
+     * @throws ResourceNotFoundException if a resource for the given identifier\r
+     *         was not specified\r
+     * @throws ValidationException if a resource could not be produced due to\r
+     *         invalid semantics\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forResourceByURI\r
+     */\r
+    Resource getResource(String uri) throws ResourceNotFoundException, ValidationException, ServiceException;\r
+\r
+    /**\r
+     * Gets a unique resource associated to the given identifier. See <a\r
+     * href="https://www.simantics.org/wiki/index.php/URI">Simantics Wiki page\r
+     * on URIs</a> for more details.\r
+     * \r
+     * @param uri the identifier\r
+     * @return the resource\r
+     * @throws ResourceNotFoundException if a resource for the given identifier\r
+     *         was not specified\r
+     * @throws ValidationException if a resource could not be produced due to\r
+     *         invalid semantics\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forResourceByURI\r
+     */\r
+    Resource getPossibleResource(String uri) throws ResourceNotFoundException, ValidationException, ServiceException;\r
+\r
+    /**\r
+     * Gets a builtin resource. For a list of builtin resources see TODO Wiki\r
+     * \r
+     * @param uri the identifier\r
+     * @return the resource\r
+     * @throws ResourceNotFoundException if resouce was not found\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forBuiltin\r
+     */\r
+    Resource getBuiltin(String id) throws ResourceNotFoundException, ServiceException;\r
+\r
+    /**\r
+     * Gets all statements (subject, p, o) such that\r
+     * {@link ReadGraph#isSubrelationOf(p, relation)} returns true. The result\r
+     * may include asserted statements for which s does not equal subject. See\r
+     * the assertion mechanisn TODO for more details. If the relation is\r
+     * functional the request returns a single statement according to the\r
+     * functional statement shadowing rules TODO if possible. If an invalid\r
+     * graph is encountered an exception is thrown.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the statements\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forEachStatement\r
+     * @see AsyncReadGraph#forStatementSet\r
+     */\r
+    Collection<Statement> getStatements(Resource subject, Resource relation)\r
+    throws ManyObjectsForFunctionalRelationException, ServiceException;\r
+\r
+    /**\r
+     * Gets all statements (s, p, o) asserted by subject such that\r
+     * {@link ReadGraph#isSubrelationOf(p, relation)} returns true. See the\r
+     * assertion mechanism TODO for more details. If the relation is functional\r
+     * the request returns a single statement according to the functional\r
+     * statement shadowing rules TODO if possible. If an invalid graph is\r
+     * encountered an exception is thrown.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the statements\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forEachAssertedStatement\r
+     * @see AsyncReadGraph#forAssertedStatementSet\r
+     */\r
+    Collection<Statement> getAssertedStatements(Resource subject, Resource relation)\r
+    throws ManyObjectsForFunctionalRelationException, ServiceException;\r
+\r
+    /**\r
+     * Gets all predicates p from statements (subject, p, o) such that\r
+     * {@link ReadGraph#isSubrelationOf(p, relation)} returns true. See the\r
+     * assertion mechanism TODO for more details. If the relation is functional\r
+     * the request returns a single statement according to the functional\r
+     * statement shadowing rules TODO if possible. If an invalid graph is\r
+     * encountered an exception is thrown.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the predicates\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forEachPredicate\r
+     * @see AsyncReadGraph#forPredicateSet\r
+     */\r
+    Collection<Resource> getPredicates(Resource subject) throws ServiceException;\r
+\r
+    /**\r
+     * Gets a subset of all types of the subject such that no pair of returned\r
+     * types inherit each other and all types of the subject are supertypes\r
+     * of some type in the returned set.\r
+     * \r
+     * @param subject a resource\r
+     * @return the principal types\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forEachPrincipalType\r
+     * @see AsyncReadGraph#forPrincipalTypeSet\r
+     */\r
+    Collection<Resource> getPrincipalTypes(Resource subject) throws ServiceException;\r
+\r
+    /**\r
+     * Gets the full type hierarchy for subject.\r
+     * \r
+     * @param subject a resource\r
+     * @return the type hierarchy\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forTypes\r
+     */\r
+    Set<Resource> getTypes(Resource subject) throws ServiceException;\r
+\r
+    /**\r
+     * Gets the full supertype hierarchy for subject.\r
+     * \r
+     * @param subject a resource\r
+     * @return the supertype hierarchy\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forSupertypes\r
+     */\r
+    Set<Resource> getSupertypes(Resource subject) throws ServiceException;\r
+\r
+    /**\r
+     * Gets the full superrelation hierarchy for subject.\r
+     * \r
+     * @param subject a resource\r
+     * @return the superrelation hierarchy\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forSuperrelations\r
+     */\r
+    Set<Resource> getSuperrelations(Resource subject) throws ServiceException;\r
+    Resource getPossibleSuperrelation(Resource subject) throws ServiceException;\r
+\r
+    /**\r
+     * Gets all objects o from statements (subject, p, o) such that\r
+     * {@link ReadGraph#isSubrelationOf(p, relation)} returns true. See the\r
+     * assertion mechanisn TODO for more details. If the relation is functional\r
+     * the request returns a single object according to the functional statement\r
+     * shadowing rules TODO if possible. If an invalid graph is encountered an\r
+     * exception is thrown.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the objects\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forEachObject\r
+     * @see AsyncReadGraph#forObjectSet\r
+     */\r
+    Collection<Resource> getObjects(Resource subject, Resource relation)\r
+    throws ServiceException;\r
+\r
+    /**\r
+     * Gets all objects o (s, p, o) asserted by subject such that\r
+     * {@link ReadGraph#isSubrelationOf(p, relation)} returns true. See the\r
+     * assertion mechanism TODO for more details. If the relation is functional\r
+     * the request returns a single object according to the functional statement\r
+     * shadowing rules TODO if possible. If an invalid graph is encountered an\r
+     * exception is thrown.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the objects\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forEachAssertedStatement\r
+     * @see AsyncReadGraph#forAssertedStatementSet\r
+     */\r
+    Collection<Resource> getAssertedObjects(Resource subject, Resource relation)\r
+    throws ManyObjectsForFunctionalRelationException, ServiceException;\r
+\r
+    /**\r
+     * Gets the inverse r of relation such that (relation, InverseOf, r). The\r
+     * methods assumes an inverse exists.\r
+     * \r
+     * @param relation a resource\r
+     * @return the inverse\r
+     * @throws NoInverseException if inverse was not fond\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forInverse\r
+     */\r
+    Resource getInverse(Resource relation) throws NoInverseException, ManyObjectsForFunctionalRelationException,\r
+    ServiceException;\r
+\r
+    /**\r
+     * Gets a single object as returned by {@link ReadGraph#getObjects}. Assumes\r
+     * a single object.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the single object\r
+     * @throws NoSingleResultException if the amount of valid objects was not\r
+     *         one\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forSingleObject\r
+     */\r
+    Resource getSingleObject(Resource subject, Resource relation) throws NoSingleResultException,\r
+    ManyObjectsForFunctionalRelationException, ServiceException;\r
+\r
+    /**\r
+     * Gets a single statement as returned by {@link ReadGraph#getStatements}.\r
+     * Assumes a single statement.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the single statement\r
+     * @throws NoSingleResultException if the amount of valid statements was not\r
+     *         one\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forSingleStatement\r
+     */\r
+    Statement getSingleStatement(Resource subject, Resource relation) throws NoSingleResultException,\r
+    ManyObjectsForFunctionalRelationException, ServiceException;\r
+\r
+    /**\r
+     * Gets a single type t as returned by {@link ReadGraph#getPrincipalTypes}. Assumes a single type.\r
+     * \r
+     * @param subject a resource\r
+     * @param baseType a resource\r
+     * @return the single type\r
+     * @throws NoSingleResultException if the amount of valid types was not one\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forSingleType\r
+     */\r
+    Resource getSingleType(Resource subject) throws NoSingleResultException, ServiceException;\r
+\r
+    /**\r
+     * Gets a single type t as returned by {@link ReadGraph#getTypes} where\r
+     * {@link ReadGraph#isInheritedFrom(t, baseType)}. Assumes a single type.\r
+     * \r
+     * @param subject a resource\r
+     * @param baseType a resource\r
+     * @return the single type\r
+     * @throws NoSingleResultException if the amount of valid types was not one\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forSingleType\r
+     */\r
+    Resource getSingleType(Resource subject, Resource baseType) throws NoSingleResultException, ServiceException;\r
+\r
+    /**\r
+     * Gets a value associated to subject. Infers {@link Binding} from type t =\r
+     * {@link ReadGraph#getSingleType(subject, Value)}\r
+     * \r
+     * @param subject a resource\r
+     * @return the value\r
+     * @throws DoesNotContainValueException if the subject did not contain a\r
+     *         resource\r
+     * @throws ServiceException on connection and database failure\r
+     * @see AsyncReadGraph#forValue\r
+     */\r
+    <T> T getValue(Resource subject) throws DoesNotContainValueException, ServiceException;\r
+\r
+    /**\r
+     * Gets a value associated to subject as a Variant. Infers {@link Binding} from type t =\r
+     * {@link ReadGraph#getSingleType(subject, Value)}\r
+     * \r
+     * @param subject a resource\r
+     * @return the value\r
+     * @throws DoesNotContainValueException if the subject did not contain a\r
+     *         resource\r
+     * @throws ServiceException on connection and database failure\r
+     * @see AsyncReadGraph#forValue\r
+     */\r
+    Variant getVariantValue(Resource subject) throws DoesNotContainValueException, ServiceException;\r
+    \r
+    /**\r
+     * Gets a value associated to subject using the given {@link Binding}.\r
+     * \r
+     * @param subject a resource\r
+     * @param binding a binding\r
+     * @return the value\r
+     * @throws DoesNotContainValueException if the subject did not contain a\r
+     *         resource\r
+     * @throws BindingException if value could not be produced using the given\r
+     *         {@link Binding}\r
+     * @throws ServiceException on connection and database failure\r
+     * @see AsyncReadGraph#forValue\r
+     */\r
+    <T> T getValue(Resource subject, Binding binding) throws DoesNotContainValueException, BindingException,\r
+    ServiceException;\r
+\r
+    /**\r
+     * Gets a single value associated to o such that (subject, r, o) and\r
+     * {@link ReadGraph#isSubrelationOf(r, relation)}. Assumes a single value.\r
+     * Infers {@link Binding} from type t =\r
+     * {@link ReadGraph#getSingleType(o, Value)}\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the value\r
+     * @throws NoSingleResultException if the amount of valid values was not one\r
+     * @throws DoesNotContainValueException if suitable o did not contain a\r
+     *         resource\r
+     * @throws ServiceException on connection and database failure\r
+     * @see AsyncReadGraph#forRelatedValue\r
+     */\r
+    <T> T getRelatedValue(Resource subject, Resource relation) throws NoSingleResultException,\r
+    DoesNotContainValueException, ServiceException;\r
+\r
+    /**\r
+     * Gets a single value associated to o such that (subject, r, o) and\r
+     * {@link ReadGraph#isSubrelationOf(r, relation)} as a Variant. Assumes a single value.\r
+     * Infers {@link Binding} from type t =\r
+     * {@link ReadGraph#getSingleType(o, Value)}\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the value\r
+     * @throws NoSingleResultException if the amount of valid values was not one\r
+     * @throws DoesNotContainValueException if suitable o did not contain a\r
+     *         resource\r
+     * @throws ServiceException on connection and database failure\r
+     * @see AsyncReadGraph#forRelatedValue\r
+     */\r
+    Variant getRelatedVariantValue(Resource subject, Resource relation) throws NoSingleResultException,\r
+    DoesNotContainValueException, ServiceException;    \r
+\r
+    /**\r
+     * Gets a single value associated to o such that (subject, r, o) and\r
+     * {@link ReadGraph#isSubrelationOf(r, relation)}. Uses the given\r
+     * {@link Binding}. Assumes a single value.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the value\r
+     * @throws NoSingleResultException if the amount of valid values was not one\r
+     * @throws DoesNotContainValueException if suitable o did not contain a\r
+     *         resource\r
+     * @throws BindingException if value could not be produced using the given\r
+     *         {@link Binding}\r
+     * @throws ServiceException on connection and database failure\r
+     * @see AsyncReadGraph#forRelatedValue\r
+     */\r
+    <T> T getRelatedValue(Resource subject, Resource relation, Binding binding) throws NoSingleResultException,\r
+    DoesNotContainValueException, BindingException, ServiceException;\r
+\r
+    /**\r
+     * Tries to adapt the specified resource into an instance of the specified\r
+     * class T. No guarantees are made on return values of this method. The\r
+     * returned values can be cached results of previous invocation or they can\r
+     * be new result object instances. See {@link #adaptUnique(Resource, Class)}\r
+     * for alternative behaviour.\r
+     * \r
+     * @param resource a resource\r
+     * @param clazz the adapter class\r
+     * @return\r
+     * @throws AdaptionException if suitable adapter was not found\r
+     * @throws ValidationException from the adapter\r
+     * @throws ServiceException on connection and database failure\r
+     * @see AsyncReadGraph#forAdapted\r
+     * @see #adaptUnique(Resource, Class)\r
+     */\r
+    <T> T adapt(Resource resource, Class<T> clazz) throws AdaptionException, ValidationException, ServiceException;\r
+\r
+    /**\r
+     * \r
+     * Same as: adapt(getSingleObject(resource, relation), clazz);\r
+     * \r
+     * @param resource a resource\r
+     * @param relation a resource\r
+     * @param clazz the adapter class\r
+     * @return\r
+     * @throws AdaptionException if suitable adapter was not found\r
+     * @throws ValidationException from the adapter\r
+     * @throws ServiceException on connection and database failure\r
+     * @see AsyncReadGraph#forAdapted\r
+     * @see #adaptUnique(Resource, Class)\r
+     */\r
+    <T> T adaptRelated(Resource resource, Resource relation, Class<T> clazz) throws AdaptionException, NoSingleResultException, ValidationException, ServiceException;\r
+\r
+    /**\r
+     * \r
+     * Same as:\r
+     * \r
+     *  Resource r = getPossibleObject(resource, relation);\r
+     *  if(r == null) return null;\r
+     *  return getPossibleAdapter(r, clazz);\r
+     * \r
+     * @param resource a resource\r
+     * @param relation a resource\r
+     * @param clazz the adapter class\r
+     * @return\r
+     * @throws AdaptionException if suitable adapter was not found\r
+     * @throws ValidationException from the adapter\r
+     * @throws ServiceException on connection and database failure\r
+     * @see AsyncReadGraph#forAdapted\r
+     * @see #adaptUnique(Resource, Class)\r
+     */\r
+    <T> T getPossibleRelatedAdapter(Resource resource, Resource relation, Class<T> clazz) throws ValidationException, ServiceException;\r
+\r
+    <T,C> T adaptContextual(Resource resource, C context, Class<C> contextClass, Class<T> clazz) throws AdaptionException, NoSingleResultException, ValidationException, ServiceException;\r
+    <T,C> T getPossibleContextualAdapter(Resource resource, C context, Class<C> contextClass, Class<T> clazz) throws ValidationException, ServiceException;\r
+    \r
+    /**\r
+     * Tries to adapt the specified resource into an instance of the specified\r
+     * class T. The difference to {@link #adapt(Resource, Class)} is that this\r
+     * method does everything possible to return a new object instance for each\r
+     * separate invocation.\r
+     * \r
+     * <p>\r
+     * The only case when this cannot be guaranteed is when the adaption result\r
+     * comes from an {@link Adapter} implementation which can internally do\r
+     * anything, like always return the same singleton instance.\r
+     * </p>\r
+     * \r
+     * @param resource a resource\r
+     * @param clazz the adapter class\r
+     * @return\r
+     * @throws AdaptionException if suitable adapter was not found\r
+     * @throws ValidationException from the adapter\r
+     * @throws ServiceException on connection and database failure\r
+     * @see AsyncReadGraph#forAdapted\r
+     * @see #adapt(Resource, Class)\r
+     */\r
+    <T> T adaptUnique(Resource resource, Class<T> clazz) throws AdaptionException, ValidationException,\r
+    ServiceException;\r
+\r
+    /**\r
+     * As {@link #getInverse} but returns null instead of an exception if\r
+     * inverse was not found.\r
+     * \r
+     * @param relation a resource\r
+     * @return the inverse or null\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forPossibleInverse\r
+     */\r
+    Resource getPossibleInverse(Resource relation) throws ManyObjectsForFunctionalRelationException, ServiceException;\r
+\r
+    /**\r
+     * As {@link #getSingleObject} but returns null instead of an exception if\r
+     * object was not found.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the object or null\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forPossibleObject\r
+     */\r
+    Resource getPossibleObject(Resource subject, Resource relation) throws ManyObjectsForFunctionalRelationException,\r
+    ServiceException;\r
+\r
+    /**\r
+     * As {@link #getSingleStatement} but returns null instead of an exception\r
+     * if statement was not found.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the statement or null\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forPossibleStatement\r
+     */\r
+    Statement getPossibleStatement(Resource subject, Resource relation)\r
+    throws ManyObjectsForFunctionalRelationException, ServiceException;\r
+\r
+    /**\r
+     * As {@link #getSingleType} but returns null instead of an exception if\r
+     * type was not found.\r
+     * \r
+     * @param subject a resource\r
+     * @param baseType a resource\r
+     * @return the type or null\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forPossibleType\r
+     */\r
+    Resource getPossibleType(Resource subject, Resource baseType) throws ServiceException;\r
+\r
+    /**\r
+     * As {@link #getValue} but returns null instead of an exception if value\r
+     * was not found.\r
+     * \r
+     * @param subject a resource\r
+     * @return the value or null\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forPossibleValue\r
+     */\r
+    <T> T getPossibleValue(Resource subject) throws ServiceException;\r
+\r
+    /**\r
+     * As {@link #getValue} but returns null instead of an exception if value\r
+     * was not found.\r
+     * \r
+     * @param subject a resource\r
+     * @param binding a {@link Binding}\r
+     * @return the value or null\r
+     * @throws BindingException if value could not be produced using the given\r
+     *         {@link Binding}\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forPossibleValue\r
+     */\r
+    <T> T getPossibleValue(Resource subject, Binding binding) throws BindingException, ServiceException;\r
+\r
+    /**\r
+     * As {@link #getPossibleRelatedValue} but returns null instead of an\r
+     * exception if value was not found.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return the value or null\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forPossibleRelatedValue\r
+     */\r
+    <T> T getPossibleRelatedValue(Resource subject, Resource relation)\r
+    throws ManyObjectsForFunctionalRelationException, ServiceException;\r
+\r
+    /**\r
+     * As {@link #getPossibleRelatedValue} but returns null instead of an\r
+     * exception if value was not found.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @param binding a {@link Binding}\r
+     * @return the value or null\r
+     * @throws ManyObjectsForFunctionalRelationException on invalid graph with\r
+     *         more than one functional object\r
+     * @throws BindingException if value could not be produced using the given\r
+     *         {@link Binding}\r
+     * @throws ServiceException on connection and database failures\r
+     * @see AsyncReadGraph#forPossibleRelatedValue\r
+     */\r
+    <T> T getPossibleRelatedValue(Resource subject, Resource relation, Binding binding)\r
+    throws ManyObjectsForFunctionalRelationException, BindingException, ServiceException;\r
+\r
+    /**\r
+     * As {@link #adapt} but returns null instead of an exception if adapter was\r
+     * not found\r
+     * \r
+     * @param subject a resource\r
+     * @param clazz a Class\r
+     * @return the adapter or null\r
+     * @throws ValidationException when ?\r
+     * @throws ServiceException on connection and database failures\r
+     * @see {@link AsyncReadGraph#forPossibleAdapted}\r
+     */\r
+    <T> T getPossibleAdapter(Resource resource, Class<T> clazz) throws ValidationException, ServiceException;\r
+\r
+    /**\r
+     * As {@link #adaptUnique} but returns null instead of an exception if\r
+     * adapter was not found\r
+     * \r
+     * @param subject a resource\r
+     * @param clazz a Class\r
+     * @return the adapter or null\r
+     * @throws ValidationException when ?\r
+     * @throws ServiceException on connection and database failures\r
+     * @see {@link AsyncReadGraph#forPossibleAdapted}\r
+     */\r
+    <T> T getPossibleUniqueAdapter(Resource resource, Class<T> clazz) throws ValidationException, ServiceException;\r
+\r
+    /**\r
+     * Returns true if type is included in the result of {@link #getTypes(resource)}\r
+     * \r
+     * @param subject a resource\r
+     * @param type a resource\r
+     * @return indicates if resource is an instance of type\r
+     * @throws ServiceException on connection and database failures\r
+     * @see {@link AsyncReadGraph#forIsInstanceOf}\r
+     */\r
+    boolean isInstanceOf(Resource resource, Resource type) throws ServiceException;\r
+\r
+    /**\r
+     * Returns true if type equals resource or type is included in the result of\r
+     * {@link #getSupertypes(resource)}\r
+     * \r
+     * @param subject a resource\r
+     * @param type a resource\r
+     * @return indicates if resource is inherited from type\r
+     * @throws ServiceException on connection and database failures\r
+     * @see {@link AsyncReadGraph#forIsInheritedFrom}\r
+     */\r
+    boolean isInheritedFrom(Resource resource, Resource type) throws ServiceException;\r
+\r
+    /**\r
+     * Returns true if relation equals resource or relation is included in the result of\r
+     * {@link #getSuperrelations(resource)}\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return indicates if resource is a subrelation of relation\r
+     * @throws ServiceException on connection and database failures\r
+     * @see {@link AsyncReadGraph#forIsSubrelationOf}\r
+     */\r
+    boolean isSubrelationOf(Resource resource, Resource relation) throws ServiceException;\r
+\r
+    /**\r
+     * Returns true if the result of {@link #getStatements(subject, IsWeaklyRelatedTo)} is nonempty.\r
+     * \r
+     * @param subject a resource\r
+     * @return indicates that subject has statements\r
+     * @throws ServiceException on connection and database failures\r
+     * @see {@link AsyncReadGraph#forHasStatement}\r
+     */\r
+    boolean hasStatement(Resource subject) throws ServiceException;\r
+\r
+    /**\r
+     * Returns true if the result of {@link #getStatements(subject, relation)} is nonempty.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @return indicates that subject has statements with predicates as subrelation of relation\r
+     * @throws ServiceException on connection and database failures\r
+     * @see {@link AsyncReadGraph#forHasStatement}\r
+     */\r
+    boolean hasStatement(Resource subject, Resource relation) throws ServiceException;\r
+\r
+    /**\r
+     * Returns true if a statement (subject, relation, object) exists after assertions.\r
+     * \r
+     * @param subject a resource\r
+     * @param relation a resource\r
+     * @param object a resource\r
+     * @return indicates that the given statement exists\r
+     * @throws ServiceException on connection and database failures\r
+     * @see {@link AsyncReadGraph#forHasStatement}\r
+     */\r
+    boolean hasStatement(Resource subject, Resource relation, Resource object) throws ServiceException;\r
+\r
+    /**\r
+     * Returns true if there is a value associated with subject.\r
+     * IMPLEMENTATION NOTE:\r
+     * Current implementation fetches the value from server. If the value is\r
+     * large (i.e. not stored in the cluster) this is highly inefficient.\r
+     * \r
+     * @param subject a resource\r
+     * @return indicates that a value exists\r
+     * @throws ServiceException on connection and database failures\r
+     * @see {@link AsyncReadGraph#forHasValue}\r
+     */\r
+    boolean hasValue(Resource subject) throws ServiceException;\r
+\r
+    /**\r
+     * Returns the data type of the literal.\r
+     * @param subject\r
+     * @return\r
+     * @throws DatabaseException\r
+     */\r
+    Datatype getDataType(Resource subject) throws DatabaseException;\r
+\r
+    /**\r
+     * Returns an accessory that can be used to partially read the literal\r
+     * or write if the graph is WriteGraph. The returned accessory is closed\r
+     * automatically when the transaction ends. The modifications are written\r
+     * back to graph at transaction completion.\r
+     * \r
+     * @param <T> is typed accessory for modifying the literal value. \r
+     * @param resource is the literal containing the value.\r
+     * @return interface to partially read and write the literal value.\r
+     * @throws DatabaseException\r
+     */\r
+    <T extends Accessor> T getAccessor(Resource resource) throws DatabaseException;\r
+    \r
+    /**\r
+     * Returns an RandomAccessBinary that can be used to partially read the literal\r
+     * or write if the graph is WriteGraph. The returned interface is closed\r
+     * automatically when the transaction ends. The modifications are written\r
+     * back to graph at transaction completion.\r
+     * \r
+     * @param <T>\r
+     * @param resource is the literal containing the value.\r
+     * @return interface to partially read and write the literal value.\r
+     * @throws DatabaseException\r
+     */\r
+    RandomAccessBinary getRandomAccessBinary(Resource resource) throws DatabaseException;\r
+//    @SuppressWarnings("rawtypes")\r
+//     Function getValueFunction(Resource resource) throws DatabaseException;\r
+\r
+    /**\r
+     * Get the value associated with a graph {@link Resource}, using a possible context object and\r
+     * a default data type binding. An exception is thrown, if the value is not found.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param r  A graph resource with which the value is associated\r
+     * @param context  A context object that is used for acquiring the value, can be {@code null}\r
+     * @return  The value of the graph node.\r
+     * @throws DoesNotContainValueException  No value is associated with the graph node.\r
+     * @throws DatabaseException  Other errors, such as an error in casting the value to the return type or\r
+     *         a runtime error in the value function.\r
+     * @see #getValue2(Resource, Object, Binding)\r
+     * @see #getPossibleValue2(Resource, Object)\r
+     */\r
+    <T> T getValue2(Resource subject, Object context) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get the value associated with a graph {@link Resource}, using a possible context object and\r
+     * a default data type binding as a Variant. An exception is thrown, if the value is not found.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param r  A graph resource with which the value is associated\r
+     * @param context  A context object that is used for acquiring the value, can be {@code null}\r
+     * @return  The value of the graph node.\r
+     * @throws DoesNotContainValueException  No value is associated with the graph node.\r
+     * @throws DatabaseException  Other errors, such as an error in casting the value to the return type or\r
+     *         a runtime error in the value function.\r
+     * @see #getValue2(Resource, Object, Binding)\r
+     * @see #getPossibleValue2(Resource, Object)\r
+     */\r
+    Variant getVariantValue2( Resource r, Object context ) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get a possible value associated with a graph {@link Resource}, using a possible context object and\r
+     * a desired value binding. Unlike {@link #getValue2(Resource, Object)}, this methods\r
+     * returns {@code null} for missing values instead of throwing an exception.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param r  A graph resource with which the value is associated\r
+     * @param context  A context object that is used for acquiring the value, can be {@code null}\r
+     * @return  The value of the graph node.\r
+     * @throws DatabaseException  Usually should not happen. A null value is returned for possible errors.\r
+     * @see #getValue2(Resource, Object)\r
+     * @see #getPossibleValue2(Resource, Object, Binding)\r
+     */\r
+    <T> T getPossibleValue2(Resource subject, Object context) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get the value associated with a graph {@link Resource}, using a possible context object and\r
+     * a desired value binding. An exception is thrown, if the value is not found.\r
+     * <p>\r
+     * The following methods are tried in order to retrieve the value:\r
+     * <ol>\r
+     *   <li>If the given resource is a {@code L0.Literal}, the value of the literal is returned, using the binding specified by {@code binding}.</li>\r
+     *   <li>If the resource is a {@code L0.ExternalValue}, the value is acquired using\r
+     *       {@link ReflectionUtils#getValue(String)} with the resource URI.</li>\r
+     *   <li>If the resource is associated with a suitable value converter with relation {@code L0.ConvertsToValueWith}\r
+     *       (see {@link #requestValueFunction(Resource)}), the value function is called with the graph, the resource\r
+     *       and the context object.</li>\r
+     * </ul>\r
+     * \r
+     * @param r  A graph resource with which the value is associated\r
+     * @param context  A context object that is used for acquiring the value, can be {@code null}\r
+     * @param binding  A binding for the value type\r
+     * @return  The value of the graph node.\r
+     * @throws DoesNotContainValueException  No value is associated with the graph node.\r
+     * @throws DatabaseException  Other errors, such as an error in casting the value to the return type or\r
+     *         a runtime error in the value function.\r
+     * @see #getValue2(Resource, Object)\r
+     * @see #getPossibleValue2(Resource, Object, Binding)\r
+     */\r
+    <T> T getValue2(Resource subject, Object context, Binding binding) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get a possible value associated with a graph {@link Resource}, using a possible context object and\r
+     * a desired value binding. Unlike {@link #getValue2(Resource, Object, Binding)}, this methods\r
+     * returns {@code null} for missing values instead of throwing an exception.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param r  A graph resource with which the value is associated\r
+     * @param context  A context object that is used for acquiring the value, can be {@code null}\r
+     * @param binding  A binding for the value type\r
+     * @return  The value of the graph node.\r
+     * @throws DatabaseException  Usually should not happen. A null value is returned for possible errors.\r
+     * @see #getValue2(Resource, Object, Bindinge)\r
+     * @see #getPossibleValue2(Resource, Object)\r
+     */\r
+    <T> T getPossibleValue2(Resource subject, Object context, Binding binding) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get the single value associated with a graph resource related with a given subject.\r
+     * An exception is thrown, if a unique object resource or a value for it is not found.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param subject  A graph resource that indicates the subject node\r
+     * @param relation  A graph resource that indicates the predicate of a relation\r
+     * @return  The value of the unique graph node that is asserted as the object of the given subject and predicate.\r
+     * @throws NoSingleResultException  The number of suitable object resources is not equal to 1 (zero or greater than one) \r
+     * @throws DoesNotContainValueException  No value is associated with the graph node.\r
+     * @throws DatabaseException  Other errors, such as an error in casting the value to the return type or\r
+     *         a runtime error in the value function.\r
+     * @see #getRelatedValue2(Resource, Resource, Binding)\r
+     * @see #getRelatedValue2(Resource, Resource, Object)\r
+     * @see #getRelatedValue2(Resource, Resource, Object, Binding)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource)\r
+     */\r
+    <T> T getRelatedValue2(Resource subject, Resource relation) throws DatabaseException;\r
+\r
+    /**\r
+     * Get a possible single value associated with a graph resource related with a given subject.\r
+     * A {@code null} value is returned for missing values or other errors.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param subject  A graph resource that indicates the subject node\r
+     * @param relation  A graph resource that indicates the predicate of a relation\r
+     * @return  The value of the unique graph node that is asserted as the object of the given subject and predicate.\r
+     * @throws DatabaseException  Usually should not happen. A {@code null} value is returned for possible errors.\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Binding)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object, Binding)\r
+     * @see #getRelatedValue2(Resource, Resource)\r
+     */\r
+    <T> T getPossibleRelatedValue2(Resource subject, Resource relation) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get a possible single value associated with a graph resource related with a given subject.\r
+     * A {@code null} value is returned for missing values or other errors.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param subject  A graph resource that indicates the subject node\r
+     * @param relation  A graph resource that indicates the predicate of a relation\r
+     * @return  The value of the unique graph node that is asserted as the object of the given subject and predicate.\r
+     * @throws DatabaseException  Usually should not happen. A {@code null} value is returned for possible errors.\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Binding)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object, Binding)\r
+     * @see #getRelatedValue2(Resource, Resource)\r
+     */\r
+    Variant getRelatedVariantValue2( Resource subject, Resource relation ) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get the single value associated with a graph resource related with a given subject, a possible context object.\r
+     * An exception is thrown, if a unique object resource or a value for it is not found.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param subject  A graph resource that indicates the subject node\r
+     * @param relation  A graph resource that indicates the predicate of a relation\r
+     * @param context  A context object that is used for acquiring the value, can be {@code null}\r
+     * @return  The value of the unique graph node that is asserted as the object of the given subject and predicate.\r
+     * @throws NoSingleResultException  The number of suitable object resources is not equal to 1 (zero or greater than one) \r
+     * @throws DoesNotContainValueException  No value is associated with the graph node.\r
+     * @throws DatabaseException  Other errors, such as an error in casting the value to the return type or\r
+     *         a runtime error in the value function.\r
+     * @see #getRelatedValue2(Resource, Resource)\r
+     * @see #getRelatedValue2(Resource, Resource, Binding)\r
+     * @see #getRelatedValue2(Resource, Resource, Object, Binding)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object)\r
+     */\r
+    <T> T getRelatedValue2(Resource subject, Resource relation, Object context) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get the single value associated with a graph resource related with a given subject, a possible context object.\r
+     * An exception is thrown, if a unique object resource or a value for it is not found.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param subject  A graph resource that indicates the subject node\r
+     * @param relation  A graph resource that indicates the predicate of a relation\r
+     * @param context  A context object that is used for acquiring the value, can be {@code null}\r
+     * @return  The value of the unique graph node that is asserted as the object of the given subject and predicate.\r
+     * @throws NoSingleResultException  The number of suitable object resources is not equal to 1 (zero or greater than one) \r
+     * @throws DoesNotContainValueException  No value is associated with the graph node.\r
+     * @throws DatabaseException  Other errors, such as an error in casting the value to the return type or\r
+     *         a runtime error in the value function.\r
+     * @see #getRelatedValue2(Resource, Resource, Object)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object)\r
+     */\r
+    Variant getRelatedVariantValue2( Resource subject, Resource relation, Object context ) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get a possible single value associated with a graph resource related with a given subject and a possible context object.\r
+     * A {@code null} value is returned for missing values or other errors.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param subject  A graph resource that indicates the subject node\r
+     * @param relation  A graph resource that indicates the predicate of a relation\r
+     * @param context  A context object that is used for acquiring the value, can be {@code null}\r
+     * @return  The value of the unique graph node that is asserted as the object of the given subject and predicate.\r
+     * @throws DatabaseException  Usually should not happen. A {@code null} value is returned for possible errors.\r
+     * @see #getPossibleRelatedValue2(Resource, Resource)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Binding)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object, Binding)\r
+     * @see #getRelatedValue2(Resource, Resource, Object)\r
+     */\r
+    <T> T getPossibleRelatedValue2(Resource subject, Resource relation, Object context) throws DatabaseException;\r
+\r
+    /**\r
+     * Get the single value associated with a graph resource related with a given subject and\r
+     * a desired value binding. An exception is thrown, if a unique object resource or a value for it is not found.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param subject  A graph resource that indicates the subject node\r
+     * @param relation  A graph resource that indicates the predicate of a relation\r
+     * @param binding  A binding for the value type\r
+     * @return  The value of the unique graph node that is asserted as the object of the given subject and predicate.\r
+     * @throws NoSingleResultException  The number of suitable object resources is not equal to 1 (zero or greater than one) \r
+     * @throws DoesNotContainValueException  No value is associated with the graph node.\r
+     * @throws DatabaseException  Other errors, such as an error in casting the value to the return type or\r
+     *         a runtime error in the value function.\r
+     * @see #getRelatedValue2(Resource, Resource)\r
+     * @see #getRelatedValue2(Resource, Resource, Object)\r
+     * @see #getRelatedValue2(Resource, Resource, Object, Binding)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Binding)\r
+     */\r
+    <T> T getRelatedValue2(Resource subject, Resource relation, Binding binding) throws DatabaseException;\r
+\r
+    /**\r
+     * Get a possible single value associated with a graph resource related with a given subject and\r
+     * a desired value binding. A {@code null} value is returned for missing values or other errors.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param subject  A graph resource that indicates the subject node\r
+     * @param relation  A graph resource that indicates the predicate of a relation\r
+     * @param binding  A binding for the value type\r
+     * @return  The value of the unique graph node that is asserted as the object of the given subject and predicate.\r
+     * @throws DatabaseException  Usually should not happen. A {@code null} value is returned for possible errors.\r
+     * @see #getPossibleRelatedValue2(Resource, Resource)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object, Binding)\r
+     * @see #getRelatedValue2(Resource, Resource, Binding)\r
+     */\r
+    <T> T getPossibleRelatedValue2(Resource subject, Resource relation, Binding binding) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get the single value associated with a graph resource related with a given subject, a possible context object and\r
+     * a desired value binding. An exception is thrown, if a unique object resource or a value for it is not found.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param subject  A graph resource that indicates the subject node\r
+     * @param relation  A graph resource that indicates the predicate of a relation\r
+     * @param context  A context object that is used for acquiring the value, can be {@code null}\r
+     * @param binding  A binding for the value type\r
+     * @return  The value of the unique graph node that is asserted as the object of the given subject and predicate.\r
+     * @throws NoSingleResultException  The number of suitable object resources is not equal to 1 (zero or greater than one) \r
+     * @throws DoesNotContainValueException  No value is associated with the graph node.\r
+     * @throws DatabaseException  Other errors, such as an error in casting the value to the return type or\r
+     *         a runtime error in the value function.\r
+     * @see #getRelatedValue2(Resource, Resource)\r
+     * @see #getRelatedValue2(Resource, Resource, Binding)\r
+     * @see #getRelatedValue2(Resource, Resource, Object)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object, Binding)\r
+     */\r
+    <T> T getRelatedValue2(Resource subject, Resource relation, Object context, Binding binding) throws DatabaseException;\r
+\r
+    /**\r
+     * Get a possible single value associated with a graph resource related with a given subject, a possible context object and\r
+     * a desired value binding. A {@code null} value is returned for missing values or other errors.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     * \r
+     * @param subject  A graph resource that indicates the subject node\r
+     * @param relation  A graph resource that indicates the predicate of a relation\r
+     * @param context  A context object that is used for acquiring the value, can be {@code null}\r
+     * @param binding  A binding for the value type\r
+     * @return  The value of the unique graph node that is asserted as the object of the given subject and predicate.\r
+     * @throws DatabaseException  Usually should not happen. A {@code null} value is returned for possible errors.\r
+     * @see #getPossibleRelatedValue2(Resource, Resource)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Binding)\r
+     * @see #getPossibleRelatedValue2(Resource, Resource, Object)\r
+     * @see #getRelatedValue2(Resource, Resource, Object, Binding)\r
+     */\r
+    <T> T getPossibleRelatedValue2(Resource subject, Resource relation, Object context, Binding binding) throws DatabaseException;\r
+    \r
+    /**\r
+     * Get the parsed SCL type declaration from the string value of a graph resource that is the unique object of a\r
+     * given subject and predicate.\r
+     * <p>\r
+     * See {@link #getValue2(Resource, Object, Binding)} for more details.\r
+     *  \r
+     * @param subject  A resource that indicates the subject of a statement\r
+     * @param relation  A resource that indicates the predicate of the statement\r
+     * @return  A compiled SCL type definition of the string value of a unique object resource\r
+     * @throws DatabaseException  For any errors in locating a unique value or compiling it as an SCL type statement\r
+     */\r
+    Type getRelatedValueType(Resource subject, Resource relation) throws DatabaseException;\r
+    \r
+    boolean setSynchronous(boolean value);\r
+    boolean getSynchronous();\r
+}\r