getActions();
+
}
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/kim/api/IKimConcept.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/kim/api/IKimConcept.java
index 07597425f..2b5a5a1db 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/kim/api/IKimConcept.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/kim/api/IKimConcept.java
@@ -685,4 +685,6 @@ public boolean appliesTo(Type type) {
*/
IKimConcept getTemporalInherent();
+ IKimConcept getValidParent();
+
}
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/kim/api/IValueMediator.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/kim/api/IValueMediator.java
index 0785acfc6..b2979d76c 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/kim/api/IValueMediator.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/kim/api/IValueMediator.java
@@ -102,6 +102,26 @@ public interface IValueMediator {
* unit returned, which also carries the definition of the contextual nature re: S/T and a
* string explaining the transformations made and why.
*
+ *
+ * EXAMPLE
+ *
+ * Precipitation comes from data as mm/day. The I,I form of the observable base unit (m^3) in
+ * T,S is m/s, compatible. OK - proceed. Target is m, which is I,E w.r.t. the target as seen
+ * matching to the contextualized extension of m^3. Specific extents must match - if AREAL and
+ * LINEAL are seen together, no compatibility can exist.
+ *
+ *
+ * - Turn mm/day -> m/s. Only a multiplicative factor M1 is needed.
+ * - Turn m/s (I,I) into its (I,E) form using T extension -> mm: op(x * Tms * 1000)
+ * - Turn the resulting mm into m. Another multiplication factor (M2)
+ * - Final strategy is (M1*M2*1000)*x*Tms.
+ *
+ *
+ * In case the target is m^3: I,I -> E,E so step 2 produces two extensions:
+ * op(x*Tms*1000)op(x*S)
+ *
+ * Model validator should always WARN if extensive is output by data AS LONG AS data come with
+ * their fully specified extension (e.g. T is physical). Otherwise it's an error.
*
* @param observable
* @param scale
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/API.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/API.java
index c6d6a6669..c6d8c1bb4 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/API.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/API.java
@@ -373,14 +373,31 @@ public static interface HUB {
*URL path for get agreement template.
*/
public static final String GET_AGREEMENT = API_BASE + "/agreements";
+ /**
+
+ *URL path for get agreement template.
+ */
+ public static final String GET_AGREEMENT_ID = GET_AGREEMENT + "/{id}";
/**
*URL path for get agreement template.
*/
public static final String AGREEMENT_TEMPLATE = API_BASE + "/agreement-templates";
+ /**
+ *URL path for get agreement template.
+ */
+ public static final String AGREEMENT_TEMPLATE_DELETE = AGREEMENT_TEMPLATE + "/delete";
+ /**
+ *URL path for get agreement template.
+ */
+ public static final String AGREEMENT_TEMPLATE_ID = AGREEMENT_TEMPLATE + "/{id}";
/**
*URL path for get agreement template by type and level.
*/
public static final String AGREEMENT_TEMPLATE_TYPE_LEVEL = AGREEMENT_TEMPLATE + "/type-level";
+ /**
+ *URL path for get agreement template filtered
+ */
+ public static final String AGREEMENT_TEMPLATE_FILTER= AGREEMENT_TEMPLATE + "/filter";
/**
* Base URL path for tag resources on the hub.
*/
@@ -429,6 +446,15 @@ public static interface HUB {
* Base URL path for user resources on the hub.
*/
public static final String CUSTOM_PROPERTIES = API_BASE + "/custom-properties";
+ /**
+ * Base URL path for custom properties related to users.
+ */
+ public static final String USER_CUSTOM_PROPERTIES = USER_BASE + "/custom-properties";
+ /**
+ * Base URL path for custom properties related to a single user.
+ */
+ public static final String USER_ID_CUSTOM_PROPERTIES = USER_BASE_ID + "/custom-properties";
+
public static interface PARAMETERS {
/**
@@ -459,6 +485,10 @@ public static interface PARAMETERS {
* URL PARAMETER for requesting the names of groups.
*/
public static final String GROUP_NAMES = "names";
+ /**
+ * URL PARAMETER for requesting the summary of groups.
+ */
+ public static final String GROUP_SUMMARY = "summary";
/**
* URL PARAMETER for a user to request groups as a task.
*/
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/auth/IEngineUserIdentity.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/auth/IEngineUserIdentity.java
index 193127dc9..55a9755eb 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/auth/IEngineUserIdentity.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/auth/IEngineUserIdentity.java
@@ -14,7 +14,6 @@
package org.integratedmodelling.klab.api.auth;
import org.integratedmodelling.klab.api.auth.IActorIdentity.KlabMessage;
-import org.integratedmodelling.klab.api.engine.IContextScope;
/**
* The Interface IEngineUserIdentity. TODO must become a IActorIdentity
@@ -39,12 +38,12 @@ public interface IEngineUserIdentity extends IUserIdentity, IActorIdentity observer);
-
- /**
- * The context observation for this scope. When an observation scope is created, this is null
- * and must be set using {@link #within(IDirectObservation)} on the parent scope.
- *
- * @return
- */
- IDirectObservation getContextObservation();
-
- /**
- * Return a scope focused on a specific root observation as the context for its
- * {@link #observe(Object...)} calls.
- *
- * @param observation
- * @return a new scope focused on the passed observation.
- */
- IContextScope within(IDirectObservation observation);
-
- /**
- * Return a new observation scope that sets the passed scenarios for any future observation.
- *
- * @param scenarios
- * @return
- */
- IContextScope withScenarios(String... scenarios);
-
- /**
- * Make an observation. Must be called on a context scope, possibly focused on a given root
- * observation using {@link #within(IDirectObservation)}. If no root observation is present in
- * the scope, the arguments must fully specify a subject, either through an
- * {@link IAcknowledgement} or a subject observable + a scale. If the parent session was focused
- * on a scale, this is available through {@link #getGeometry()} and the context can decide to
- * use it as a scale for the root subject.
- *
- * In case the observable specifies a relationship, k.LAB will attempt to instantiate it,
- * observing its source/target endpoints as well, unless two subject observations are passed, in
- * which case a specified relationship will be instantiated between them using them as source
- * and target respectively. In the latter case, each relationship will be resolved but
- * configuration detection will only happen upon exiting the scope where observe() is called.
- *
- * If the observation is at root level, or connecting two root-level subject through a
- * relationship, the overall geometry of the context will be automatically adjusted.
- *
- * @param observables either a {@link IObservable} (with a {@link IGeometry} if root subject) or
- * a {@link IAcknowledgement} for a pre-specified root subject.
- * @return a future for the observation being contextualized.
- */
- Future observe(Object... observables);
-
- /**
- *
- * getProvenance.
- *
- *
- * @return the provenance graph. Null in an empty context.
- */
- IProvenance getProvenance();
-
- /**
- * There is one report per root context. Actuators will add sections to it as models are
- * computed, based on the documentation templates associated with models and their parts. The
- * report can be compiled and rendered at any time.
- *
- * @return
- */
- IReport getReport();
-
- /**
- * During a contextualization there normally is a dataflow being run. This will only be null
- * only in special situations, e.g. when expressions are passed a convenience context in order
- * to be evaluated outside of contextualization.
- *
- * @return
- */
- IDataflow> getDataflow();
-
- /**
- * Return the parent observation of the passed observation. The runtime context maintains the
- * logical structure graph (ignores grouping of artifacts).
- *
- * @param observation
- * @return the parent, or null if root subject
- */
- IDirectObservation getParentOf(IObservation observation);
-
- /**
- * Return all children of the passed observation, using the logical structure (i.e. skipping
- * observation groups). The runtime context maintains the structure graph.
- *
- * @param observation an observation. {@link IState States} have no children but no error should
- * be raised.
- * @return the parent, or an empty collection if no children
- */
- Collection getChildrenOf(IObservation observation);
-
- /**
- * Inspect the network graph of the current context, returning all relationships that have the
- * passed subject as target.
- *
- * @param observation a {@link org.integratedmodelling.klab.api.observations.IDirectObservation}
- * object.
- * @return a {@link java.util.Collection} object.
- */
- Collection getOutgoingRelationships(IDirectObservation observation);
-
- /**
- * Inspect the network graph of the current context, returning all relationships that have the
- * passed subject as target.
- *
- * @param observation a {@link org.integratedmodelling.klab.api.observations.IDirectObservation}
- * object.
- * @return a {@link java.util.Collection} object.
- */
- Collection getIncomingRelationships(IDirectObservation observation);
-
-}
\ No newline at end of file
+//package org.integratedmodelling.klab.api.engine;
+//
+//import java.util.Collection;
+//import java.util.concurrent.Future;
+//
+//import org.integratedmodelling.klab.api.auth.IActorIdentity;
+//import org.integratedmodelling.klab.api.auth.IIdentity;
+//import org.integratedmodelling.klab.api.data.IGeometry;
+//import org.integratedmodelling.klab.api.documentation.IReport;
+//import org.integratedmodelling.klab.api.knowledge.IObservable;
+//import org.integratedmodelling.klab.api.model.IAcknowledgement;
+//import org.integratedmodelling.klab.api.observations.IDirectObservation;
+//import org.integratedmodelling.klab.api.observations.IObservation;
+//import org.integratedmodelling.klab.api.observations.IRelationship;
+//import org.integratedmodelling.klab.api.observations.IState;
+//import org.integratedmodelling.klab.api.provenance.IProvenance;
+//import org.integratedmodelling.klab.api.runtime.dataflow.IDataflow;
+//
+///**
+// * The scope for a context and any observations made within it.
+// *
+// * @author Ferd
+// *
+// */
+//public interface IContextScope extends ISessionScope {
+//
+// /**
+// * Return the observer for this context. The original observation scope has the session user as
+// * observer.
+// *
+// * @return
+// */
+// IIdentity getObserver();
+//
+// /**
+// * Return a child scope with the passed observer instead of ours.
+// *
+// * @param scenarios
+// * @return
+// */
+// IContextScope withObserver(IActorIdentity> observer);
+//
+// /**
+// * The context observation for this scope. When an observation scope is created, this is null
+// * and must be set using {@link #within(IDirectObservation)} on the parent scope.
+// *
+// * @return
+// */
+// IDirectObservation getContextObservation();
+//
+// /**
+// * Return a scope focused on a specific root observation as the context for its
+// * {@link #observe(Object...)} calls.
+// *
+// * @param observation
+// * @return a new scope focused on the passed observation.
+// */
+// IContextScope within(IDirectObservation observation);
+//
+// /**
+// * Return a new observation scope that sets the passed scenarios for any future observation.
+// *
+// * @param scenarios
+// * @return
+// */
+// IContextScope withScenarios(String... scenarios);
+//
+// /**
+// * Make an observation. Must be called on a context scope, possibly focused on a given root
+// * observation using {@link #within(IDirectObservation)}. If no root observation is present in
+// * the scope, the arguments must fully specify a subject, either through an
+// * {@link IAcknowledgement} or a subject observable + a scale. If the parent session was focused
+// * on a scale, this is available through {@link #getGeometry()} and the context can decide to
+// * use it as a scale for the root subject.
+// *
+// * In case the observable specifies a relationship, k.LAB will attempt to instantiate it,
+// * observing its source/target endpoints as well, unless two subject observations are passed, in
+// * which case a specified relationship will be instantiated between them using them as source
+// * and target respectively. In the latter case, each relationship will be resolved but
+// * configuration detection will only happen upon exiting the scope where observe() is called.
+// *
+// * If the observation is at root level, or connecting two root-level subject through a
+// * relationship, the overall geometry of the context will be automatically adjusted.
+// *
+// * @param observables either a {@link IObservable} (with a {@link IGeometry} if root subject) or
+// * a {@link IAcknowledgement} for a pre-specified root subject.
+// * @return a future for the observation being contextualized.
+// */
+// Future observe(Object... observables);
+//
+// /**
+// *
+// * getProvenance.
+// *
+// *
+// * @return the provenance graph. Null in an empty context.
+// */
+// IProvenance getProvenance();
+//
+// /**
+// * There is one report per root context. Actuators will add sections to it as models are
+// * computed, based on the documentation templates associated with models and their parts. The
+// * report can be compiled and rendered at any time.
+// *
+// * @return
+// */
+// IReport getReport();
+//
+// /**
+// * During a contextualization there normally is a dataflow being run. This will only be null
+// * only in special situations, e.g. when expressions are passed a convenience context in order
+// * to be evaluated outside of contextualization.
+// *
+// * @return
+// */
+// IDataflow> getDataflow();
+//
+// /**
+// * Return the parent observation of the passed observation. The runtime context maintains the
+// * logical structure graph (ignores grouping of artifacts).
+// *
+// * @param observation
+// * @return the parent, or null if root subject
+// */
+// IDirectObservation getParentOf(IObservation observation);
+//
+// /**
+// * Return all children of the passed observation, using the logical structure (i.e. skipping
+// * observation groups). The runtime context maintains the structure graph.
+// *
+// * @param observation an observation. {@link IState States} have no children but no error should
+// * be raised.
+// * @return the parent, or an empty collection if no children
+// */
+// Collection getChildrenOf(IObservation observation);
+//
+// /**
+// * Inspect the network graph of the current context, returning all relationships that have the
+// * passed subject as target.
+// *
+// * @param observation a {@link org.integratedmodelling.klab.api.observations.IDirectObservation}
+// * object.
+// * @return a {@link java.util.Collection} object.
+// */
+// Collection getOutgoingRelationships(IDirectObservation observation);
+//
+// /**
+// * Inspect the network graph of the current context, returning all relationships that have the
+// * passed subject as target.
+// *
+// * @param observation a {@link org.integratedmodelling.klab.api.observations.IDirectObservation}
+// * object.
+// * @return a {@link java.util.Collection} object.
+// */
+// Collection getIncomingRelationships(IDirectObservation observation);
+//
+//}
\ No newline at end of file
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/IEngineService.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/IEngineService.java
index b418bc3ee..eb4dcb6bc 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/IEngineService.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/IEngineService.java
@@ -1,109 +1,105 @@
-package org.integratedmodelling.klab.api.engine;
-
-import org.integratedmodelling.klab.api.actors.IBehavior;
-import org.integratedmodelling.klab.api.auth.IUserIdentity;
-import org.integratedmodelling.klab.api.data.IResource;
-import org.integratedmodelling.klab.api.data.adapters.IKlabData;
-import org.integratedmodelling.klab.api.knowledge.IObservable;
-import org.integratedmodelling.klab.api.model.IAcknowledgement;
-import org.integratedmodelling.klab.api.model.IModel;
-import org.integratedmodelling.klab.api.provenance.IArtifact;
-import org.integratedmodelling.klab.api.runtime.dataflow.IDataflow;
-
-/**
- * A redesign of the engine API and its subcomponents, eventually available as separate services.
- * Unimplemented and only for brainstorming at the moment.
- *
- * @author Ferd
- *
- */
-public interface IEngineService {
-
- /**
- *
- * @author Ferd
- *
- */
- interface ResourceManager {
-
- /**
- *
- * @param urn
- * @param scope
- * @return
- */
- IBehavior resolveBehavior(String urn, IScope scope);
-
- /**
- *
- * @param urn
- * @param scope
- * @return
- */
- IResource resolveResource(String urn, IScope scope);
-
- /**
- *
- * @param originalResource
- * @param scope
- * @return
- */
- IResource contextualize(IResource originalResource, IContextScope scope);
-
- /**
- *
- * @param contextualizedResource
- * @param scope
- * @return
- */
- IKlabData getData(IResource contextualizedResource, IScope scope);
-
- }
-
- interface Reasoner {
-
- }
-
- interface Resolver {
-
- /**
- * Resolve an observable in the passed scope, producing the dataflow that will make the
- * observation.
- *
- * @param observable an {@link IObservable}, {@link IAcknowledgement}, {@link IModel} or a
- * string resolving to one of those.
- * @param scope if not an {@link IAcknowledgement}, must have a specified geometry. If the
- * {@link IObservable} is not a subject, must have a set context observation.
- * @return the dataflow that will create the observation once run by a runtime.
- */
- IDataflow> resolve(Object observable, IContextScope scope);
-
- }
-
- interface Runtime {
-
- /**
- * Run the passed dataflow in the scale of the observer represented in the scope; return the
- * primary artifact.
- *
- * @param
- * @param dataflow
- * @param scope must be or procede from a context scope
- * @return
- */
- T run(IDataflow dataflow, IContextScope scope);
-
-
- }
-
- /**
- * Login through an authenticated user identity and return the root scope for that user. The
- * scope for the user should be stored: if the user was logged in previously, the previously
- * logged in scope should be returned..
- *
- * @param user
- * @return
- */
- IScope login(IUserIdentity user);
-
-}
+//package org.integratedmodelling.klab.api.engine;
+//
+//import org.integratedmodelling.klab.api.actors.IBehavior;
+//import org.integratedmodelling.klab.api.auth.IUserIdentity;
+//import org.integratedmodelling.klab.api.data.IResource;
+//import org.integratedmodelling.klab.api.data.adapters.IKlabData;
+//import org.integratedmodelling.klab.api.knowledge.IObservable;
+//import org.integratedmodelling.klab.api.model.IAcknowledgement;
+//import org.integratedmodelling.klab.api.model.IModel;
+//import org.integratedmodelling.klab.api.provenance.IArtifact;
+//import org.integratedmodelling.klab.api.runtime.dataflow.IDataflow;
+//
+///**
+// * A redesign of the engine API and its subcomponents, eventually available as separate services.
+// * Unimplemented and only for brainstorming at the moment.
+// *
+// * @author Ferd
+// *
+// */
+//public interface IEngineService {
+//
+// /**
+// *
+// * @author Ferd
+// *
+// */
+// interface ResourceManager {
+//
+// /**
+// *
+// * @param urn
+// * @param scope
+// * @return
+// */
+// IBehavior resolveBehavior(String urn, IScope scope);
+//
+// /**
+// *
+// * @param urn
+// * @param scope
+// * @return
+// */
+// IResource resolveResource(String urn, IScope scope);
+//
+// /**
+// *
+// * @param originalResource
+// * @param scope
+// * @return
+// */
+// IResource contextualize(IResource originalResource, IContextScope scope);
+//
+// /**
+// *
+// * @param contextualizedResource
+// * @param scope
+// * @return
+// */
+// IKlabData getData(IResource contextualizedResource, IScope scope);
+//
+// }
+//
+// interface Resolver {
+//
+// /**
+// * Resolve an observable in the passed scope, producing the dataflow that will make the
+// * observation.
+// *
+// * @param observable an {@link IObservable}, {@link IAcknowledgement}, {@link IModel} or a
+// * string resolving to one of those.
+// * @param scope if not an {@link IAcknowledgement}, must have a specified geometry. If the
+// * {@link IObservable} is not a subject, must have a set context observation.
+// * @return the dataflow that will create the observation once run by a runtime.
+// */
+// IDataflow> resolve(Object observable, IContextScope scope);
+//
+// }
+//
+// interface Runtime {
+//
+// /**
+// * Run the passed dataflow in the scale of the observer represented in the scope; return the
+// * primary artifact.
+// *
+// * @param
+// * @param dataflow
+// * @param scope must be or procede from a context scope
+// * @return
+// */
+// T run(IDataflow dataflow, IContextScope scope);
+//
+//
+// }
+//
+// /**
+// * Login through an authenticated user identity and return the root scope for that user. The
+// * scope for the user should be stored: if the user was logged in previously, the previously
+// * logged in scope should be returned..
+// *
+// * @param user
+// * @return
+// */
+// IScope login(IUserIdentity user);
+//
+//}
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/IScope.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/IScope.java
index 377183e1e..a94a268ad 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/IScope.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/IScope.java
@@ -1,82 +1,82 @@
-package org.integratedmodelling.klab.api.engine;
-
-import java.io.Serializable;
-
-import org.integratedmodelling.kim.api.IParameters;
-import org.integratedmodelling.klab.api.auth.IUserIdentity;
-import org.integratedmodelling.klab.api.engine.IEngineService.Reasoner;
-import org.integratedmodelling.klab.api.engine.IEngineService.Resolver;
-import org.integratedmodelling.klab.api.engine.IEngineService.ResourceManager;
-import org.integratedmodelling.klab.api.engine.IEngineService.Runtime;
-import org.integratedmodelling.klab.api.runtime.monitoring.IChannel;
-
-public interface IScope extends IChannel, Serializable {
-
- enum Type {
- USER, // root-level scope
- SCRIPT, // session-level scope
- API, // session for the REST API through a client
- APPLICATION, // session for an application, including the Explorer
- SESSION, // raw session for direct use within Java code
- CONTEXT // context, on which observe() can be called
- }
-
- /**
- * Return the reasoner service assigned to this scope.
- *
- * @return
- */
- Reasoner getReasoner();
-
- /**
- * Return the resolver service assigned to this scope.
- *
- * @return
- */
- Resolver getResolver();
-
- /**
- * Return the runtime service assigned to this scope.
- *
- * @return
- */
- Runtime getRuntime();
-
- /**
- * Return the resources service assigned to this scope.
- *
- * @return
- */
- ResourceManager getResources();
-
- /**
- * The scope is created for an authenticated user by the engine.
- *
- * @return
- */
- IUserIdentity getUser();
-
- /**
- * Each scope can carry arbitrary data linked to it.
- *
- * @return
- */
- IParameters getData();
-
- /**
- * Start a raw session with a given identifier and return the scope that controls it.
- *
- * @param sessionName
- * @return
- */
- ISessionScope runSession(String sessionName);
-
- /**
- * Run an application or script and return the scope that controls it.
- *
- * @param behavior
- * @return
- */
- ISessionScope runApplication(String behaviorName);
-
-}
+//package org.integratedmodelling.klab.api.engine;
+//
+//import java.io.Serializable;
+//
+//import org.integratedmodelling.kim.api.IParameters;
+//import org.integratedmodelling.klab.api.auth.IUserIdentity;
+//import org.integratedmodelling.klab.api.engine.IEngineService.Reasoner;
+//import org.integratedmodelling.klab.api.engine.IEngineService.Resolver;
+//import org.integratedmodelling.klab.api.engine.IEngineService.ResourceManager;
+//import org.integratedmodelling.klab.api.engine.IEngineService.Runtime;
+//import org.integratedmodelling.klab.api.runtime.monitoring.IChannel;
+//
+//public interface IScope extends IChannel, Serializable {
+//
+// enum Type {
+// USER, // root-level scope
+// SCRIPT, // session-level scope
+// API, // session for the REST API through a client
+// APPLICATION, // session for an application, including the Explorer
+// SESSION, // raw session for direct use within Java code
+// CONTEXT // context, on which observe() can be called
+// }
+//
+// /**
+// * Return the reasoner service assigned to this scope.
+// *
+// * @return
+// */
+// Reasoner getReasoner();
+//
+// /**
+// * Return the resolver service assigned to this scope.
+// *
+// * @return
+// */
+// Resolver getResolver();
+//
+// /**
+// * Return the runtime service assigned to this scope.
+// *
+// * @return
+// */
+// Runtime getRuntime();
+//
+// /**
+// * Return the resources service assigned to this scope.
+// *
+// * @return
+// */
+// ResourceManager getResources();
+//
+// /**
+// * The scope is created for an authenticated user by the engine.
+// *
+// * @return
+// */
+// IUserIdentity getUser();
+//
+// /**
+// * Each scope can carry arbitrary data linked to it.
+// *
+// * @return
+// */
+// IParameters getData();
+//
+// /**
+// * Start a raw session with a given identifier and return the scope that controls it.
+// *
+// * @param sessionName
+// * @return
+// */
+// ISessionScope runSession(String sessionName);
+//
+// /**
+// * Run an application or script and return the scope that controls it.
+// *
+// * @param behavior
+// * @return
+// */
+// ISessionScope runApplication(String behaviorName);
+//
+//}
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/ISessionScope.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/ISessionScope.java
index 5818cd550..eaf4374c8 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/ISessionScope.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/engine/ISessionScope.java
@@ -1,43 +1,43 @@
-package org.integratedmodelling.klab.api.engine;
-
-import org.integratedmodelling.klab.api.data.IGeometry;
-
-public interface ISessionScope extends IScope {
-
- public enum Status {
- WAITING, STARTED, CHANGED, FINISHED, ABORTED, /* this only sent by UIs for now */ INTERRUPTED, EMPTY
- }
-
- /**
- * Never null. The session scope's geometry is the "focal" geometry of the user (where/when the
- * user agent is looking); the geometry in each {@link IContextScope} is the actual view
- * during observation.
- *
- * @return
- */
- IGeometry getGeometry();
-
- /**
- * A session may represent a raw session, a script or an application. In each case a name is
- * supplied and can be retrieved.
- *
- * @return
- */
- String getName();
-
- /**
- * Create a context scope in this session. The scope is initially focused on the geometry that
- * the session was focused on at the time of the call.
- *
- * @return
- */
- IContextScope createContext(String id);
-
- /**
- * Return the status of the session scope at the time of the call.
- *
- * @return
- */
- Status getStatus();
-
-}
+//package org.integratedmodelling.klab.api.engine;
+//
+//import org.integratedmodelling.klab.api.data.IGeometry;
+//
+//public interface ISessionScope extends IScope {
+//
+// public enum Status {
+// WAITING, STARTED, CHANGED, FINISHED, ABORTED, /* this only sent by UIs for now */ INTERRUPTED, EMPTY
+// }
+//
+// /**
+// * Never null. The session scope's geometry is the "focal" geometry of the user (where/when the
+// * user agent is looking); the geometry in each {@link IContextScope} is the actual view
+// * during observation.
+// *
+// * @return
+// */
+// IGeometry getGeometry();
+//
+// /**
+// * A session may represent a raw session, a script or an application. In each case a name is
+// * supplied and can be retrieved.
+// *
+// * @return
+// */
+// String getName();
+//
+// /**
+// * Create a context scope in this session. The scope is initially focused on the geometry that
+// * the session was focused on at the time of the call.
+// *
+// * @return
+// */
+// IContextScope createContext(String id);
+//
+// /**
+// * Return the status of the session scope at the time of the call.
+// *
+// * @return
+// */
+// Status getStatus();
+//
+//}
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/runtime/IContextualizationScope.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/runtime/IContextualizationScope.java
index 42309a14d..f92bfeeda 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/runtime/IContextualizationScope.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/runtime/IContextualizationScope.java
@@ -22,7 +22,6 @@
import org.integratedmodelling.klab.api.data.artifacts.IObjectArtifact;
import org.integratedmodelling.klab.api.data.general.IExpression;
import org.integratedmodelling.klab.api.documentation.IReport;
-import org.integratedmodelling.klab.api.engine.IContextScope;
import org.integratedmodelling.klab.api.knowledge.IConcept;
import org.integratedmodelling.klab.api.knowledge.IMetadata;
import org.integratedmodelling.klab.api.knowledge.IObservable;
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/CustomProperty.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/CustomProperty.java
index c9545616d..eddaaa8b3 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/CustomProperty.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/CustomProperty.java
@@ -15,6 +15,12 @@ public class CustomProperty {
private String value;
private boolean onlyAdmin;
+ public CustomProperty(String key, String value, boolean onlyAdmin) {
+ this.key = key;
+ this.value = value;
+ this.onlyAdmin = onlyAdmin;
+ }
+
public String getKey() {
return key;
}
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/ExternalAuthenticationCredentials.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/ExternalAuthenticationCredentials.java
index 45d202283..d1f2ade12 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/ExternalAuthenticationCredentials.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/ExternalAuthenticationCredentials.java
@@ -17,18 +17,20 @@ public class ExternalAuthenticationCredentials {
parameterKeys = new HashMap<>();
parameterKeys.put("basic", new String[]{"username", "password"});
parameterKeys.put("oidc", new String[]{"url", "grant_type", "client_id", "client_secrets", "scope", "provider_id"});
+ parameterKeys.put("s3", new String[]{"accessKey", "secretKey"});
}
/**
* Credentials, depending on scheme
*
- * for basic: username and password for oidc: Authentication URL, grant type, client ID, client
- * secret, scope, provider
+ * for basic: username and password
+ * for oidc: Authentication URL, grant type, client ID, client secret, scope, provider
+ * for s3: endpoint URL, access key, secret key
*/
private List credentials = new ArrayList<>();
/**
- * one of basic, oidc, ...
+ * one of basic, oidc, s3...
*/
private String scheme = "basic";
diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/Layout.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/Layout.java
index 01fab0cc9..927409a72 100644
--- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/Layout.java
+++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/rest/Layout.java
@@ -24,8 +24,8 @@
Footer (max 1 elemento)
Attributi
-Guardando la definizione che usa Quasar di Layout (che la cosa corrispondente) ci sono 2 cose interessanti che magari verrebbero bene pi avanti:
-- Un Layout pu essere un container quindi pu passare ad essere pure lui un componente. Nel caso di Quasar, questo fa s che le dimensioni facciano riferimento alla pgina intera o al Panel dove messo (per maggiori dettagli mi dici). Per noi questo potrebbe essere utile pensando a una view generale che sostituisca l'explorer come ben dicevi tu
+Guardando la definizione che usa Quasar di Layout (che � la cosa corrispondente) ci sono 2 cose interessanti che magari verrebbero bene pi� avanti:
+- Un Layout pu� essere un container quindi pu� passare ad essere pure lui un componente. Nel caso di Quasar, questo fa s� che le dimensioni facciano riferimento alla p�gina intera o al Panel dove � messo (per maggiori dettagli mi dici). Per noi questo potrebbe essere utile pensando a una view generale che sostituisca l'explorer come ben dicevi tu
- Usano una serie di lettere per gestire le sovrapposizioni:
Fondamentalmente si gestisce se i pannelli laterali coprono o no l'header e il footer
@@ -33,17 +33,17 @@
Header
Footer
Non so se Header e Footer sono rimasugli di altre implementazioni, pero credo che non sono necessari.
-Quasar ha dei componenti specifici per fondamentalmente gestisce dettagli estetici. Un panel messo nella propriet header di View non penso abbia bisogno di ulteriori dettagli, quindi mi centrerei in Panel
-Panel un contenitore di elementi eterogenei posizionati a seconda di come si definiscono e del layout previsto per il pannello,
-Un pannello pu contenere altri pannelli e cos successivamente
-Personalmente credo che tutti i componenti dovrebbero essere contenuti in un pannello e non possano essere lasciati soli, pi che altro per essere un po' coerenti
+Quasar ha dei componenti specifici per� fondamentalmente gestisce dettagli estetici. Un panel messo nella propriet� header di View non penso abbia bisogno di ulteriori dettagli, quindi mi centrerei in Panel
+Panel � un contenitore di elementi eterogenei posizionati a seconda di come si definiscono e del layout previsto per il pannello,
+Un pannello pu� contenere altri pannelli e cos� successivamente
+Personalmente credo che tutti i componenti dovrebbero essere contenuti in un pannello e non possano essere lasciati soli, pi� che altro per essere un po' coerenti
Attributi
-visible: visibilit che po essere legata a una variabile
-layout: qualche descrizione sul tipo di layout. Qua ci si pu mettere di tutto, per in un principio con orizzontale, verticale ed indicare se puoi andare a capo dovrebbe essere sufficiente. La storia del a capo per sapere se si cambia la dimensione degli elementi per starci o quando non ci si sta si va a nuova linea.
-Magari si pu anche pensare in un GridLayout o in un Flex pi avanti.
+visible: visibilit� che p�o essere legata a una variabile
+layout: qualche descrizione sul tipo di layout. Qua ci si pu� mettere di tutto, per� in un principio con orizzontale, verticale ed indicare se puoi andare a capo dovrebbe essere sufficiente. La storia del a capo � per sapere se si cambia la dimensione degli elementi per starci o quando non ci si sta si va a nuova linea.
+Magari si pu� anche pensare in un GridLayout o in un Flex pi� avanti.
Group
-Un gruppo credo dovrebbe essere qualcosa di omogeneo per poter gestire elementi come se fossero una unit. necessario per i radioButton e i checkButton
+Un gruppo credo dovrebbe essere qualcosa di omogeneo per poter gestire elementi come se fossero una unit�. � necessario per i radioButton e i checkButton
Attributi
Credo che possono essere gli stessi di un componente:
@@ -60,13 +60,13 @@
align
width: qui userei o percentuale o cose fisse senza dimensioni specifiche (xs, s, m, etc) e poi lo stile li definisce
Ed in questo momento non mi viene in mente alto
-E poi lascerei una serie di attributi come un Map visto che il funzionamento di ogni componente avr le sue necessita specifiche
+E poi lascerei una serie di attributi come un Map visto che il funzionamento di ogni componente avr� le sue necessita specifiche
Alert
Confirm
Questi due li stiamo trattando in una maniera speciale, penso che potranno avere un panel e dentro ci sia quello che vuoi
-Sarebbero pi simili ad una View pero con una parte dove metti il panel con il contenuto, e una parte con i bottoni specifici (alert solo ok, confirm ok e cancel)
-Oppure un tipo Dialog que pu avere delle implementazioni per alert e confirm
+Sarebbero pi� simili ad una View pero con una parte dove metti il panel con il contenuto, e una parte con i bottoni specifici (alert solo ok, confirm ok e cancel)
+Oppure un tipo Dialog que pu� avere delle implementazioni per alert e confirm
--------------------------------------------------------------------------------------------------------
*
*
@@ -83,6 +83,7 @@ public static class MenuItem {
private String text; // a slash is used to define nested menus
private String id;
+ private String url;
public String getText() {
return text;
@@ -96,7 +97,12 @@ public String getId() {
public void setId(String id) {
this.id = id;
}
-
+ public String getUrl() {
+ return url;
+ }
+ public void setUrl(String url) {
+ this.url = url;
+ }
}
private List panels = new ArrayList<>();
diff --git a/api/pom.xml b/api/pom.xml
index f081a74c1..08b61910d 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -193,8 +193,8 @@
- eclipse-2022-06
- https://download.eclipse.org/releases/2022-06/
+ eclipse-2022-09
+ https://download.eclipse.org/releases/2022-09/
p2
diff --git a/authorities/klab.authority.caliper/.classpath b/authorities/klab.authority.caliper/.classpath
index 002ad570e..6fc81d614 100644
--- a/authorities/klab.authority.caliper/.classpath
+++ b/authorities/klab.authority.caliper/.classpath
@@ -13,19 +13,20 @@
+
-
-
+
-
+
+
diff --git a/authorities/klab.authority.caliper/.settings/org.eclipse.jdt.core.prefs b/authorities/klab.authority.caliper/.settings/org.eclipse.jdt.core.prefs
index 2f5cc74c3..d089a9b73 100644
--- a/authorities/klab.authority.caliper/.settings/org.eclipse.jdt.core.prefs
+++ b/authorities/klab.authority.caliper/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,11 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/authorities/klab.authority.gbif/.classpath b/authorities/klab.authority.gbif/.classpath
index d2bc4e02a..6fc81d614 100644
--- a/authorities/klab.authority.gbif/.classpath
+++ b/authorities/klab.authority.gbif/.classpath
@@ -1,38 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/authorities/klab.authority.gbif/.settings/org.eclipse.jdt.core.prefs b/authorities/klab.authority.gbif/.settings/org.eclipse.jdt.core.prefs
index cb635b1c2..529020c74 100644
--- a/authorities/klab.authority.gbif/.settings/org.eclipse.jdt.core.prefs
+++ b/authorities/klab.authority.gbif/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,11 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/authorities/klab.authority.iupac/.classpath b/authorities/klab.authority.iupac/.classpath
index d2bc4e02a..6fc81d614 100644
--- a/authorities/klab.authority.iupac/.classpath
+++ b/authorities/klab.authority.iupac/.classpath
@@ -1,38 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/authorities/klab.authority.iupac/.settings/org.eclipse.jdt.core.prefs b/authorities/klab.authority.iupac/.settings/org.eclipse.jdt.core.prefs
index cb635b1c2..529020c74 100644
--- a/authorities/klab.authority.iupac/.settings/org.eclipse.jdt.core.prefs
+++ b/authorities/klab.authority.iupac/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,11 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/authorities/klab.authority.wrb/.classpath b/authorities/klab.authority.wrb/.classpath
index d2bc4e02a..6fc81d614 100644
--- a/authorities/klab.authority.wrb/.classpath
+++ b/authorities/klab.authority.wrb/.classpath
@@ -1,38 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/authorities/klab.authority.wrb/.settings/org.eclipse.jdt.core.prefs b/authorities/klab.authority.wrb/.settings/org.eclipse.jdt.core.prefs
index cb635b1c2..529020c74 100644
--- a/authorities/klab.authority.wrb/.settings/org.eclipse.jdt.core.prefs
+++ b/authorities/klab.authority.wrb/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,11 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/client/org.integratedmodelling.klab.client/.classpath b/client/org.integratedmodelling.klab.client/.classpath
index 8d901def9..79e43b5ee 100644
--- a/client/org.integratedmodelling.klab.client/.classpath
+++ b/client/org.integratedmodelling.klab.client/.classpath
@@ -1,72 +1,76 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/client/org.integratedmodelling.klab.client/.settings/org.eclipse.jdt.core.prefs b/client/org.integratedmodelling.klab.client/.settings/org.eclipse.jdt.core.prefs
index 11265a345..f78f7f772 100644
--- a/client/org.integratedmodelling.klab.client/.settings/org.eclipse.jdt.core.prefs
+++ b/client/org.integratedmodelling.klab.client/.settings/org.eclipse.jdt.core.prefs
@@ -1,10 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
-org.eclipse.jdt.core.compiler.compliance=11
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
-org.eclipse.jdt.core.compiler.source=11
+org.eclipse.jdt.core.compiler.source=17
diff --git a/client/pom.xml b/client/pom.xml
index b345e552a..53e4ae5dd 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -193,8 +193,8 @@
- eclipse-2022-06
- https://download.eclipse.org/releases/2022-06/
+ eclipse-2022-09
+ https://download.eclipse.org/releases/2022-09/
p2
diff --git a/components/klab.component.alignment/.classpath b/components/klab.component.alignment/.classpath
index 35d190649..7ed96f202 100644
--- a/components/klab.component.alignment/.classpath
+++ b/components/klab.component.alignment/.classpath
@@ -1,33 +1,34 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/klab.component.alignment/.settings/org.eclipse.jdt.core.prefs b/components/klab.component.alignment/.settings/org.eclipse.jdt.core.prefs
index 8406321eb..d44fef534 100644
--- a/components/klab.component.alignment/.settings/org.eclipse.jdt.core.prefs
+++ b/components/klab.component.alignment/.settings/org.eclipse.jdt.core.prefs
@@ -2,8 +2,10 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=1.8
diff --git a/components/klab.component.alignment/pom.xml b/components/klab.component.alignment/pom.xml
index 5c1d80cf1..a27288035 100644
--- a/components/klab.component.alignment/pom.xml
+++ b/components/klab.component.alignment/pom.xml
@@ -37,7 +37,7 @@
org.json
json
- 20230227
+ 20231013
diff --git a/components/klab.component.amp/.classpath b/components/klab.component.amp/.classpath
index 002ad570e..6fc81d614 100644
--- a/components/klab.component.amp/.classpath
+++ b/components/klab.component.amp/.classpath
@@ -13,19 +13,20 @@
+
-
-
+
-
+
+
diff --git a/components/klab.component.amp/.settings/org.eclipse.jdt.core.prefs b/components/klab.component.amp/.settings/org.eclipse.jdt.core.prefs
index 2f5cc74c3..d089a9b73 100644
--- a/components/klab.component.amp/.settings/org.eclipse.jdt.core.prefs
+++ b/components/klab.component.amp/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,11 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/components/klab.component.ecology/.classpath b/components/klab.component.ecology/.classpath
index d2bc4e02a..6fc81d614 100644
--- a/components/klab.component.ecology/.classpath
+++ b/components/klab.component.ecology/.classpath
@@ -1,38 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/klab.component.ecology/.settings/org.eclipse.jdt.core.prefs b/components/klab.component.ecology/.settings/org.eclipse.jdt.core.prefs
index cb635b1c2..529020c74 100644
--- a/components/klab.component.ecology/.settings/org.eclipse.jdt.core.prefs
+++ b/components/klab.component.ecology/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,11 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/components/klab.component.geotrellis/.classpath b/components/klab.component.geotrellis/.classpath
index d2bc4e02a..6fc81d614 100644
--- a/components/klab.component.geotrellis/.classpath
+++ b/components/klab.component.geotrellis/.classpath
@@ -1,38 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/klab.component.geotrellis/.settings/org.eclipse.jdt.core.prefs b/components/klab.component.geotrellis/.settings/org.eclipse.jdt.core.prefs
index cb635b1c2..c59405a62 100644
--- a/components/klab.component.geotrellis/.settings/org.eclipse.jdt.core.prefs
+++ b/components/klab.component.geotrellis/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,24 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=warning
diff --git a/components/klab.component.hydrology/.classpath b/components/klab.component.hydrology/.classpath
index 002ad570e..6fc81d614 100644
--- a/components/klab.component.hydrology/.classpath
+++ b/components/klab.component.hydrology/.classpath
@@ -13,19 +13,20 @@
+
-
-
+
-
+
+
diff --git a/components/klab.component.hydrology/.settings/org.eclipse.jdt.core.prefs b/components/klab.component.hydrology/.settings/org.eclipse.jdt.core.prefs
index cb635b1c2..529020c74 100644
--- a/components/klab.component.hydrology/.settings/org.eclipse.jdt.core.prefs
+++ b/components/klab.component.hydrology/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,11 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/hydrology/AccumulateFlowProcessResolver.java b/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/hydrology/AccumulateFlowProcessResolver.java
new file mode 100644
index 000000000..26d8ab02d
--- /dev/null
+++ b/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/hydrology/AccumulateFlowProcessResolver.java
@@ -0,0 +1,237 @@
+package org.integratedmodelling.geoprocessing.hydrology;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.integratedmodelling.kim.api.IKimExpression;
+import org.integratedmodelling.kim.api.IParameters;
+import org.integratedmodelling.klab.Extensions;
+import org.integratedmodelling.klab.Observables;
+import org.integratedmodelling.klab.Units;
+import org.integratedmodelling.klab.api.data.ILocator;
+import org.integratedmodelling.klab.api.data.general.IExpression;
+import org.integratedmodelling.klab.api.data.mediation.IUnit;
+import org.integratedmodelling.klab.api.extensions.ILanguageProcessor.Descriptor;
+import org.integratedmodelling.klab.api.model.contextualization.IResolver;
+import org.integratedmodelling.klab.api.observations.IObservation;
+import org.integratedmodelling.klab.api.observations.IProcess;
+import org.integratedmodelling.klab.api.observations.IState;
+import org.integratedmodelling.klab.api.observations.scale.space.IGrid.Cell;
+import org.integratedmodelling.klab.api.observations.scale.space.ISpace;
+import org.integratedmodelling.klab.api.provenance.IArtifact;
+import org.integratedmodelling.klab.api.provenance.IArtifact.Type;
+import org.integratedmodelling.klab.api.runtime.IContextualizationScope;
+import org.integratedmodelling.klab.components.geospace.Geospace;
+import org.integratedmodelling.klab.components.geospace.extents.Grid;
+import org.integratedmodelling.klab.components.geospace.extents.Shape;
+import org.integratedmodelling.klab.components.geospace.extents.Space;
+import org.integratedmodelling.klab.components.geospace.processing.ContributingCell;
+import org.integratedmodelling.klab.components.runtime.contextualizers.AbstractContextualizer;
+import org.integratedmodelling.klab.data.storage.BasicFileMappedStorage;
+import org.integratedmodelling.klab.exceptions.KlabException;
+import org.integratedmodelling.klab.exceptions.KlabValidationException;
+import org.integratedmodelling.klab.scale.Scale;
+import org.integratedmodelling.klab.utils.Pair;
+import org.integratedmodelling.klab.utils.Parameters;
+import org.locationtech.jts.geom.Point;
+
+/**
+ * Generic flow accumulator resolver that will compute an arbitrary quality by following flow
+ * directions from the outlets and executing arbitrary expressions.
+ *
+ * @author ferdinando.villa
+ *
+ */
+public class AccumulateFlowProcessResolver extends AbstractContextualizer implements IResolver, IExpression {
+
+ private Descriptor accumulateDescriptor;
+ private Descriptor distributeDescriptor;
+ private IContextualizationScope context;
+
+ public AccumulateFlowProcessResolver() {
+ }
+
+ public AccumulateFlowProcessResolver(IParameters parameters, IContextualizationScope context) {
+
+ this.context = context;
+ if (parameters.containsKey("evaluate")) {
+ Object expression = parameters.get("evaluate");
+ boolean forceScalar = false;
+ if (expression instanceof IKimExpression) {
+ forceScalar = ((IKimExpression) expression).isForcedScalar();
+ expression = ((IKimExpression) expression).getCode();
+ }
+ this.accumulateDescriptor = Extensions.INSTANCE.getLanguageProcessor(Extensions.DEFAULT_EXPRESSION_LANGUAGE).describe(
+ expression.toString(),
+ context.getExpressionContext().scalar(forceScalar ? Forcing.Always : Forcing.AsNeeded));
+ }
+ if (parameters.containsKey("distribute")) {
+ boolean forceScalar = false;
+ Object expression = parameters.get("distribute");
+ if (expression instanceof IKimExpression) {
+ forceScalar = ((IKimExpression) expression).isForcedScalar();
+ expression = ((IKimExpression) expression).getCode();
+ }
+ this.distributeDescriptor = Extensions.INSTANCE.getLanguageProcessor(Extensions.DEFAULT_EXPRESSION_LANGUAGE).describe(
+ expression.toString(),
+ context.getExpressionContext().scalar(forceScalar ? Forcing.Always : Forcing.AsNeeded));
+ }
+ if (this.accumulateDescriptor == null && this.distributeDescriptor == null) {
+ throw new IllegalArgumentException("flow accumulation resolver: no expression to evaluate");
+ }
+ }
+
+ @Override
+ public Type getType() {
+ return Type.NUMBER;
+ }
+
+ @Override
+ public IProcess resolve(IProcess process, IContextualizationScope context) throws KlabException {
+
+ IState target = context.getState(Observables.INSTANCE.getDescribedType(process.getObservable().getType()), null);
+ if (target == null) {
+ throw new KlabValidationException("cannot find state changed by " + process.getObservable());
+ }
+
+ IState flowdirection = context.getArtifact("flow_directions_d8", IState.class);
+
+ // IUnit tUnit = target.getObservable().getUnit();
+ Grid grid = Space.extractGrid(target);
+
+ if (grid == null) {
+ throw new KlabValidationException("Runoff must be computed on a grid extent");
+ }
+
+ // if (tUnit != null && tUnit.equals(Units.INSTANCE.SQUARE_METERS)) {
+ // tUnit = null;
+ // }
+
+ /*
+ * synchronized in case we parallelize the walker, which we don't do at the moment (not sure
+ * what happens with synchronous writes).
+ */
+ Map states = Collections.synchronizedMap(new HashMap<>());
+ states.put("self", target);
+ IExpression downstreamExpression = null;
+ IExpression upstreamExpression = null;
+
+ for (Pair a : context.getArtifacts(IState.class)) {
+ // if (context.getScale().getTime() != null) {
+ // a.setSecond(a.getSecond().at(context.getScale().getTime()));
+ // }
+ states.put(a.getFirst(), a.getSecond());
+ }
+
+ if (accumulateDescriptor != null) {
+ // // check inputs and see if the expr is worth anything in this context
+ // for (String input : accumulateDescriptor.getIdentifiers()) {
+ // if (accumulateDescriptor.isScalar(input) && context.getArtifact(input,
+ // IState.class)
+ // != null) {
+ // IState state = context.getArtifact(input, IState.class);
+ // states.put(input, state);
+ // }
+ // }
+ downstreamExpression = accumulateDescriptor.compile();
+ }
+
+ if (distributeDescriptor != null) {
+ // check inputs and see if the expr is worth anything in this context
+ // for (String input : distributeDescriptor.getIdentifiers()) {
+ // if (distributeDescriptor.isScalar(input) && context.getArtifact(input,
+ // IState.class)
+ // != null) {
+ // IState state = context.getArtifact(input, IState.class);
+ // states.put(input, state);
+ // }
+ // }
+ upstreamExpression = distributeDescriptor.compile();
+ }
+
+ try (BasicFileMappedStorage positionCache = new BasicFileMappedStorage<>(Boolean.class, grid.getCellCount())) {
+
+ for (IArtifact artifact : context.getArtifact("stream_outlet")) {
+
+ ISpace space = ((IObservation) artifact).getSpace();
+
+ if (space == null) {
+ continue;
+ }
+
+ Point point = ((Shape) space.getShape()).getJTSGeometry().getCentroid();
+ long xy = grid.getOffsetFromWorldCoordinates(point.getX(), point.getY());
+ Cell start = grid.getCell(xy);
+ compute(start, flowdirection, target, states, downstreamExpression, upstreamExpression, true,
+ target.get(Scale.create(context.getScale().getTime(), start)), positionCache, context);
+ }
+ }
+
+ return process;
+ }
+
+ /*
+ * Computation of runoff accumulates the runoff from upstream cells, ending at the outlet This
+ * function is called with the outlet cell as parameter.
+ */
+ private Object compute(Cell cell, IState flowdirection, IState result, Map states,
+ IExpression downstreamExpression, IExpression upstreamExpression, boolean isOutlet, Object previousValue,
+ BasicFileMappedStorage positionCache, IContextualizationScope scope) {
+
+ Object ret = previousValue;
+
+ if (positionCache.get(cell.getOffsetInGrid())) {
+ return ret;
+ }
+
+ positionCache.set(Boolean.TRUE, cell.getOffsetInGrid());
+
+ Parameters parameters = Parameters.create();
+ parameters.put("current", previousValue);
+
+ ILocator locator = cell;
+ if (scope.getScale().getTime() != null) {
+ locator = Scale.create(scope.getScale().getTime(), cell);
+ }
+
+ /*
+ * collect values of all states @ self
+ */
+ for (String state : states.keySet()) {
+ parameters.put(state, states.get(state).get(locator));
+ }
+
+ /*
+ * build the cell descriptor to give us access to the neighborhood
+ */
+ parameters.put("cell", new ContributingCell(cell, ((Number) flowdirection.get(locator)).intValue(), flowdirection, states,
+ isOutlet, locator));
+
+ // call upstream before recursion, in upstream order
+ if (upstreamExpression != null) {
+ result.set(cell, (ret = upstreamExpression.eval(scope, parameters)));
+ }
+
+ List upstreamCells = Geospace.getUpstreamCells(cell, flowdirection, context.getScale().getTime(), null);
+ for (Cell upstream : upstreamCells) {
+ compute(upstream, flowdirection, result, states, downstreamExpression, upstreamExpression, false, ret, positionCache,
+ scope);
+ }
+
+ /*
+ * call downstream after recursion, i.e. in downstream order
+ */
+ if (downstreamExpression != null) {
+ result.set(locator, (ret = downstreamExpression.eval(context, parameters)));
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Object eval(IContextualizationScope context, Object... parameters) throws KlabException {
+ return new AccumulateFlowProcessResolver(Parameters.create(parameters), context);
+ }
+}
diff --git a/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/hydrology/AccumulateFlowResolver.java b/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/hydrology/AccumulateFlowResolver.java
index 9d69adf7e..ca8033c07 100644
--- a/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/hydrology/AccumulateFlowResolver.java
+++ b/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/hydrology/AccumulateFlowResolver.java
@@ -9,6 +9,7 @@
import org.integratedmodelling.kim.api.IParameters;
import org.integratedmodelling.klab.Extensions;
import org.integratedmodelling.klab.Units;
+import org.integratedmodelling.klab.api.data.ILocator;
import org.integratedmodelling.klab.api.data.general.IExpression;
import org.integratedmodelling.klab.api.data.mediation.IUnit;
import org.integratedmodelling.klab.api.extensions.ILanguageProcessor.Descriptor;
@@ -29,6 +30,7 @@
import org.integratedmodelling.klab.data.storage.BasicFileMappedStorage;
import org.integratedmodelling.klab.exceptions.KlabException;
import org.integratedmodelling.klab.exceptions.KlabValidationException;
+import org.integratedmodelling.klab.scale.Scale;
import org.integratedmodelling.klab.utils.Pair;
import org.integratedmodelling.klab.utils.Parameters;
import org.locationtech.jts.geom.Point;
@@ -110,8 +112,12 @@ public IState resolve(IState target, IContextualizationScope context) throws Kla
IExpression upstreamExpression = null;
for (Pair a : context.getArtifacts(IState.class)) {
- states.put(a.getFirst(), a.getSecond());
+// if (context.getScale().getTime() != null) {
+// a.setSecond(a.getSecond().at(context.getScale().getTime()));
+// }
+ states.put(a.getFirst(), a.getSecond());
}
+
if (accumulateDescriptor != null) {
// // check inputs and see if the expr is worth anything in this context
// for (String input : accumulateDescriptor.getIdentifiers()) {
@@ -152,7 +158,7 @@ public IState resolve(IState target, IContextualizationScope context) throws Kla
long xy = grid.getOffsetFromWorldCoordinates(point.getX(), point.getY());
Cell start = grid.getCell(xy);
compute(start, flowdirection, target, states, downstreamExpression, upstreamExpression, true, null,
- positionCache);
+ positionCache, context);
}
}
@@ -165,7 +171,7 @@ public IState resolve(IState target, IContextualizationScope context) throws Kla
*/
private Object compute(Cell cell, IState flowdirection, IState result, Map states,
IExpression downstreamExpression, IExpression upstreamExpression, boolean isOutlet, Object previousValue,
- BasicFileMappedStorage positionCache) {
+ BasicFileMappedStorage positionCache, IContextualizationScope scope) {
Object ret = previousValue;
@@ -178,34 +184,39 @@ private Object compute(Cell cell, IState flowdirection, IState result, Map parameters = Parameters.create();
parameters.put("current", previousValue);
+ ILocator locator = cell;
+ if (scope.getScale().getTime() != null) {
+ locator = Scale.create(scope.getScale().getTime(), cell);
+ }
+
/*
* collect values of all states @ self
*/
for (String state : states.keySet()) {
- parameters.put(state, states.get(state).get(cell));
+ parameters.put(state, states.get(state).get(locator));
}
/*
* build the cell descriptor to give us access to the neighborhood
*/
parameters.put("cell",
- new ContributingCell(cell, ((Number) flowdirection.get(cell)).intValue(), flowdirection, states, isOutlet));
+ new ContributingCell(cell, ((Number) flowdirection.get(cell)).intValue(), flowdirection, states, isOutlet, locator));
// call upstream before recursion, in upstream order
if (upstreamExpression != null) {
- result.set(cell, (ret = upstreamExpression.eval(context, parameters)));
+ result.set(cell, (ret = upstreamExpression.eval(scope, parameters)));
}
List upstreamCells = Geospace.getUpstreamCells(cell, flowdirection, null);
for (Cell upstream : upstreamCells) {
- compute(upstream, flowdirection, result, states, downstreamExpression, upstreamExpression, false, ret, positionCache);
+ compute(upstream, flowdirection, result, states, downstreamExpression, upstreamExpression, false, ret, positionCache, scope);
}
/*
* call downstream after recursion, i.e. in downstream order
*/
if (downstreamExpression != null) {
- result.set(cell, (ret = downstreamExpression.eval(context, parameters)));
+ result.set(locator, (ret = downstreamExpression.eval(context, parameters)));
}
return ret;
diff --git a/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/morphology/AspectResolver.java b/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/morphology/AspectResolver.java
new file mode 100644
index 000000000..5fc0ae814
--- /dev/null
+++ b/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/morphology/AspectResolver.java
@@ -0,0 +1,71 @@
+package org.integratedmodelling.geoprocessing.morphology;
+
+import static org.hortonmachine.gears.libs.modules.HMConstants.floatNovalue;
+
+import java.awt.image.DataBuffer;
+
+import org.hortonmachine.hmachine.modules.geomorphology.aspect.OmsAspect;
+import org.hortonmachine.hmachine.modules.geomorphology.gradient.OmsGradient;
+import org.integratedmodelling.geoprocessing.TaskMonitor;
+import org.integratedmodelling.klab.api.data.general.IExpression;
+import org.integratedmodelling.klab.api.model.contextualization.IResolver;
+import org.integratedmodelling.klab.api.observations.IState;
+import org.integratedmodelling.klab.api.observations.scale.space.ISpace;
+import org.integratedmodelling.klab.api.provenance.IArtifact.Type;
+import org.integratedmodelling.klab.api.runtime.IContextualizationScope;
+import org.integratedmodelling.klab.components.geospace.utils.GeotoolsUtils;
+import org.integratedmodelling.klab.components.runtime.contextualizers.AbstractContextualizer;
+import org.integratedmodelling.klab.exceptions.KlabException;
+import org.integratedmodelling.klab.exceptions.KlabValidationException;
+
+public class AspectResolver extends AbstractContextualizer implements IResolver, IExpression {
+
+
+ @Override
+ public Type getType() {
+ return Type.NUMBER;
+ }
+
+ @Override
+ public IState resolve(IState target, IContextualizationScope context) throws KlabException {
+
+ IState dem = context.getArtifact("elevation", IState.class);
+ ISpace space = target.getSpace();
+
+ if (!(target.isSpatiallyDistributed() && space.isRegular())) {
+ throw new KlabValidationException("Aspect must be computed on a grid extent");
+ }
+
+ TaskMonitor taskMonitor = new TaskMonitor(context.getMonitor());
+ taskMonitor.setTaskName("Aspect");
+
+ OmsAspect aspect = new OmsAspect();
+ aspect.inElev = GeotoolsUtils.INSTANCE.stateToCoverage(dem, context.getScale(), DataBuffer.TYPE_FLOAT, floatNovalue,
+ false);
+ aspect.pm = taskMonitor;
+ aspect.doProcess = true;
+ aspect.doReset = false;
+ aspect.doRound = true;
+ aspect.doRadiants = false;
+ try {
+ aspect.process();
+ } catch (Exception e) {
+ throw new KlabException(e);
+ }
+ if (!context.getMonitor().isInterrupted()) {
+ GeotoolsUtils.INSTANCE.coverageToState(aspect.outAspect, target, context.getScale(), (a) -> {
+ if (a == (double) floatNovalue)
+ return Double.NaN;
+ return a;
+ });
+ }
+ return target;
+ }
+
+ @Override
+ public Object eval(IContextualizationScope context, Object... params) throws KlabException {
+ AspectResolver ret = new AspectResolver();
+ return ret;
+ }
+
+}
diff --git a/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/morphology/GradientResolver.java b/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/morphology/GradientResolver.java
new file mode 100644
index 000000000..07c4a6f63
--- /dev/null
+++ b/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/morphology/GradientResolver.java
@@ -0,0 +1,69 @@
+package org.integratedmodelling.geoprocessing.morphology;
+
+import static org.hortonmachine.gears.libs.modules.HMConstants.floatNovalue;
+
+import java.awt.image.DataBuffer;
+
+import org.hortonmachine.hmachine.modules.geomorphology.gradient.OmsGradient;
+import org.integratedmodelling.geoprocessing.TaskMonitor;
+import org.integratedmodelling.klab.api.data.general.IExpression;
+import org.integratedmodelling.klab.api.model.contextualization.IResolver;
+import org.integratedmodelling.klab.api.observations.IState;
+import org.integratedmodelling.klab.api.observations.scale.space.ISpace;
+import org.integratedmodelling.klab.api.provenance.IArtifact.Type;
+import org.integratedmodelling.klab.api.runtime.IContextualizationScope;
+import org.integratedmodelling.klab.components.geospace.utils.GeotoolsUtils;
+import org.integratedmodelling.klab.components.runtime.contextualizers.AbstractContextualizer;
+import org.integratedmodelling.klab.exceptions.KlabException;
+import org.integratedmodelling.klab.exceptions.KlabValidationException;
+
+public class GradientResolver extends AbstractContextualizer implements IResolver, IExpression {
+
+
+ @Override
+ public Type getType() {
+ return Type.NUMBER;
+ }
+
+ @Override
+ public IState resolve(IState target, IContextualizationScope context) throws KlabException {
+
+ IState dem = context.getArtifact("elevation", IState.class);
+ ISpace space = target.getSpace();
+
+ if (!(target.isSpatiallyDistributed() && space.isRegular())) {
+ throw new KlabValidationException("Gradient must be computed on a grid extent");
+ }
+
+
+ TaskMonitor taskMonitor = new TaskMonitor(context.getMonitor());
+ taskMonitor.setTaskName("Gradient");
+
+ OmsGradient gradient = new OmsGradient();
+ gradient.inElev = GeotoolsUtils.INSTANCE.stateToCoverage(dem, context.getScale(), DataBuffer.TYPE_FLOAT, floatNovalue,
+ false);
+ gradient.pm = taskMonitor;
+ gradient.doProcess = true;
+ gradient.doReset = false;
+ try {
+ gradient.process();
+ } catch (Exception e) {
+ throw new KlabException(e);
+ }
+ if (!context.getMonitor().isInterrupted()) {
+ GeotoolsUtils.INSTANCE.coverageToState(gradient.outSlope, target, context.getScale(), (a) -> {
+ if (a == (double) floatNovalue)
+ return Double.NaN;
+ return a;
+ });
+ }
+ return target;
+ }
+
+ @Override
+ public Object eval(IContextualizationScope context, Object... params) throws KlabException {
+ GradientResolver ret = new GradientResolver();
+ return ret;
+ }
+
+}
diff --git a/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/remotesensing/SentinelResolver.java b/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/remotesensing/SentinelResolver.java
index 1e86edea1..e4f0ebbe6 100644
--- a/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/remotesensing/SentinelResolver.java
+++ b/components/klab.component.hydrology/src/main/java/org/integratedmodelling/geoprocessing/remotesensing/SentinelResolver.java
@@ -116,10 +116,8 @@ public IState resolve(IState target, IContextualizationScope context) throws Kla
DefaultGeographicCRS.WGS84).transform(outputCrs, true);
RegionMap regionTransformed = RegionMap.fromEnvelopeAndGrid(regionEnvelopeTransformed, (int) cols, (int) rows);
- HMRaster outRaster = HMStacCollection.readRasterBandOnRegion(regionTransformed, stacBand, items, taskMonitor);
+ HMRaster outRaster = HMStacCollection.readRasterBandOnRegion(regionTransformed, stacBand, items, true, HMRaster.MergeMode.AVG, taskMonitor);
- // apply averaging based on the amount of times the cell has been assigned a value
- outRaster.applyCountAverage(taskMonitor);
GridCoverage2D outCoverage = outRaster.buildCoverage();
diff --git a/components/klab.component.hydrology/src/main/resources/components/org.integratedmodelling.geoprocessing/services/hydrology.kdl b/components/klab.component.hydrology/src/main/resources/components/org.integratedmodelling.geoprocessing/services/hydrology.kdl
index bb6c4e171..6a7fe6305 100644
--- a/components/klab.component.hydrology/src/main/resources/components/org.integratedmodelling.geoprocessing/services/hydrology.kdl
+++ b/components/klab.component.hydrology/src/main/resources/components/org.integratedmodelling.geoprocessing/services/hydrology.kdl
@@ -86,6 +86,55 @@ export number flowaccumulation
class org.integratedmodelling.geoprocessing.hydrology.ContributingAreaResolver
}
+export process flowaccumulationprocess
+
+ "Perform arbitrary calculation on each cell's neighborhood in the order established by
+ the flow directions, with access to values upstream and in the neighborhood of each
+ raster cell through a 'cell' variable that provides access to neighborhood inspection
+ capabilities. Identical to flowaccumulation but used as change process to set the
+ values of the changed state."
+
+ label 'Accumulate upstream flow'
+{
+ import number flow_directions_d8
+ "The D8 numeric code for flow direction"
+
+ import object stream_outlet
+ "Stream outlets. Only the location of the outlets will be used; if the outlet spatial
+ extent is not a point, the centroid cell will be used."
+
+ value expression evaluate
+ "An expression that returns the value in each cell. The 'cell' variable contains
+ a proxy to the cell that can produce the neighborhood, the upstream portion of the
+ neighborhood, arbitrary neighbors in each direction, and (when the cell is from the
+ neighborhood) the opposite relative to the focal cell. Each cell knows the values of
+ all the dependencies in its location. All these values are extracted using cell.xxx
+ where xxx is: neighbo[u]rhood, upstream, downstream (producing a list of cells); n, s, e,
+ w, ne, se, nw, se (producing one cell or null if at the edges); or the name of each
+ quality dependency (producing the value of that dependency at the cell). The expression
+ 'xxx.self' where xxx is one of the cells returned by 'cell.upstream' produces the value
+ of the target state at each upstream location. That is the only context where using
+ 'self' makes any sense, as it will not have been computed unless the cell is from the
+ upstream neighborhood."
+
+ value expression distribute
+ "An expression that is evaluated in the opposite order as 'evaluate', starting at the
+ outlet(s) and moving upstream. All parameters are the same as 'evaluate' except that
+ 'current' is the value of the output at the previously computed downstream cell, evaluated
+ before the expression is called, and repeated equal in case the focal cell is not the
+ only upstream cell (its value is null at the outlet). The variable 'cell' can be interrogated
+ using 'cell.outlet' to check if the
+ current cell is an outlet. The 'cell.downstream' and 'cell.upstream' are also defined as
+ before; remember that the upstream values of the output haven't been computed yet. If
+ 'distribute' is paired with 'evaluate', a flow accumulation step will follow all the
+ 'distribute' evaluations."
+
+ geometry T1S2
+
+ class org.integratedmodelling.geoprocessing.hydrology.AccumulateFlowProcessResolver
+}
+
+
export value accumulateflow
"Perform arbitrary calculation on each cell's neighborhood in the order established by
diff --git a/components/klab.component.hydrology/src/main/resources/components/org.integratedmodelling.geoprocessing/services/morphology.kdl b/components/klab.component.hydrology/src/main/resources/components/org.integratedmodelling.geoprocessing/services/morphology.kdl
index d73390d53..a0f242e46 100644
--- a/components/klab.component.hydrology/src/main/resources/components/org.integratedmodelling.geoprocessing/services/morphology.kdl
+++ b/components/klab.component.hydrology/src/main/resources/components/org.integratedmodelling.geoprocessing/services/morphology.kdl
@@ -67,4 +67,31 @@ export object findmaxima
default "custom"
class org.integratedmodelling.geoprocessing.morphology.MaximaFinderInstantiator
+}
+
+export number aspect
+ "Estimates the aspect (i.e. the inclination angle of the gradient)
+ by considering a reference system which puts the zero towards the
+ north and the rotation angle anticlockwise. Hence, aspect is 0 in
+ the North direction and increases clockwise."
+ label 'Aspect'
+{
+ import number elevation
+ "The digital elevation model."
+
+ geometry S2
+
+ class org.integratedmodelling.geoprocessing.morphology.AspectResolver
+}
+
+export number gradient
+ "Estimates the gradient in each site, defined as the module of the gradient vector."
+ label 'Gradient'
+{
+ import number elevation
+ "The digital elevation model."
+
+ geometry S2
+
+ class org.integratedmodelling.geoprocessing.morphology.GradientResolver
}
\ No newline at end of file
diff --git a/components/klab.component.landcover/.classpath b/components/klab.component.landcover/.classpath
index d2bc4e02a..6fc81d614 100644
--- a/components/klab.component.landcover/.classpath
+++ b/components/klab.component.landcover/.classpath
@@ -1,38 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/klab.component.landcover/.settings/org.eclipse.jdt.core.prefs b/components/klab.component.landcover/.settings/org.eclipse.jdt.core.prefs
index cb635b1c2..529020c74 100644
--- a/components/klab.component.landcover/.settings/org.eclipse.jdt.core.prefs
+++ b/components/klab.component.landcover/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,11 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/components/klab.component.mca/.classpath b/components/klab.component.mca/.classpath
index d2bc4e02a..6fc81d614 100644
--- a/components/klab.component.mca/.classpath
+++ b/components/klab.component.mca/.classpath
@@ -1,38 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/klab.component.mca/.settings/org.eclipse.jdt.core.prefs b/components/klab.component.mca/.settings/org.eclipse.jdt.core.prefs
index cb635b1c2..529020c74 100644
--- a/components/klab.component.mca/.settings/org.eclipse.jdt.core.prefs
+++ b/components/klab.component.mca/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,11 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/components/klab.component.ml/.classpath b/components/klab.component.ml/.classpath
index d2bc4e02a..5869b871e 100644
--- a/components/klab.component.ml/.classpath
+++ b/components/klab.component.ml/.classpath
@@ -1,38 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/klab.component.ml/.settings/org.eclipse.jdt.core.prefs b/components/klab.component.ml/.settings/org.eclipse.jdt.core.prefs
index 8406321eb..d44fef534 100644
--- a/components/klab.component.ml/.settings/org.eclipse.jdt.core.prefs
+++ b/components/klab.component.ml/.settings/org.eclipse.jdt.core.prefs
@@ -2,8 +2,10 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=1.8
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/BNNodeFactory.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/BNNodeFactory.java
index d71d7da91..774df2777 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/BNNodeFactory.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/BNNodeFactory.java
@@ -34,15 +34,16 @@
package org.integratedmodelling.ml.legacy.riskwiz.bn;
+import java.util.function.Supplier;
+
import org.integratedmodelling.ml.legacy.riskwiz.domain.DiscreteDomain;
-import org.jgrapht.VertexFactory;
/**
* @author Sergey Krivov
*
*/
-public class BNNodeFactory implements VertexFactory {
+public class BNNodeFactory implements Supplier {
/**
*
@@ -52,7 +53,7 @@ public BNNodeFactory() {
nodeCount = 0;
}
- @Override
+// @Override
public BNNode createVertex() {
nodeCount++;
return new BNNode("Node" + nodeCount);
@@ -83,4 +84,9 @@ public BNNode createVertex(String name, double from, double to, int numberOfInte
return new BNNode(name, from, to, numberOfIntervals, nodeType);
}
+ @Override
+ public BNNode get() {
+ return createVertex();
+ }
+
}
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/BeliefNetwork.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/BeliefNetwork.java
index d00774bf6..7728e36a2 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/BeliefNetwork.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/BeliefNetwork.java
@@ -33,53 +33,46 @@
package org.integratedmodelling.ml.legacy.riskwiz.bn;
-
-import org.jgrapht.EdgeFactory;
-import org.jgrapht.graph.ClassBasedEdgeFactory;
-
-
/**
* @author Sergey Krivov
*
*/
public class BeliefNetwork extends GenericBeliefNetwork {
- /**
+ private static final long serialVersionUID = -4789285633181382847L;
+
+ /**
* @param ef
* @param allowMultipleEdges
* @param allowLoops
*/
- public BeliefNetwork(EdgeFactory ef,
- boolean allowMultipleEdges, boolean allowLoops) {
- super(ef, allowMultipleEdges, allowLoops);
- // TODO Auto-generated constructor stub
+ public BeliefNetwork(boolean allowMultipleEdges, boolean allowLoops) {
+ super(BNEdge.class, allowMultipleEdges, allowLoops);
+ this.name = "";
}
/**
* @param edgeClass
*/
- public BeliefNetwork(Class extends BNEdge> edgeClass) {
- super(edgeClass);
- // TODO Auto-generated constructor stub
+ public BeliefNetwork() {
+ this(false, false);
+ this.name = "";
}
- /**
- * @param ef
- */
- public BeliefNetwork(EdgeFactory ef) {
- super(ef);
- // TODO Auto-generated constructor stub
- }
+// /**
+// * @param ef
+// */
+// public BeliefNetwork(EdgeFactory ef) {
+// super(ef);
+// // TODO Auto-generated constructor stub
+// }
public BeliefNetwork(String name) {
- super(new ClassBasedEdgeFactory(BNEdge.class));
+ this(false, false);
this.name = name;
bNNodeFactory = new BNNodeFactory();
}
- public BeliefNetwork() {
- this("");
- }
public String getEdgeComment(String sourceNodeName, String targetNodeName) {
BNNode sourceNode = getBeliefNode(sourceNodeName);
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/GenericBeliefNetwork.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/GenericBeliefNetwork.java
index 3d931ab66..79914ea2f 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/GenericBeliefNetwork.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/bn/GenericBeliefNetwork.java
@@ -40,7 +40,6 @@
import org.integratedmodelling.ml.legacy.riskwiz.domain.IntervalDomain;
import org.integratedmodelling.ml.legacy.riskwiz.domain.LabelDomain;
import org.integratedmodelling.ml.legacy.riskwiz.graph.RiskDirectedGraph;
-import org.jgrapht.EdgeFactory;
/**
@@ -65,7 +64,7 @@ public class GenericBeliefNetwork extends RiskDirectedGraph {
* @param allowMultipleEdges
* @param allowLoops
*/
- public GenericBeliefNetwork(EdgeFactory ef,
+ public GenericBeliefNetwork(Class extends E> ef,
boolean allowMultipleEdges, boolean allowLoops) {
super(ef, allowMultipleEdges, allowLoops);
// TODO Auto-generated constructor stub
@@ -79,13 +78,13 @@ public GenericBeliefNetwork(Class extends E> edgeClass) {
// TODO Auto-generated constructor stub
}
- /**
- * @param ef
- */
- public GenericBeliefNetwork(EdgeFactory ef) {
- super(ef);
- // TODO Auto-generated constructor stub
- }
+// /**
+// * @param ef
+// */
+// public GenericBeliefNetwork(EdgeFactory ef) {
+// super(ef);
+// // TODO Auto-generated constructor stub
+// }
public String getComment() {
return comment;
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/DBNGroundNetwork.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/DBNGroundNetwork.java
index 6f525eac4..86d4aeb5a 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/DBNGroundNetwork.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/DBNGroundNetwork.java
@@ -36,10 +36,7 @@
import java.util.Vector;
-import org.integratedmodelling.ml.legacy.riskwiz.bn.BNEdge;
-import org.integratedmodelling.ml.legacy.riskwiz.bn.BNNode;
import org.integratedmodelling.ml.legacy.riskwiz.bn.BeliefNetwork;
-import org.jgrapht.EdgeFactory;
/**
@@ -50,19 +47,19 @@ public class DBNGroundNetwork extends BeliefNetwork {
Vector slices;
- /**
- *
- */
- public DBNGroundNetwork() {
- super();
- slices = new Vector();
- }
+// /**
+// *
+// */
+// public DBNGroundNetwork() {
+// super();
+// slices = new Vector();
+// }
/**
* @param edgeClass
*/
- public DBNGroundNetwork(Class extends BNEdge> edgeClass) {
- super(edgeClass);
+ public DBNGroundNetwork() {
+ this(false, false);
slices = new Vector();
}
@@ -71,19 +68,18 @@ public DBNGroundNetwork(Class extends BNEdge> edgeClass) {
* @param allowMultipleEdges
* @param allowLoops
*/
- public DBNGroundNetwork(EdgeFactory ef,
- boolean allowMultipleEdges, boolean allowLoops) {
- super(ef, allowMultipleEdges, allowLoops);
- slices = new Vector();
- }
-
- /**
- * @param ef
- */
- public DBNGroundNetwork(EdgeFactory ef) {
- super(ef);
+ public DBNGroundNetwork(boolean allowMultipleEdges, boolean allowLoops) {
+ super(allowMultipleEdges, allowLoops);
slices = new Vector();
}
+//
+// /**
+// * @param ef
+// */
+// public DBNGroundNetwork(EdgeFactory ef) {
+// super(ef);
+// slices = new Vector();
+// }
/**
* @param name
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/DBNModel.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/DBNModel.java
index c1308239b..e4c8f27b4 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/DBNModel.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/DBNModel.java
@@ -38,7 +38,6 @@
import org.integratedmodelling.ml.legacy.riskwiz.bn.BNNode;
import org.integratedmodelling.ml.legacy.riskwiz.bn.GenericBeliefNetwork;
-import org.jgrapht.EdgeFactory;
/**
@@ -47,7 +46,9 @@
*/
public class DBNModel extends GenericBeliefNetwork {
- int numberOfSlices;
+ private static final long serialVersionUID = 2985991876480120930L;
+
+ int numberOfSlices;
private Vector temporalNodes;
@@ -64,17 +65,16 @@ public DBNModel(Class extends DBNEdge> edgeClass) {
* @param allowMultipleEdges
* @param allowLoops
*/
- public DBNModel(EdgeFactory ef,
- boolean allowMultipleEdges, boolean allowLoops) {
- super(ef, allowMultipleEdges, allowLoops);
+ public DBNModel(boolean allowMultipleEdges, boolean allowLoops) {
+ super(DBNEdge.class, allowMultipleEdges, allowLoops);
temporalNodes = new Vector();
}
/**
* @param ef
*/
- public DBNModel(EdgeFactory ef) {
- super(ef);
+ public DBNModel() {
+ super(DBNEdge.class);
temporalNodes = new Vector();
}
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/sdbn/SDBNGroundNetwork.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/sdbn/SDBNGroundNetwork.java
index d9ff75ec3..2890a1792 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/sdbn/SDBNGroundNetwork.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/sdbn/SDBNGroundNetwork.java
@@ -34,10 +34,7 @@
package org.integratedmodelling.ml.legacy.riskwiz.dbn.sdbn;
-import org.integratedmodelling.ml.legacy.riskwiz.bn.BNEdge;
-import org.integratedmodelling.ml.legacy.riskwiz.bn.BNNode;
import org.integratedmodelling.ml.legacy.riskwiz.dbn.DBNGroundNetwork;
-import org.jgrapht.EdgeFactory;
/**
@@ -54,32 +51,31 @@ public SDBNGroundNetwork() {
// TODO Auto-generated constructor stub
}
- /**
- * @param edgeClass
- */
- public SDBNGroundNetwork(Class extends BNEdge> edgeClass) {
- super(edgeClass);
- // TODO Auto-generated constructor stub
- }
+// /**
+// * @param edgeClass
+// */
+// public SDBNGroundNetwork(Class extends BNEdge> edgeClass) {
+// super(edgeClass);
+// // TODO Auto-generated constructor stub
+// }
/**
* @param ef
* @param allowMultipleEdges
* @param allowLoops
*/
- public SDBNGroundNetwork(EdgeFactory ef,
- boolean allowMultipleEdges, boolean allowLoops) {
- super(ef, allowMultipleEdges, allowLoops);
+ public SDBNGroundNetwork(boolean allowMultipleEdges, boolean allowLoops) {
+ super(allowMultipleEdges, allowLoops);
// TODO Auto-generated constructor stub
}
- /**
- * @param ef
- */
- public SDBNGroundNetwork(EdgeFactory ef) {
- super(ef);
- // TODO Auto-generated constructor stub
- }
+// /**
+// * @param ef
+// */
+// public SDBNGroundNetwork(EdgeFactory ef) {
+// super(ef);
+// // TODO Auto-generated constructor stub
+// }
/**
* @param name
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/sdbn/SDBNModel.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/sdbn/SDBNModel.java
index 30932f6a6..06fd06e3c 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/sdbn/SDBNModel.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/dbn/sdbn/SDBNModel.java
@@ -38,7 +38,6 @@
import org.integratedmodelling.ml.legacy.riskwiz.bn.BNNode;
import org.integratedmodelling.ml.legacy.riskwiz.bn.GenericBeliefNetwork;
-import org.jgrapht.EdgeFactory;
/**
@@ -65,9 +64,8 @@ public class SDBNModel extends GenericBeliefNetwork {
* @param allowMultipleEdges
* @param allowLoops
*/
- public SDBNModel(EdgeFactory ef,
- boolean allowMultipleEdges, boolean allowLoops) {
- super(ef, allowMultipleEdges, allowLoops);
+ public SDBNModel(boolean allowMultipleEdges, boolean allowLoops) {
+ super(SDBNEdge.class, allowMultipleEdges, allowLoops);
// TODO Auto-generated constructor stub
}
@@ -79,13 +77,13 @@ public SDBNModel(Class extends SDBNEdge> edgeClass) {
// TODO Auto-generated constructor stub
}
- /**
- * @param ef
- */
- public SDBNModel(EdgeFactory ef) {
- super(ef);
- // TODO Auto-generated constructor stub
- }
+// /**
+// * @param ef
+// */
+// public SDBNModel(EdgeFactory ef) {
+// super(ef);
+// // TODO Auto-generated constructor stub
+// }
public int getNumberOfSlices() {
return numberOfSlices;
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskDirectedGraph.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskDirectedGraph.java
index 77f1b2b5d..36b6d58eb 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskDirectedGraph.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskDirectedGraph.java
@@ -1,70 +1,60 @@
package org.integratedmodelling.ml.legacy.riskwiz.graph;
-
import java.util.HashSet;
import java.util.Set;
-import org.jgrapht.DirectedGraph;
-import org.jgrapht.EdgeFactory;
-import org.jgrapht.graph.ClassBasedEdgeFactory;
-
-
-public class RiskDirectedGraph extends RiskGraph implements
- DirectedGraph {
-
- /**
- *
- */
- private static final long serialVersionUID = -2599507208814161629L;
-
- public RiskDirectedGraph(EdgeFactory ef, boolean allowMultipleEdges,
- boolean allowLoops) {
- super(ef, allowMultipleEdges, allowLoops);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * Creates a new simple directed beliefNetwork.
- *
- * @param edgeClass
- * class on which to base factory for edges
- */
- public RiskDirectedGraph(Class extends E> edgeClass) {
- this(new ClassBasedEdgeFactory(edgeClass));
- }
-
- /**
- * Creates a new simple directed beliefNetwork with the specified edge factory.
- *
- * @param ef
- * the edge factory of the new beliefNetwork.
- */
- public RiskDirectedGraph(EdgeFactory ef) {
- super(ef, false, false);
- }
-
- public Set getParents(V vertex) {
- Set edges = this.incomingEdgesOf(vertex);
- Set parents = new HashSet();
-
- for (E e : edges) {
- parents.add(this.getEdgeSource(e));
- }
- return parents;
- }
-
- public Set getChildren(V vertex) {
- Set edges = this.outgoingEdgesOf(vertex);
- Set children = new HashSet();
+public class RiskDirectedGraph extends RiskGraph {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2599507208814161629L;
+
+ public RiskDirectedGraph(Class extends E> ef, boolean allowMultipleEdges, boolean allowLoops) {
+ super(ef, allowMultipleEdges, allowLoops);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * Creates a new simple directed beliefNetwork.
+ *
+ * @param edgeClass class on which to base factory for edges
+ */
+ public RiskDirectedGraph(Class extends E> edgeClass) {
+ this(edgeClass, false, true);
+ }
+
+// /**
+// * Creates a new simple directed beliefNetwork with the specified edge factory.
+// *
+// * @param ef the edge factory of the new beliefNetwork.
+// */
+// public RiskDirectedGraph(EdgeFactory ef) {
+// super(ef, false, false);
+// }
+
+ public Set getParents(V vertex) {
+ Set edges = this.incomingEdgesOf(vertex);
+ Set parents = new HashSet();
+
+ for (E e : edges) {
+ parents.add(this.getEdgeSource(e));
+ }
+ return parents;
+ }
+
+ public Set getChildren(V vertex) {
+ Set edges = this.outgoingEdgesOf(vertex);
+ Set children = new HashSet();
+
+ for (E e : edges) {
+ children.add(this.getEdgeTarget(e));
+ }
+ return children;
+ }
+
+ public boolean hasEdgeBetween(V sourceVertex, V targetVertex) {
+ return !getAllEdges(sourceVertex, targetVertex).isEmpty();
+ }
- for (E e : edges) {
- children.add(this.getEdgeTarget(e));
- }
- return children;
- }
-
- public boolean hasEdgeBetween(V sourceVertex, V targetVertex) {
- return !getAllEdges(sourceVertex, targetVertex).isEmpty();
- }
-
}
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskGraph.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskGraph.java
index 83c4a07ff..8e7a9dac6 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskGraph.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskGraph.java
@@ -1,58 +1,55 @@
package org.integratedmodelling.ml.legacy.riskwiz.graph;
-
import java.util.Set;
-import org.jgrapht.EdgeFactory;
-import org.jgrapht.graph.AbstractBaseGraph;
-
-
-public class RiskGraph extends AbstractBaseGraph {
-
- /**
- *
- */
- private static final long serialVersionUID = -1648493104509202405L;
-
- public RiskGraph(EdgeFactory ef, boolean allowMultipleEdges,
- boolean allowLoops) {
- super(ef, allowMultipleEdges, allowLoops);
- // TODO Auto-generated constructor stub
- }
-
- /* ! Applies a Graph Visitor to the beliefNetwork
- * \param[in] GV the visitor
- * \param[in] donodes - should the nodes be visited?
- * \param[in] doedges - should the edges be visited?
- */
- public void apply(Visitor GV, boolean donodes, boolean doedges) {
- if (donodes) {
- Set vertexes = vertexSet();
-
- for (V v : vertexes) {
- GV.onVertex(v);
- }
-
- }
-
- if (doedges) {
- Set edges = edgeSet();
-
- for (E e : edges) {
- GV.onEdge(e);
- }
- }
- }
-
- public boolean areConnected(V v1, V v2) {
-
- Set edges = getAllEdges(v1, v2);
-
- if (!edges.isEmpty()) {
- return true;
- }
-
- return false;
- }
+import org.jgrapht.graph.DefaultDirectedGraph;
+
+public class RiskGraph extends DefaultDirectedGraph {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1648493104509202405L;
+
+ public RiskGraph(Class extends E> edgeClass, boolean allowMultipleEdges, boolean allowLoops) {
+ super(edgeClass);
+// super(ef, allowMultipleEdges, allowLoops);
+ // TODO Auto-generated constructor stub
+ }
+
+ /*
+ * ! Applies a Graph Visitor to the beliefNetwork \param[in] GV the visitor
+ * \param[in] donodes - should the nodes be visited? \param[in] doedges - should
+ * the edges be visited?
+ */
+ public void apply(Visitor GV, boolean donodes, boolean doedges) {
+ if (donodes) {
+ Set vertexes = vertexSet();
+
+ for (V v : vertexes) {
+ GV.onVertex(v);
+ }
+
+ }
+
+ if (doedges) {
+ Set edges = edgeSet();
+
+ for (E e : edges) {
+ GV.onEdge(e);
+ }
+ }
+ }
+
+ public boolean areConnected(V v1, V v2) {
+
+ Set edges = getAllEdges(v1, v2);
+
+ if (!edges.isEmpty()) {
+ return true;
+ }
+
+ return false;
+ }
}
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskUndirectedGraph.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskUndirectedGraph.java
index 824a26852..4fe0246bf 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskUndirectedGraph.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/RiskUndirectedGraph.java
@@ -4,20 +4,15 @@
import java.util.HashSet;
import java.util.Set;
-import org.jgrapht.EdgeFactory;
-import org.jgrapht.UndirectedGraph;
-import org.jgrapht.graph.ClassBasedEdgeFactory;
-
-public class RiskUndirectedGraph extends RiskGraph implements
- UndirectedGraph {
+public class RiskUndirectedGraph extends RiskGraph {
/**
*
*/
private static final long serialVersionUID = 5140788770511048359L;
- public RiskUndirectedGraph(EdgeFactory ef,
+ public RiskUndirectedGraph(Class extends E> ef,
boolean allowMultipleEdges, boolean allowLoops) {
super(ef, allowMultipleEdges, allowLoops);
// TODO Auto-generated constructor stub
@@ -28,18 +23,18 @@ public RiskUndirectedGraph(EdgeFactory ef,
*
* @param ef the edge factory of the new beliefNetwork.
*/
- public RiskUndirectedGraph(EdgeFactory ef) {
- super(ef, false, false);
+ public RiskUndirectedGraph(Class extends E> ef) {
+ this(ef, false, false);
}
- /**
- * Creates a new simple beliefNetwork.
- *
- * @param edgeClass class on which to base factory for edges
- */
- public RiskUndirectedGraph(Class extends E> edgeClass) {
- this(new ClassBasedEdgeFactory(edgeClass));
- }
+// /**
+// * Creates a new simple beliefNetwork.
+// *
+// * @param edgeClass class on which to base factory for edges
+// */
+// public RiskUndirectedGraph(Class extends E> edgeClass) {
+// this(new ClassBasedEdgeFactory(edgeClass));
+// }
public Set getNeighbors(V vertex) {
Set neighbors = new HashSet();
diff --git a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/algorithm/Algorithm.java b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/algorithm/Algorithm.java
index 996df6315..6000a8241 100644
--- a/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/algorithm/Algorithm.java
+++ b/components/klab.component.ml/src/main/java/org/integratedmodelling/ml/legacy/riskwiz/graph/algorithm/Algorithm.java
@@ -1,47 +1,46 @@
package org.integratedmodelling.ml.legacy.riskwiz.graph.algorithm;
-
import org.jgrapht.Graph;
-
// we may not need this class
-public class Algorithm {
+public class Algorithm {
- public Algorithm() {// TODO Auto-generated constructor stub
- }
-
- protected Graph graph = null;
- protected String _Name;
-
- public Graph getGraph() {
- return graph;
- }
-
- public void setGraph(Graph graph) {
- this.graph = graph;
- }
-
- public String getName() {
- return _Name;
- }
-
- public void setName(String name) {
- _Name = name;
- }
-
- // /*! Execute the algorithm
- // */
- // public abstract Graph execute();
- // /*! execute the algorithm with beliefNetwork G
- // * \param[in] G
- // */
- // public Graph execute(Graph g)
- // {
- // setGraph(g);
- // return execute();
- // }
-
+ protected Class extends E> edgeClass;
+ public Algorithm(Class extends E> cls) {// TODO Auto-generated constructor stub
+ this.edgeClass = cls;
+ }
+
+ protected Graph graph = null;
+ protected String _Name;
+
+ public Graph getGraph() {
+ return graph;
+ }
+
+ public void setGraph(Graph graph) {
+ this.graph = graph;
+ }
+
+ public String getName() {
+ return _Name;
+ }
+
+ public void setName(String name) {
+ _Name = name;
+ }
+
+ // /*! Execute the algorithm
+ // */
+ // public abstract Graph execute();
+ // /*! execute the algorithm with beliefNetwork G
+ // * \param[in] G
+ // */
+ // public Graph | |