LinkKeyInfo.UriOfInstance);
alignment.changeLinkStatus(newLink.getId(),
LinkStatus.ForcedByUser);
// Create the semantic type object
newType = new SemanticType(hNodeId,
ClassInstanceLink.getFixedLabel(), classNode.getLabel(),
SemanticType.Origin.User, 1.0);
} else if (metaPropertyName
.equals(METAPROPERTY_NAME.isSpecializationForEdge)) {
LabeledLink propertyLink = alignment.getLinkById(metaPropertyId);
if (propertyLink == null) {
String errorMessage = "Error while specializing a link. The DefaultLink '"
+ metaPropertyId
+ "' should already be in the alignment, but it is not.";
logger.error(errorMessage);
return new UpdateContainer(new ErrorUpdate(errorMessage));
}
Node classInstanceNode = alignment.getNodeById(LinkIdFactory
.getLinkSourceId(metaPropertyId));
if (semanticTypeAlreadyExists) {
clearOldSemanticTypeLink(oldIncomingLinkToColumnNode,
oldDomainNode, alignment, classInstanceNode);
}
if (propertyLink instanceof DataPropertyLink) {
String targetHNodeId = ((ColumnNode) propertyLink.getTarget())
.getHNodeId();
LabeledLink newLink = alignment.addDataPropertyOfColumnLink(classInstanceNode,
columnNode, targetHNodeId, propertyLink.getId());
alignment.changeLinkStatus(newLink.getId(),
LinkStatus.ForcedByUser);
// Create the semantic type object
newType = new SemanticType(hNodeId,
DataPropertyOfColumnLink.getFixedLabel(),
classInstanceNode.getLabel(), SemanticType.Origin.User,
1.0);
} else if (propertyLink instanceof ObjectPropertyLink) {
LabeledLink newLink = alignment.addObjectPropertySpecializationLink(
classInstanceNode, columnNode, propertyLink.getId());
alignment.changeLinkStatus(newLink.getId(),
LinkStatus.ForcedByUser);
// Create the semantic type object
newType = new SemanticType(hNodeId,
ObjectPropertySpecializationLink.getFixedLabel(),
classInstanceNode.getLabel(), SemanticType.Origin.User,
1.0);
}
} else if (metaPropertyName.equals(METAPROPERTY_NAME.isSubclassOfClass)) {
Node classNode = alignment.getNodeById(metaPropertyId);
if (semanticTypeAlreadyExists) {
clearOldSemanticTypeLink(oldIncomingLinkToColumnNode,
oldDomainNode, alignment, classNode);
}
if (classNode == null) {
Label classNodeLabel = ontMgr.getUriLabel(metaPropertyUri);
if (classNodeLabel == null) {
String errorMessage = "Error while setting an advances subclass. MetaPropertyValue '"
+ metaPropertyUri
+ "' should be in the Ontology Manager, but it is not.";
logger.error(errorMessage);
return new UpdateContainer(new ErrorUpdate(errorMessage));
}
classNode = alignment.addInternalNode(classNodeLabel);
}
LabeledLink newLink = alignment.addColumnSubClassOfLink(classNode, columnNode);
alignment.changeLinkStatus(newLink.getId(),
LinkStatus.ForcedByUser);
// Create the semantic type object
newType = new SemanticType(hNodeId,
ColumnSubClassLink.getFixedLabel(), classNode.getLabel(),
SemanticType.Origin.User, 1.0);
}
columnNode.setUserSelectedSemanticType(newType);