Model model = ds.getDefaultModel();
model.notifyEvent(GraphEvents.startRead);
try {
UUIDFactory factory = new UUID_V4_Gen();
// I add connection tuple Input and Output properties
// Resource subject =
// model.createResource(AdmireRegistryConstants.PlatformOntologyURI
// + processingElement);
Resource processingElementSubject = model
.createResource(AdmireRegistryConstants.PlatformOntologyURI
+ factory.generate().asUUID());
processingElementSubject.addProperty(model
.getProperty(AdmireRegistryConstants.dcterms + "title"),
processingElement);
processingElementSubject.addProperty(model
.getProperty(AdmireRegistryConstants.RDFType), model
.createResource(AdmireRegistryConstants.PlatformOntologyURI
+ peElement.getType()));
Resource subjectConTupleInput = model
.createResource(AdmireRegistryConstants.PlatformOntologyURI
+ connectionTupleInput);
Resource subjectConTupleOutput = model
.createResource(AdmireRegistryConstants.PlatformOntologyURI
+ connectionTupleOutput);
Statement stmConTupleInput = model.createStatement(
processingElementSubject, model.createProperty(hasInput),
subjectConTupleInput);
model.add(stmConTupleInput);
Statement stmConTupleOutput = model.createStatement(
processingElementSubject, model.createProperty(hasOutput),
subjectConTupleOutput);
model.add(stmConTupleOutput);
String property = AdmireRegistryConstants.PlatformOntologyURI
+ "hasRepositoryLocation";
Statement stmPropValue = model.createStatement(
processingElementSubject, model.createProperty(property),
peElement.getLocation());
model.add(stmPropValue);
property = AdmireRegistryConstants.PlatformOntologyURI
+ "hasStatus";
stmPropValue = model.createStatement(processingElementSubject,
model.createProperty(property), "active");
model.add(stmPropValue);
Property predicateContainsConnection = model
.createProperty(containsConnection);
Iterator inputIt = inputList.iterator();
while (inputIt.hasNext()) {
PEParameter input = (PEParameter) inputIt.next();
// I add containsConnection inputName
RDFNode dcTitle = model
.createResource(AdmireRegistryConstants.PlatformOntologyURI
+ input.getName());
RDFNode objectST = model
.createResource(AdmireRegistryConstants.PlatformOntologyURI
+ factory.generate().asUUID());
Statement containsConnectionStm = model.createStatement(
subjectConTupleInput, predicateContainsConnection,
objectST);
model.add(containsConnectionStm);
Statement hasTitle = model.createStatement((Resource) objectST,
model.createProperty(AdmireRegistryConstants.dcterms
+ "title"), dcTitle);
model.add(hasTitle);
// add isDataSourceInput
Statement stmDataSourceInput = null;
stmDataSourceInput = model.createStatement((Resource) objectST,
model.createProperty(hasDataSourceInput), input
.getDataSourceInput());
model.add(stmDataSourceInput);
// add SType if any
if (input != null) {
Property predicateST = model
.createProperty(hasStructuralType);
if (input.getSTypeType().equals("PrimitiveSType")) {
addPrimitiveSType(model, input, containsConnectionStm,
predicateST, input.getDType());
} else if (input.getSTypeType().equals("any")) {
addAnyST(model, input, containsConnectionStm,
predicateST, input.getDType());
} else if (input.getSTypeType().equals("Array")) {
addArray(model, input, containsConnectionStm,
predicateST, input.getDType());
} else if (input.getSTypeType().equals("List")) {
addList(model, input, containsConnectionStm,
predicateST, input.getDType());
} else if (input.getSTypeType().equals("Tuple")) {
addTuple(model, input.getSType(),
containsConnectionStm, predicateST, input
.getDType());
}
// add equals property
// what I have to do is to say that two inputs are the
// same, to do that I have to add a property equalsTo in
// Connection, when I add the Structural types, which
// are of type any
} else {
// should I add something if there is no SType?
}
}
predicateContainsConnection = model
.createProperty(containsConnection);
Iterator outputIt = outputList.iterator();
while (outputIt.hasNext()) {
PEParameter output = (PEParameter) outputIt.next();
// I add containsConnection inputName
RDFNode object = model
.createResource(AdmireRegistryConstants.PlatformOntologyURI
+ factory.generate().asString());
Statement containsConnectionStm = model.createStatement(
subjectConTupleOutput, predicateContainsConnection,
object);
model.add(containsConnectionStm);