// String value = newValues.get(uri);
// newValues.put(uri, value);
// }
// prepare info for creation of the ontology:
CreateOntologyInfo createOntologyInfo = new CreateOntologyInfo();
// transfer info about prior ontology, if any, for eventual creation of new version:
if ( ontologyInfo instanceof RegisteredOntologyInfo ) {
RegisteredOntologyInfo roi = (RegisteredOntologyInfo) ontologyInfo;
createOntologyInfo.setPriorOntologyInfo(
roi.getOntologyId(),
roi.getOntologyUserId(),
roi.getVersionNumber()
);
}
createOntologyInfo.setUri(ontologyInfo.getUri());
if ( ontologyInfo instanceof RegisteredOntologyInfo ) {
RegisteredOntologyInfo roi = (RegisteredOntologyInfo) ontologyInfo;
createOntologyInfo.setAuthority(roi.getAuthority());
createOntologyInfo.setShortName(roi.getShortName());
}
createOntologyInfo.setMetadataValues(newValues);
String authority = createOntologyInfo.getAuthority();
String shortName = createOntologyInfo.getShortName();
if ( authority == null || authority.trim().length() == 0 ) {
// TODO improve this code:
authority = newValues.get("http://mmisw.org/ont/mmi/20081020/ontologyMetadata/origMaintainerCode");
if ( authority == null || authority.trim().length() == 0 ) {
authority = "mmitest"; // TODO
}
createOntologyInfo.setAuthority(authority);
}
if ( shortName == null || shortName.trim().length() == 0 ) {
// TODO improve this code:
shortName = newValues.get("http://omv.ontoware.org/2005/05/ontology#acronym");
if ( shortName == null || shortName.trim().length() == 0 ) {
shortName = "shorttest"; // TODO
}
createOntologyInfo.setShortName(shortName);
}
createOntologyInfo.setDataCreationInfo(dataCreationInfo);
// if ( dataCreationInfo instanceof VocabularyDataCreationInfo
// || dataCreationInfo instanceof OtherDataCreationInfo
// ) {
// // OK: continue
// }
// else {
// Window.alert("sorry, not implemented yet");
// return;
// }
final MyDialog popup = aPopup == null ? new MyDialog(null): aPopup;
if (aPopup == null) {
popup.addTextArea(null).setSize("600", "150");
popup.getTextArea().setText("please wait ...");
PortalControl.getInstance().notifyActivity(true);
popup.center();
popup.show();
}
popup.setText("Creating ontology ...");
AsyncCallback<CreateOntologyResult> callback = new AsyncCallback<CreateOntologyResult>() {
public void onFailure(Throwable thr) {
PortalControl.getInstance().notifyActivity(false);
container.clear();
container.add(new HTML(thr.toString()));
}
public void onSuccess(CreateOntologyResult result) {
log("CreateOntologyResult obtained." + result.getCreateOntologyInfo().getHostingType());
PortalControl.getInstance().notifyActivity(false);
reviewCompleted(popup, result);
}
};
log("Calling service createOntology, hostingType=" +createOntologyInfo.getHostingType());
Orr.service.createOntology(createOntologyInfo, callback);
}