diff --git a/klab.cli/src/main/java/org/integratedmodelling/cli/KlabCLI.java b/klab.cli/src/main/java/org/integratedmodelling/cli/KlabCLI.java index 8e9475677..144ce0b20 100644 --- a/klab.cli/src/main/java/org/integratedmodelling/cli/KlabCLI.java +++ b/klab.cli/src/main/java/org/integratedmodelling/cli/KlabCLI.java @@ -9,6 +9,8 @@ import org.integratedmodelling.klab.api.engine.Engine; import org.integratedmodelling.klab.api.exceptions.KlabIOException; import org.integratedmodelling.klab.api.exceptions.KlabIllegalStateException; +import org.integratedmodelling.klab.api.scope.ContextScope; +import org.integratedmodelling.klab.api.scope.Scope; import org.integratedmodelling.klab.api.scope.Scope.Status; import org.integratedmodelling.klab.api.scope.SessionScope; import org.integratedmodelling.klab.api.scope.UserScope; diff --git a/klab.cli/src/main/java/org/integratedmodelling/cli/views/CLIReasonerView.java b/klab.cli/src/main/java/org/integratedmodelling/cli/views/CLIReasonerView.java index 71c761597..c5e622e52 100644 --- a/klab.cli/src/main/java/org/integratedmodelling/cli/views/CLIReasonerView.java +++ b/klab.cli/src/main/java/org/integratedmodelling/cli/views/CLIReasonerView.java @@ -8,6 +8,7 @@ import org.integratedmodelling.klab.api.knowledge.DescriptionType; import org.integratedmodelling.klab.api.knowledge.SemanticType; import org.integratedmodelling.klab.api.scope.ContextScope; +import org.integratedmodelling.klab.api.services.Reasoner; import picocli.CommandLine; import picocli.CommandLine.Command; import picocli.CommandLine.Model.CommandSpec; @@ -169,6 +170,17 @@ public void run() { } } } + + + @Command(name = "compatible", mixinStandardHelpOptions = true, version = Version.CURRENT, description = { + "Check if two concepts are compatible, optionally in context."}, subcommands = {}) + public static class Compatible implements Runnable { + + @Spec + CommandSpec commandSpec; + + @Parameters + java.util.List arguments; @Override public void run() { diff --git a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlActuator.java b/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlActuator.java deleted file mode 100644 index 6d773d01d..000000000 --- a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlActuator.java +++ /dev/null @@ -1,264 +0,0 @@ -package org.integratedmodelling.klab.api.lang.kdl; - -import java.util.Collection; -import java.util.List; -import java.util.Set; - -import org.integratedmodelling.klab.api.knowledge.Artifact; -import org.integratedmodelling.klab.api.lang.Annotation; - -/** - * The actor definition parsed from a KDL file. Used as a "contract" (i.e. an - * interface specification for a matching contextualizer class, with empty - * computation or only transformations for inputs) or as a complete computation, - * naming contextualizers in its computation. - * - * @author ferdinando.villa - * @deprecated - */ -public interface KdlActuator extends KdlStatement { - - public enum Target { - MODELS, OBSERVERS, CONCEPTS, DEFINITIONS, DEPENDENCIES - } - - /** - * Mandatory name for the actuator. - * - * @return the name. - */ - String getName(); - - /** - * True if this is an import or export using an annotation tag instead of an - * explicit name. In that case one of {@link #isImport()} or {@link #isExport()} - * must return true, and all the remaining info will be the type (mandatory) and - * docstring/label (optional). - * - * @return - */ - boolean isTaggingAnnotation(); - - /** - * Mandatory type. - * - * @return the type. - */ - Artifact.Type getType(); - - /** - * Optional label for display and provenance records - * - * @return the label - */ - String getLabel(); - - /** - * Return the declared type of the empty observation that must be created at - * this step, if any. Alternative to {@link KdlActuator#getNewObservationUrn()} - * - if one is not null, the other will be. Both can be null (e.g. in - * instantiating actuators). - * - * @return the new observation type - */ - String getNewObservationType(); - - /** - * Return the URN of the observation that we must connect to at this step, if - * any. Alternative to {@link KdlActuator#getNewObservationType()} - if one is - * not null, the other will be. Both can be null (e.g. in instantiating - * actuators). - * - * @return the new observation urn - */ - String getNewObservationUrn(); - - /** - * Optional description. If not given returns empty string. - * - * @return the description or "" - */ - String getDescription(); - - /** - * Computation. Contains contextualizers or transformations - only the latter - * are allowed in contracts. If more than one computations are returned, they - * can execute in parallel. - * - * @return the computation - */ - Collection getComputations(); - - /** - * All actuators that are imported. They may be resolved (@link - * {@link #getComputations()} != null) or not. - * - * @return the input actuators - */ - Collection getInputs(); - - /** - * All actuators that are exported. - * - * @return the input actuators - */ - Collection getOutputs(); - - /** - * Get all parameters declared in the actuator. - * - * @return the parameters for the actuator - */ - Collection getParameters(); - - /** - * Return the applicable target (non-empty only in annotation contracts). - * - * @return the set of target the specified annotation can be applied to. - */ - Collection getTargets(); - - /** - * True if this contextualizer describes an output of its parent contextualizer. - * - * @return true if output - */ - boolean isExport(); - - /** - * True if this contextualizer describes an input of its parent contextualizer. - * - * @return true if input - */ - boolean isImport(); - - /** - * If true, this contextualizer specifies a single value - * - * @return true if single valued - */ - boolean isParameter(); - - /** - * If true, this contextualizer is not necessary for computation. - * - * @return true if optional - */ - boolean isOptional(); - - /** - * If true, this contextualizer is declared final - which affects its possible - * use from specifications. - * - * @return true if optional - */ - boolean isFinal(); - - /** - * Abstract actuators are only used as a base for extensions of others in the - * same dataflow. - * - * @return - */ - boolean isAbstract(); - - /** - * For parameter specifications, this tags an input as an expression whose - * return value is that of the actuator. - * - * @return - */ - boolean isExpression(); - - /** - * If true, this actuator is a sub-dataflow to resolve each instance for the - * instantiator parent (if the name is the same as the parent's) or an attribute - * instantiated by a classifier filter in the computation. - * - * @return - */ - boolean isResolution(); - - /** - * Processors are computations that modify a pre-contextualized observation. - * - * @return - */ - boolean isFilter(); - - /** - * If both {@link #isParameter()} and {@link #isOptional()} return true, this - * should return the value to use as a default. - * - * @return the default value - */ - Object getDefaultValue(); - - /** - * The class name of a Java peer may be defined for each actuator. - * - * @return the java class specified - */ - String getJavaClass(); - - /** - * Parameter actuators can have values defined by an enum, which is returned - * here. - * - * @return set of enum values or empty string. - */ - Set getEnumValues(); - - /** - * All actuators defined inside this one. - * - * @return all actuators - */ - List getActors(); - - /** - * Any workflow-local alias defined for the actuator ('as' ), or null. - * - * @return the alias - */ - String getAlias(); - - /** - * The geometry of the actuator. Null means simple, arbitrary data. - * - * @return the geometry - */ - String getGeometry(); - - /** - * If any specific subscale has been given for the actuator, return the - * generating extent functions. - * - * @return the coverage - */ - List getCoverage(); - - /** - * Any annotations added in the specification. - * - * @return annotations in order of specification - */ - List getAnnotations(); - - /** - * Unit specs may be added to import statements. These will be validated only - * for syntax at this stage. - * - * @return - */ - String getUnit(); - - /** - * Const is for parameters that point to immutable resources, such as URNs or - * literals. Used in building the provenance diagram. - * - * @return - */ - boolean isConst(); - -} diff --git a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlComputation.java b/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlComputation.java deleted file mode 100644 index 92ff0f5f8..000000000 --- a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlComputation.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.integratedmodelling.klab.api.lang.kdl; - -@Deprecated -public interface KdlComputation extends Iterable { - -} diff --git a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlContextualizer.java b/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlContextualizer.java deleted file mode 100644 index db10c4d7f..000000000 --- a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlContextualizer.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.integratedmodelling.klab.api.lang.kdl; - -import org.integratedmodelling.klab.api.lang.ServiceCall; - -@Deprecated -public interface KdlContextualizer { - - /** - * Service call implementing the contextualizer. - * - * @return - */ - ServiceCall getServiceCall(); - - /** - * Mediation target, if any, corresponding to mediationTarget >> - * contextualizer() - * - * @return - */ - String getMediationTarget(); - - /** - * Destination variable for intermediate local values, if any, corresponding to - * variable <- contextualizer() - * - * @return - */ - String getVariable(); - - /** - * Contextualization target, if any, corresponding to contextualizer() >> target - * - * @return - */ - String getTarget(); -} diff --git a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlDataflow.java b/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlDataflow.java deleted file mode 100644 index fd0068314..000000000 --- a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlDataflow.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.integratedmodelling.klab.api.lang.kdl; - -import java.util.Collection; -import java.util.List; - -/** - * A dataflow contains zero or more actuator specifications and some specified metadata. - * - * @author Ferd - * @deprecated - */ -public interface KdlDataflow extends KdlStatement { - - /** - * All actuators in the dataflow. If > 1, each can be computed in parallel. They may be resolved - * or not, in which case they specify interfaces and possibly adapter operations to ensure correct - * representation. - * - * @return all actuators - */ - Collection getActuators(); - - /** - * Endpoint for this computation, if any. Implementations must be able to understand how to use it - * based on other metadata. - * - * @return the endpoint - */ - String getEndpoint(); - - /** - * Version of this dataflow. - * - * @return the version - */ - String getVersion(); - - /** - * Minimum version of k.LAB needed to run. - * - * @return the minimum version - */ - String getKlabVersion(); - - /** - * Worldview to interpret the semantics in actors, if any. - * - * @return the worldview name - */ - String getWorldview(); - - /** - * Contextualizers to build the scale for the dataflow. - * - * @return the scale definition - */ - List getScale(); - - /** - * Package name, if any, for declaration of functions in k.IM. - * - * @return the package name - */ - String getPackageName(); -} diff --git a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlStatement.java b/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlStatement.java deleted file mode 100644 index 965d63833..000000000 --- a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/lang/kdl/KdlStatement.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.integratedmodelling.klab.api.lang.kdl; - -import java.util.Collection; - -import org.integratedmodelling.klab.api.lang.Statement; - -@Deprecated -public interface KdlStatement extends Statement { - - /** - * True if there are any errors - * - * @return - */ - boolean isErrors(); - - /** - * Return any error messages - * - * @return - */ - Collection getErrors(); - -} diff --git a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/scope/ContextScope.java b/klab.core.api/src/main/java/org/integratedmodelling/klab/api/scope/ContextScope.java index 161ec18ec..05d5b0f07 100644 --- a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/scope/ContextScope.java +++ b/klab.core.api/src/main/java/org/integratedmodelling/klab/api/scope/ContextScope.java @@ -2,6 +2,7 @@ import org.integratedmodelling.klab.api.data.Mutable; import org.integratedmodelling.klab.api.data.RuntimeAsset; +import org.integratedmodelling.klab.api.data.Storage; import org.integratedmodelling.klab.api.exceptions.KlabIllegalStateException; import org.integratedmodelling.klab.api.geometry.Geometry; import org.integratedmodelling.klab.api.knowledge.Observable; diff --git a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/services/ResourcesService.java b/klab.core.api/src/main/java/org/integratedmodelling/klab/api/services/ResourcesService.java index c031fe78f..2b6244ab9 100644 --- a/klab.core.api/src/main/java/org/integratedmodelling/klab/api/services/ResourcesService.java +++ b/klab.core.api/src/main/java/org/integratedmodelling/klab/api/services/ResourcesService.java @@ -14,7 +14,6 @@ import org.integratedmodelling.klab.api.knowledge.organization.ProjectStorage; import org.integratedmodelling.klab.api.knowledge.organization.Workspace; import org.integratedmodelling.klab.api.lang.kactors.KActorsBehavior; -import org.integratedmodelling.klab.api.lang.kdl.KdlDataflow; import org.integratedmodelling.klab.api.lang.kim.*; import org.integratedmodelling.klab.api.scope.ContextScope; import org.integratedmodelling.klab.api.scope.Scope; @@ -25,7 +24,6 @@ import org.integratedmodelling.klab.api.services.runtime.Dataflow; import java.io.File; -import java.io.OutputStream; import java.net.URL; import java.util.Collection; import java.util.List; @@ -257,7 +255,7 @@ default String getServiceName() { * @param scope * @return */ - KdlDataflow resolveDataflow(String urn, Scope scope); + KimObservationStrategyDocument resolveDataflow(String urn, Scope scope); /** * THe worldview is required to be whole and consistent, including and starting with a root domain. If diff --git a/klab.core.common/src/main/java/org/integratedmodelling/common/authentication/scope/ChannelImpl.java b/klab.core.common/src/main/java/org/integratedmodelling/common/authentication/scope/ChannelImpl.java index d3c934a1b..b357e7983 100644 --- a/klab.core.common/src/main/java/org/integratedmodelling/common/authentication/scope/ChannelImpl.java +++ b/klab.core.common/src/main/java/org/integratedmodelling/common/authentication/scope/ChannelImpl.java @@ -42,7 +42,7 @@ static class EventMatcher { private final AtomicBoolean errors = new AtomicBoolean(false); private final List> listeners = Collections.synchronizedList(new ArrayList<>()); - private final Multimap, EventMatcher> eventMatchers; + private Multimap, EventMatcher> eventMatchers; public ChannelImpl(Identity identity) { this.identity = identity; diff --git a/klab.core.common/src/main/java/org/integratedmodelling/common/data/jackson/JacksonConfiguration.java b/klab.core.common/src/main/java/org/integratedmodelling/common/data/jackson/JacksonConfiguration.java index 66e721136..dee869ba6 100644 --- a/klab.core.common/src/main/java/org/integratedmodelling/common/data/jackson/JacksonConfiguration.java +++ b/klab.core.common/src/main/java/org/integratedmodelling/common/data/jackson/JacksonConfiguration.java @@ -30,7 +30,6 @@ import org.integratedmodelling.klab.api.lang.Quantity; import org.integratedmodelling.klab.api.lang.ServiceCall; import org.integratedmodelling.klab.api.lang.kactors.KActorsBehavior; -import org.integratedmodelling.klab.api.lang.kdl.KdlDataflow; import org.integratedmodelling.klab.api.lang.kim.*; import org.integratedmodelling.klab.api.provenance.Activity; import org.integratedmodelling.klab.api.provenance.Agent; diff --git a/klab.core.common/src/main/java/org/integratedmodelling/common/services/client/resources/ResourcesClient.java b/klab.core.common/src/main/java/org/integratedmodelling/common/services/client/resources/ResourcesClient.java index 3462156df..438c3d021 100644 --- a/klab.core.common/src/main/java/org/integratedmodelling/common/services/client/resources/ResourcesClient.java +++ b/klab.core.common/src/main/java/org/integratedmodelling/common/services/client/resources/ResourcesClient.java @@ -21,7 +21,6 @@ import org.integratedmodelling.klab.api.knowledge.organization.ProjectStorage; import org.integratedmodelling.klab.api.knowledge.organization.Workspace; import org.integratedmodelling.klab.api.lang.kactors.KActorsBehavior; -import org.integratedmodelling.klab.api.lang.kdl.KdlDataflow; import org.integratedmodelling.klab.api.lang.kim.*; import org.integratedmodelling.klab.api.scope.*; import org.integratedmodelling.klab.api.services.*; @@ -295,7 +294,7 @@ public KlabData contextualize(Resource contextualizedResource, Scope scope) { } @Override - public KdlDataflow resolveDataflow(String urn, Scope scope) { + public KimObservationStrategyDocument resolveDataflow(String urn, Scope scope) { // TODO Auto-generated method stub return null; } diff --git a/klab.core.common/src/main/java/org/integratedmodelling/common/services/client/scope/ClientContextScope.java b/klab.core.common/src/main/java/org/integratedmodelling/common/services/client/scope/ClientContextScope.java index 5d269affb..256465123 100644 --- a/klab.core.common/src/main/java/org/integratedmodelling/common/services/client/scope/ClientContextScope.java +++ b/klab.core.common/src/main/java/org/integratedmodelling/common/services/client/scope/ClientContextScope.java @@ -3,6 +3,7 @@ import org.apache.commons.lang3.concurrent.ConcurrentUtils; import org.integratedmodelling.common.utils.Utils; import org.integratedmodelling.klab.api.data.RuntimeAsset; +import org.integratedmodelling.klab.api.data.Storage; import org.integratedmodelling.klab.api.exceptions.KlabInternalErrorException; import org.integratedmodelling.klab.api.knowledge.Observable; import org.integratedmodelling.klab.api.knowledge.SemanticType; diff --git a/klab.core.services/src/main/java/org/integratedmodelling/klab/services/scopes/ServiceContextScope.java b/klab.core.services/src/main/java/org/integratedmodelling/klab/services/scopes/ServiceContextScope.java index efb847a1e..e104f9266 100644 --- a/klab.core.services/src/main/java/org/integratedmodelling/klab/services/scopes/ServiceContextScope.java +++ b/klab.core.services/src/main/java/org/integratedmodelling/klab/services/scopes/ServiceContextScope.java @@ -6,6 +6,7 @@ import org.integratedmodelling.common.utils.Utils; import org.integratedmodelling.klab.api.collections.Parameters; import org.integratedmodelling.klab.api.data.RuntimeAsset; +import org.integratedmodelling.klab.api.data.Storage; import org.integratedmodelling.klab.api.digitaltwin.DigitalTwin; import org.integratedmodelling.klab.api.exceptions.KlabInternalErrorException; import org.integratedmodelling.klab.api.exceptions.KlabResourceAccessException; diff --git a/klab.services.resolver/src/main/java/org/integratedmodelling/klab/services/resolver/ResolverService.java b/klab.services.resolver/src/main/java/org/integratedmodelling/klab/services/resolver/ResolverService.java index 5d7be8aac..ab3ae2211 100644 --- a/klab.services.resolver/src/main/java/org/integratedmodelling/klab/services/resolver/ResolverService.java +++ b/klab.services.resolver/src/main/java/org/integratedmodelling/klab/services/resolver/ResolverService.java @@ -316,7 +316,7 @@ private String encodeServiceCall(ServiceCall contextualizable, int offset, Map resources) { // TODO extract resource parameters and substitute with variables return org.integratedmodelling.common.utils.Utils.Strings.spaces(offset) + contextualizable.encode( - Language.KDL); + Language.KOBSERVATION); } /** diff --git a/klab.services.resources.server/src/main/java/org/integratedmodelling/resources/server/controllers/ResourcesProviderController.java b/klab.services.resources.server/src/main/java/org/integratedmodelling/resources/server/controllers/ResourcesProviderController.java index 11ce77ce2..2d4767d9f 100644 --- a/klab.services.resources.server/src/main/java/org/integratedmodelling/resources/server/controllers/ResourcesProviderController.java +++ b/klab.services.resources.server/src/main/java/org/integratedmodelling/resources/server/controllers/ResourcesProviderController.java @@ -11,7 +11,6 @@ import org.integratedmodelling.klab.api.knowledge.organization.Project; import org.integratedmodelling.klab.api.knowledge.organization.Workspace; import org.integratedmodelling.klab.api.lang.kactors.KActorsBehavior; -import org.integratedmodelling.klab.api.lang.kdl.KdlDataflow; import org.integratedmodelling.klab.api.lang.kim.*; import org.integratedmodelling.klab.api.scope.ContextScope; import org.integratedmodelling.klab.api.services.resolver.Coverage; @@ -180,7 +179,7 @@ public class ResourcesProviderController { } @GetMapping(ServicesAPI.RESOURCES.RESOLVE_DATAFLOW_URN) - public @ResponseBody KdlDataflow resolveDataflow(@PathVariable("urn") String urn, Principal principal) { + public @ResponseBody KimObservationStrategyDocument resolveDataflow(@PathVariable("urn") String urn, Principal principal) { return resourcesServer.klabService().resolveDataflow(urn, principal instanceof EngineAuthorization authorization ? authorization.getScope() : null); } diff --git a/klab.services.resources/src/main/java/org/integratedmodelling/klab/services/resources/ResourcesProvider.java b/klab.services.resources/src/main/java/org/integratedmodelling/klab/services/resources/ResourcesProvider.java index d6eaf06ac..91756bc8a 100644 --- a/klab.services.resources/src/main/java/org/integratedmodelling/klab/services/resources/ResourcesProvider.java +++ b/klab.services.resources/src/main/java/org/integratedmodelling/klab/services/resources/ResourcesProvider.java @@ -7,7 +7,6 @@ import org.integratedmodelling.common.services.ResourcesCapabilitiesImpl; import org.integratedmodelling.klab.api.authentication.CRUDOperation; import org.integratedmodelling.klab.api.authentication.ResourcePrivileges; -import org.integratedmodelling.klab.api.collections.Pair; import org.integratedmodelling.klab.api.collections.Parameters; import org.integratedmodelling.klab.api.data.KlabData; import org.integratedmodelling.klab.api.data.Metadata; @@ -25,7 +24,6 @@ import org.integratedmodelling.klab.api.knowledge.organization.ProjectStorage; import org.integratedmodelling.klab.api.knowledge.organization.Workspace; import org.integratedmodelling.klab.api.lang.kactors.KActorsBehavior; -import org.integratedmodelling.klab.api.lang.kdl.KdlDataflow; import org.integratedmodelling.klab.api.lang.kim.*; import org.integratedmodelling.klab.api.scope.*; import org.integratedmodelling.klab.api.services.Reasoner; @@ -37,7 +35,6 @@ import org.integratedmodelling.klab.api.services.runtime.Message; import org.integratedmodelling.klab.api.services.runtime.Notification; import org.integratedmodelling.klab.api.services.runtime.extension.Instance; -import org.integratedmodelling.klab.components.ComponentRegistry; import org.integratedmodelling.klab.configuration.ServiceConfiguration; import org.integratedmodelling.klab.resources.FileProjectStorage; import org.integratedmodelling.klab.services.ServiceStartupOptions; @@ -337,7 +334,7 @@ public KlabData contextualize(Resource contextualizedResource, Scope scope) { } @Override - public KdlDataflow resolveDataflow(String urn, Scope scope) { + public KimObservationStrategyDocument resolveDataflow(String urn, Scope scope) { // TODO Auto-generated method stub return null; }