1 package org.simantics.graph.query;
3 import java.io.IOException;
4 import java.util.Collection;
6 import org.simantics.databoard.binding.Binding;
7 import org.simantics.databoard.binding.error.BindingException;
8 import org.simantics.databoard.binding.mutable.Variant;
9 import org.simantics.databoard.serialization.RuntimeSerializerConstructionException;
10 import org.simantics.databoard.serialization.SerializationException;
11 import org.simantics.databoard.type.Datatype;
14 * Graph browsing interface for transferable graphs.
15 * @author Hannu Niemist�
17 public interface IGraph {
20 * Get value of the resource as variant. Returns null, if there is no value.
22 Variant getValue(Res resource);
25 * Sets value of the resource.
27 void setValue(Res resource, Object value, Binding binding);
30 * Gets the value of the resource using the given binding.
32 Object getValue(Res resource, Binding binding) throws RuntimeSerializerConstructionException, SerializationException, IOException, BindingException, NoValueException;
35 * Gets the data type of the resource or null if it doesn't have a data type.
37 Datatype getDatatype(Res resource);
40 * Gets raw objects without assertions
42 Collection<Res> rawGetObjects(Res subject, Res predicate);
45 * Gets single raw object or throws NoUniqueObjectException if that is not possible
47 Res singleRawObject(Res subject, Res predicate) throws NoUniqueObjectException;
50 * Gets raw and asserted objects.
52 Collection<Res> getObjects(Res subject, Res predicate);
55 * Gets all types of the given resource
57 Collection<Res> getTypes(Res resource);
60 * Gets all instances of the given type
62 Collection<Res> getInstances(Res type);
64 Datatype getAssertedDatatype(Res type);
66 Collection<Res> getChildren(Res res);