String nodeId = node.getId();
writer.object();
// Check if a semantic type exists for the HNode
SemanticType type = types.getSemanticTypeForHNodeId(nodeId);
if (type != null && type.getConfidenceLevel() != SemanticType.ConfidenceLevel.Low) {
writer.key(JsonKeys.HNodeId.name())
.value(type.getHNodeId())
.key(JsonKeys.SemanticTypesArray.name()).array();
ColumnNode alignmentColumnNode = hNodeIdTocolumnNodeMap.get(type.getHNodeId());
InternalNode domainNode = hNodeIdToDomainNodeMap.get(type.getHNodeId());
if (alignmentColumnNode == null || domainNode == null) {
logger.error("Column node or domain node not found in alignment." +
" (This should not happen conceptually!):" + type);
continue;
}
// Add the primary semantic type
writer.object()
.key(JsonKeys.Origin.name())
.value(type.getOrigin().name())
.key(JsonKeys.ConfidenceLevel.name())
.value(type.getConfidenceLevel().name())
.key(JsonKeys.isPrimary.name())
.value(true);
// Add the RDF literal type to show in the text box
String rdfLiteralType = alignmentColumnNode.getRdfLiteralType() == null? "" :
alignmentColumnNode.getRdfLiteralType().getDisplayName();
writer.key(JsonKeys.rdfLiteralType.name())
.value(rdfLiteralType);
// String domainDisplayLabel = (domainNode.getLabel().getPrefix() != null && (!domainNode.getLabel().getPrefix().equals(""))) ?
// (domainNode.getLabel().getPrefix() + ":" + domainNode.getLocalId()) : domainNode.getLocalId();
if (!type.isClass()) {
writer
.key(JsonKeys.FullType.name()).value(type.getType().getUri())
.key(JsonKeys.DisplayLabel.name()).value(type.getType().getDisplayName())
.key(JsonKeys.DomainId.name()).value(domainNode.getId())
.key(JsonKeys.DomainUri.name()).value(domainNode.getUri())
.key(JsonKeys.DisplayDomainLabel.name()).value(domainNode.getDisplayId());
} else {
writer
.key(JsonKeys.FullType.name()).value(domainNode.getId())
.key(JsonKeys.DisplayLabel.name()).value(domainNode.getDisplayId())
.key(JsonKeys.DomainId.name()).value("")
.key(JsonKeys.DomainUri.name()).value("")
.key(JsonKeys.DisplayDomainLabel.name())
.value("");
}
// Mark the special properties
writer
.key(JsonKeys.isMetaProperty.name())
.value(isMetaProperty(type.getType(), alignmentColumnNode));
writer.endObject();
// Iterate through the synonym semantic types