X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.graph%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fquery%2FIGraph.java;fp=bundles%2Forg.simantics.graph%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fquery%2FIGraph.java;h=e9022705ea7139eb3c73bb5e4e1192785f242f1a;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/query/IGraph.java b/bundles/org.simantics.graph/src/org/simantics/graph/query/IGraph.java new file mode 100644 index 000000000..e9022705e --- /dev/null +++ b/bundles/org.simantics.graph/src/org/simantics/graph/query/IGraph.java @@ -0,0 +1,70 @@ +package org.simantics.graph.query; + +import java.io.IOException; +import java.util.Collection; + +import org.simantics.databoard.binding.Binding; +import org.simantics.databoard.binding.error.BindingException; +import org.simantics.databoard.binding.mutable.Variant; +import org.simantics.databoard.serialization.RuntimeSerializerConstructionException; +import org.simantics.databoard.serialization.SerializationException; +import org.simantics.databoard.type.Datatype; + +/** + * Graph browsing interface for transferable graphs. + * @author Hannu Niemist� + */ +public interface IGraph { + + /** + * Get value of the resource as variant. Returns null, if there is no value. + */ + Variant getValue(Res resource); + + /** + * Sets value of the resource. + */ + void setValue(Res resource, Object value, Binding binding); + + /** + * Gets the value of the resource using the given binding. + */ + Object getValue(Res resource, Binding binding) throws RuntimeSerializerConstructionException, SerializationException, IOException, BindingException, NoValueException; + + /** + * Gets the data type of the resource or null if it doesn't have a data type. + */ + Datatype getDatatype(Res resource); + + /** + * Gets raw objects without assertions + */ + Collection rawGetObjects(Res subject, Res predicate); + + /** + * Gets single raw object or throws NoUniqueObjectException if that is not possible + */ + Res singleRawObject(Res subject, Res predicate) throws NoUniqueObjectException; + + /** + * Gets raw and asserted objects. + */ + Collection getObjects(Res subject, Res predicate); + + /** + * Gets all types of the given resource + */ + Collection getTypes(Res resource); + + /** + * Gets all instances of the given type + */ + Collection getInstances(Res type); + + Datatype getAssertedDatatype(Res type); + + Collection getChildren(Res res); + + Paths getPaths(); + +}