Double weight = null;
Set<SemanticTypeMapping> semanticTypeMatches = this.graphBuilder.getSemanticTypeMatches().get(domainUri + propertyUri);
if (semanticTypeMatches != null) {
for (SemanticTypeMapping stm : semanticTypeMatches) {
SemanticTypeMapping mp =
new SemanticTypeMapping(sourceColumn, semanticType, stm.getSource(), stm.getLink(), stm.getTarget());
mappings.add(mp);
weight = stm.getLink().getWeight();
// foundInternalNodes.add(stm.getSource());
}
}
logger.debug("adding data property to the found internal nodes ...");
Integer count;
boolean allowMultipleSamePropertiesPerNode = ModelingConfiguration.isMultipleSamePropertyPerNode();
Set<Node> nodesWithSameUriOfDomain = this.graphBuilder.getUriToNodesMap().get(domainUri);
if (nodesWithSameUriOfDomain != null) {
for (Node source : nodesWithSameUriOfDomain) {
count = this.graphBuilder.getNodeDataPropertyCount().get(source.getId() + propertyUri);
if (count != null) {
if (allowMultipleSamePropertiesPerNode) {
if (count >= countOfSemanticType.intValue())
continue;
} else {
if (count >= 1)
continue;
}
}
String nodeId = new RandomGUID().toString();
ColumnNode target = new ColumnNode(nodeId, nodeId, sourceColumn.getColumnName(), null);
if (!this.graphBuilder.addNode(target)) continue;;
addedNodes.add(target);
String linkId = LinkIdFactory.getLinkId(propertyUri, source.getId(), target.getId());
LabeledLink link = new DataPropertyLink(linkId, new Label(propertyUri));
boolean result = weight == null ? this.graphBuilder.addLink(source, target, link) : this.graphBuilder.addLink(source, target, link, weight);
if (!result) continue;;
SemanticTypeMapping mp = new SemanticTypeMapping(sourceColumn, semanticType, (InternalNode)source, link, target);
mappings.add(mp);
}
}
return mappings;