diff --git a/s-pipes-core/src/main/java/cz/cvut/spipes/manager/SPipesScriptManager.java b/s-pipes-core/src/main/java/cz/cvut/spipes/manager/SPipesScriptManager.java index 4b6695ed..7d2f011c 100644 --- a/s-pipes-core/src/main/java/cz/cvut/spipes/manager/SPipesScriptManager.java +++ b/s-pipes-core/src/main/java/cz/cvut/spipes/manager/SPipesScriptManager.java @@ -88,7 +88,7 @@ public Module loadModule(final String moduleId, // TODO check moduleTypeUri - return PipelineFactory.loadPipeline(scriptsRepository.getResource(resourceUri, resourceContextUri)); + return PipelineFactory.loadModule(scriptsRepository.getResource(resourceUri, resourceContextUri)); } public Module loadFunction(String functionId) { @@ -116,6 +116,10 @@ public Set getGlobalScripts() { return globalScripts; } + public boolean doesRegistryContainsEntity(String entityId) { + return moduleRegistry.doesContextContainsEntity(entityId); + } + // id -> contexts // function id-s diff --git a/s-pipes-core/src/main/java/cz/cvut/spipes/registry/JenaResourceRegistry.java b/s-pipes-core/src/main/java/cz/cvut/spipes/registry/JenaResourceRegistry.java index 929858a8..a9911fc1 100644 --- a/s-pipes-core/src/main/java/cz/cvut/spipes/registry/JenaResourceRegistry.java +++ b/s-pipes-core/src/main/java/cz/cvut/spipes/registry/JenaResourceRegistry.java @@ -120,6 +120,10 @@ public Set getContexts(String entityId) { return getResourceUri(entityId, contexts.iterator().next()); } + public boolean doesContextContainsEntity(String entityId) { + return fullName2ContextsMap.containsKey(entityId); + } + private Set getLocalName2Contexts(String localEntityId) { @@ -145,6 +149,7 @@ private boolean isLocalNameEntityId(String entityId) { return !(isPrefixedEntityId(entityId) || isFullNameEntityId(entityId)); } + private boolean isFullNameEntityId(String entityId) { return entityId.contains("#") || entityId.contains("/"); } diff --git a/s-pipes-core/src/main/java/cz/cvut/spipes/registry/ResourceRegistry.java b/s-pipes-core/src/main/java/cz/cvut/spipes/registry/ResourceRegistry.java index 1bae3e3b..c7f747c5 100644 --- a/s-pipes-core/src/main/java/cz/cvut/spipes/registry/ResourceRegistry.java +++ b/s-pipes-core/src/main/java/cz/cvut/spipes/registry/ResourceRegistry.java @@ -21,4 +21,6 @@ public interface ResourceRegistry { @NotNull String getResourceUri(@NotNull String entityId) throws ResourceNotFoundException, ResourceNotUniqueException; + + @NotNull boolean doesContextContainsEntity(@NotNull String entityId); } diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesServiceController.java b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesServiceController.java index 11b65c09..718ca65e 100644 --- a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesServiceController.java +++ b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesServiceController.java @@ -26,9 +26,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; +import java.io.*; import java.net.URL; import java.util.*; import java.util.stream.Collectors; @@ -221,7 +219,13 @@ private Model runModule(final Model inputDataModel, final MultiValueMap