public void changeLinkWeight(String linkId, double weight) { LabeledLink link = this.getLinkById(linkId); if (link == null) { logger.error("Could not find the link with the id " + linkId); return; } this.graphBuilder.changeLinkWeight(link, weight); }
/** * This method just deletes the specified link from the graph and leaves the rest of the graph untouched. * @param linkId * @return */ public boolean removeLink(String linkId) { LabeledLink link = this.getLinkById(linkId); if (link != null) { // return this.graphBuilder.removeLink(link); if (this.graphBuilder.removeLink(link)) if (this.steinerTree != null) { this.steinerTree.removeEdge(link); return true; } } logger.debug("Cannot find the link " + linkId + " in the graph."); return false; }
private void refineInitialEdges(Alignment alignment) { int j = initialEdges.length() - 1; while (j >= 0) { JSONObject initialEdge = initialEdges.getJSONObject(j); String edgeUri = initialEdge.getString(LinkJsonKeys.edgeId.name()); String sourceId = initialEdge.getString(LinkJsonKeys.edgeSourceId.name()); String targetId = initialEdge.getString(LinkJsonKeys.edgeTargetId.name()); String linkId = LinkIdFactory.getLinkId(edgeUri, sourceId, targetId); if (alignment.getLinkById(linkId) == null) { // the link is not even in the graph initialEdges.remove(j); } j--; } }
private UpdateContainer deleteLink(Alignment alignment, OntologyManager ontMgr, JSONObject edge) throws JSONException { UpdateContainer uc = new UpdateContainer(); String targetId = edge.getString(LinkJsonKeys.edgeTargetId.name()); String edgeUri = edge.getString(LinkJsonKeys.edgeId.name()); String linkId = LinkIdFactory.getLinkId( edgeUri, edge.getString(LinkJsonKeys.edgeSourceId.name()), targetId); // Add info to description string LabeledLink delLink = alignment.getLinkById(linkId); if(delLink != null) { this.displayLabel = delLink.getLabel().getDisplayName(); } else { this.displayLabel = edgeUri; } alignment.removeLink(linkId); return uc; }
for (LabeledLink e : this.steinerTree.edgeSet()) { LabeledLink l = this.getLinkById(e.getId());
newEdge.getString(LinkJsonKeys.edgeSourceId.name()), newEdge.getString(LinkJsonKeys.edgeTargetId.name())); LabeledLink link = alignment.getLinkById(linkId); if(!link.isMainProvenanceLink()) { link = getMainProvenanceLink(alignment, link);
private void addProvenaceLinks(Alignment alignment, Label linkLabel, LiteralNode targetNode) { String targetId = targetNode.getId(); Set<Node> internalNodes = alignment.getNodesByType(NodeType.InternalNode); String edgeUri = linkLabel.getUri(); for(Node internalNode : internalNodes) { String nodeId = internalNode.getId(); Set<LabeledLink> inLinks = alignment.getIncomingLinksInTree(nodeId); Set<LabeledLink> outLinks = alignment.getOutgoingLinksInTree(nodeId); if((inLinks != null && inLinks.size() > 0) || (outLinks != null && outLinks.size() > 0)) { String linkId = LinkIdFactory.getLinkId(edgeUri, nodeId, targetId); LabeledLink link = alignment.getLinkById(linkId); if(link == null) { link = alignment.addObjectPropertyLink(internalNode, targetNode, linkLabel); alignment.changeLinkStatus(linkId, LinkStatus.ForcedByUser); link.setProvenance(true, false); } } } }
LabeledLink link = this.getLinkById(linkId); if (link == null) { logger.error("could not find the link " + linkId + " in the model."); for (LabeledLink e : this.steinerTree.edgeSet()) { LabeledLink l = this.getLinkById(e.getId());
LabeledLink link = alignment.getLinkById(linkId); if (link != null) { LabeledLink newLink = alignment.getLinkById(linkId); if (newLink != null) { alignment.changeLinkStatus(linkId, LinkStatus.ForcedByUser);
public void changeLinkStatus(String linkId, LinkStatus newStatus) { logger.debug("changing the status of link " + linkId + " to " + newStatus.name()); LabeledLink link = this.getLinkById(linkId); if (link == null) { if (newStatus == LinkStatus.ForcedByUser) { Node source = this.getNodeById(LinkIdFactory.getLinkSourceId(linkId)); Node target = this.getNodeById(LinkIdFactory.getLinkTargetId(linkId)); String linkUri = LinkIdFactory.getLinkUri(linkId); LabeledLink newLink; if (linkUri.equalsIgnoreCase(Uris.RDFS_SUBCLASS_URI)) newLink = new SubClassLink(linkId); else newLink = new ObjectPropertyLink(linkId, this.graphBuilder.getOntologyManager().getUriLabel(linkUri), this.graphBuilder.getOntologyManager().getObjectPropertyType(source.getLabel().getUri(), target.getLabel().getUri(), linkUri)); newLink.setStatus(LinkStatus.ForcedByUser); this.graphBuilder.addLink(source, target, newLink); } } else this.graphBuilder.changeLinkStatus(link, newStatus); }
columnNode.setForced(false); LabeledLink currentLink = alignment.getLinkById(linkId); alignment.removeLink(linkId); Node domain = currentLink.getSource();
.equals(METAPROPERTY_NAME.isSpecializationForEdge)) { LabeledLink propertyLink = alignment.getLinkById(metaPropertyId); Node classInstanceNode = alignment.getNodeById(LinkIdFactory .getLinkSourceId(metaPropertyId)); alignment.changeLinkStatus(newLink.getId(), LinkStatus.ForcedByUser); propertyLink = alignment.getLinkById(metaPropertyId);