semanticType.put(ClientJsonKeys.FullType.name(), Uris.CLASS_INSTANCE_LINK_URI);
}
semanticTypesArray.put(semanticType);
Command sstCommand = sstFactory.createCommand(workspace, worksheetId, nestedHNodeId, false, semanticTypesArray, false, "", selection.getName());
appliedCommands.push(sstCommand);
sstCommand.doIt(workspace);
if(!resultClass.get(i).trim().isEmpty())
{
ChangeInternalNodeLinksCommandFactory cinlcf = new ChangeInternalNodeLinksCommandFactory();
SetMetaPropertyCommandFactory smpcf = new SetMetaPropertyCommandFactory();
JSONArray newEdges = new JSONArray();
JSONObject newEdge = new JSONObject();
String sourceId = n.getId();
Set<edu.isi.karma.rep.alignment.Node> tempnodes = new HashSet<edu.isi.karma.rep.alignment.Node>();
tempnodes.addAll(alignment.getNodesByUri(resultClass.get(i)));
tempnodes.removeAll(oldNodes);
edu.isi.karma.rep.alignment.Node target = tempnodes.iterator().next();
String targetId = target.getId();
String targetUri = target.getLabel().getUri();
String edgeUri = resultPredicates.get(i);
if (!incoming) {
newEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeSourceId.name(), sourceId);
newEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeTargetId.name(), targetId);
newEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeId.name(), edgeUri);
}
else {
newEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeSourceId.name(), targetId);
newEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeTargetId.name(), sourceId);
newEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeId.name(), edgeUri);
}
newEdges.put(newEdge);
Command changeInternalNodeLinksCommand = cinlcf.createCommand(worksheetId, alignmentId, new JSONArray(), newEdges, workspace);
changeInternalNodeLinksCommand.doIt(workspace);
appliedCommands.push(changeInternalNodeLinksCommand);
Command setMetaDataCommand = smpcf.createCommand(workspace, nestedHNodeId, worksheetId, "isUriOfClass",
targetUri, targetId, "", selection.getName());
setMetaDataCommand.doIt(workspace);
appliedCommands.push(setMetaDataCommand);
}
}
}