Skip to content

Commit

Permalink
[#258] Fix issues related to refactoring of @parameter annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
blcham committed Sep 13, 2024
1 parent 9498344 commit 2e23bd7
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static void main(String[] args) throws IOException {
// ----- execute pipeline
ExecutionEngine engine = ExecutionEngineFactory.createEngine();
Module module = scriptManager.loadFunction(asArgs.executionTarget);
// module = PipelineFactory.loadModulePipeline(inputDataModel.listObjectsOfProperty(SM.returnModule).next().asResource());
// module = PipelineFactory.loadModulePipeline(inputDataModel.listObjectsOfProperty(SM.JENA.returnModule).next().asResource());

if ( module == null ) {
throw new RuntimeException("Cannot load module/function with id=" + asArgs.executionTarget);
Expand Down
18 changes: 9 additions & 9 deletions s-pipes-core/src/main/java/cz/cvut/spipes/constants/SML.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public static class JENA {
public static final Property serialization = createProperty(SML.serialization);
public static final Property ignoreImports = createProperty(SML.ignoreImports);

public static final Resource ApplyConstruct = createResource("ApplyConstruct");
public static final Resource ExportToRDFFile = createResource("ExportToRDFFile");
public static final Resource ImportRDFFromWorkspace = createResource("ImportRDFFromWorkspace");
public static final Resource ImportFileFromURL = createResource("ImportFileFromURL");
public static final Resource BindWithConstant = createResource("BindWithConstant");
public static final Resource BindBySelect = createResource("BindBySelect");
public static final Resource Merge = createResource("Merge");
public static final Resource ReturnRDF = createResource("ReturnRDF");
public static final Resource JSONLD = createResource("JSONLD");
public static final Resource ApplyConstruct = createResource(SML.ApplyConstruct);
public static final Resource ExportToRDFFile = createResource(SML.ExportToRDFFile);
public static final Resource ImportRDFFromWorkspace = createResource(SML.ImportRDFFromWorkspace);
public static final Resource ImportFileFromURL = createResource(SML.ImportFileFromURL);
public static final Resource BindWithConstant = createResource(SML.BindWithConstant);
public static final Resource BindBySelect = createResource(SML.BindBySelect);
public static final Resource Merge = createResource(SML.Merge);
public static final Resource ReturnRDF = createResource(SML.ReturnRDF);
public static final Resource JSONLD = createResource(SML.JSONLD);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static boolean isModule(Resource res) {
return false;
}
Resource objRes = st.getObject().asResource();
return objRes.hasProperty(RDF.type, SM.Module);
return objRes.hasProperty(RDF.type, SM.JENA.Module);
}
).toList().size() > 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected static List<Resource> getMatchingResourceClasses(Class cls, Model m) {

private static final Set<String> S_PIPES_TERMS = new HashSet<String>() {
{
add(SM.next.getURI());
add(SM.next);
add(RDF.type.getURI());
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private Question generateRootQuestion() {
Resource module = sampleScript.listSubjects().filterKeep(s ->
s.getURI() != null && s.getURI().endsWith("bind-person")
).next();
Resource moduleType = sampleScript.getResource(SML.BindWithConstant.toString());
Resource moduleType = sampleScript.getResource(SML.BindWithConstant);

return new TransformerImpl().script2Form(module, moduleType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ private void writeConstraintsToModel(Model baseRdfModel,
KBSS_MODULE.uri + a.label().replaceAll(" ", "-").toLowerCase()) //todo can be added to the annotation
).ifPresent(r -> baseRdfModel.add(root, RDFS.subClassOf, r));

baseRdfModel.add(root, RDF.type, SM.Module);
baseRdfModel.add(root, RDF.type, SM.JENA.Module);
baseRdfModel.add(root, RDFS.comment, moduleAnnotation.comment());
baseRdfModel.add(root, RDFS.label, moduleAnnotation.label());
for (var annotation : constraintAnnotations) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ExecutionContext executeSelf() {

@Override
public String getTypeURI() {
return KBSS_MODULE.uri+"identity";
return KBSS_MODULE.uri + "identity";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void setUpdateRepository(Repository updateRepository) {
public static Resource createUpdateQueryResource(Model model, String updateQuery) {
return
model.createResource()
.addProperty(RDF.type, SML.updateQuery)
.addProperty(RDF.type, SML.JENA.updateQuery)
.addProperty(SP.text, ResourceFactory.createPlainLiteral(updateQuery));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
import org.topbraid.spin.arq.ARQFactory;
import org.topbraid.spin.model.Construct;
import org.topbraid.spin.system.SPINModuleRegistry;
import org.topbraid.spin.vocabulary.SP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@
import cz.cvut.spipes.recursion.ScrollableCursorProvider;
import cz.cvut.spipes.util.QueryUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
import org.apache.jena.query.*;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.ResourceFactory;
import org.jetbrains.annotations.NotNull;
import org.topbraid.spin.arq.ARQFactory;
import org.topbraid.spin.model.Select;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,16 @@
import cz.cvut.spipes.engine.VariablesBinding;
import cz.cvut.spipes.modules.annotations.SPipesModule;
import cz.cvut.spipes.util.QueryUtils;
import java.util.Objects;

import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
import org.apache.jena.query.*;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.ResourceFactory;
import org.jetbrains.annotations.NotNull;
import org.topbraid.spin.arq.ARQFactory;
import org.topbraid.spin.model.Select;

import java.util.Objects;

/**
* TODO Order of queries is not enforced.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

import org.topbraid.spin.arq.ARQFactory;
import org.topbraid.spin.model.Select;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
import cz.cvut.spipes.rest.util.ScriptManagerFactory;
import cz.cvut.spipes.util.RDFMimeType;
import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.*;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Statement;
import org.apache.jena.vocabulary.OWL;
import org.apache.jena.vocabulary.RDF;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import java.util.LinkedList;
Expand Down Expand Up @@ -59,7 +62,7 @@ public Model retrieveContextData(@PathVariable("id") String id) {
outModel.add(inModel);
outModel.add(SPipesContextController.createInferences(inModel));

outModel.add(SM.next, RDF.type, OWL.ObjectProperty);
outModel.add(SM.JENA.next, RDF.type, OWL.ObjectProperty);

return outModel;
}
Expand All @@ -70,7 +73,7 @@ static List<Statement> createInferences(Model model) {
return PipelineFactory.getModuleTypes().keySet().stream()
.flatMap(mt -> model.listSubjectsWithProperty(RDF.type, mt).toSet().stream())
.map(m -> model.createStatement(
m, RDF.type, SM.Modules
m, RDF.type, SM.JENA.Modules
)).collect(Collectors.toList());
}
}

0 comments on commit 2e23bd7

Please sign in to comment.