public void changeLinkStatus(LabeledLink link, LinkStatus newStatus) { if (link == null) return; LabeledLink graphLink = this.getIdToLinkMap().get(link.getId()); // use the graph link, not the tree link sent by the alignment (steiner tree has a copy of the graph link) if (graphLink == null) return; LinkStatus oldStatus = graphLink.getStatus(); if (newStatus == oldStatus) return; graphLink.setStatus(newStatus); link.setStatus(newStatus); this.changeLinkWeight(graphLink, computeWeight(graphLink)); Set<LabeledLink> linksWithOldStatus = this.statusToLinksMap.get(oldStatus); if (linksWithOldStatus != null) linksWithOldStatus.remove(graphLink); if (newStatus == LinkStatus.Normal) // we don't need to index normal links return; Set<LabeledLink> linksWithNewStatus = this.statusToLinksMap.get(newStatus); if (linksWithNewStatus == null) { linksWithNewStatus = new HashSet<>(); statusToLinksMap.put(newStatus, linksWithNewStatus); } linksWithNewStatus.add(graphLink); }
public static String labeledGraphToString(Graph<Node, LabeledLink> graph) { if (graph == null) { logger.debug("The input graph is null."); return ""; } StringBuffer sb = new StringBuffer(); sb.append("*** Nodes ***\n"); for (Node n : graph.vertexSet()) { sb.append(n.getLocalId()); sb.append("\n"); } sb.append("*** Links ***\n"); for (LabeledLink edge : graph.edgeSet()) { sb.append("("); sb.append(edge.getId()); sb.append(" - status=" + edge.getStatus().name()); sb.append(" - w=" + edge.getWeight()); sb.append(" - type=" + edge.getType().name()); sb.append("\n"); } //sb.append("------------------------------------------"); return sb.toString(); }
writer.name("specializedLink").value(((ObjectPropertySpecializationLink)l).getSpecializedLinkId()); writer.name("status").value(l.getStatus().toString()); writer.name("keyInfo").value(l.getKeyType().toString()); writer.name("modelIds");
linksWithSameType.remove(link); Set<LabeledLink> linksWithSameStatus = statusToLinksMap.get(((LabeledLink)link).getStatus()); if (linksWithSameStatus != null) linksWithSameStatus.remove(link);
public void changeLinkWeight(DefaultLink link, double weight) { super.changeLinkWeight(link, weight); SteinerNode n1 = new SteinerNode(link.getSource().getId()); SteinerNode n2 = new SteinerNode(link.getTarget().getId()); SteinerEdge e = new SteinerEdge(n1, link.getId(), n2, (float)weight); if (getTopKGraph().get(n2).remove(e)) { if (link instanceof LabeledLink) { e.setModelIds(((LabeledLink)link).getModelIds()); e.setForced(((LabeledLink)link).getStatus() == LinkStatus.ForcedByUser); } getTopKGraph().get(n2).add(e); } }
if (l.getStatus() == LinkStatus.ForcedByUser) { Node source = l.getSource(); Node target = l.getTarget();
public void updateCoherence(LabeledLink link) { if (link == null) return; if (interactiveMode) { if (link.getStatus() == LinkStatus.ForcedByUser) return; if (link.getTarget() instanceof ColumnNode) { ColumnNode cn = (ColumnNode)link.getTarget(); if (cn.getSemanticTypeStatus() == ColumnSemanticTypeStatus.UserAssigned) return; } } else { if (!(link.getTarget() instanceof InternalNode)) return; } this.itemsCount ++; if (link.getModelIds() == null || link.getModelIds().isEmpty()) return; updateCoherence(link.getModelIds()); }
public boolean addLink(Node source, Node target, DefaultLink link) { if (super.addLink(source, target, link)) { SteinerNode n1 = new SteinerNode(source.getId()); SteinerNode n2 = new SteinerNode(target.getId()); SteinerEdge e = new SteinerEdge(n1, link.getId(), n2, (float)link.getWeight()); if (link instanceof LabeledLink) { e.setModelIds(((LabeledLink)link).getModelIds()); e.setForced(((LabeledLink)link).getStatus() == LinkStatus.ForcedByUser); } // getTopKGraph().get(n1).add(e); getTopKGraph().get(n2).add(e); // each node only stores its incoming links return true; } else return false; }
private double computeWeight(DefaultLink link) { double w = 0.0; if (link instanceof LabeledLink && ((LabeledLink)link).getStatus() == LinkStatus.PreferredByUI) w = ModelingParams.PROPERTY_UI_PREFERRED_WEIGHT; w = ModelingParams.PATTERN_LINK_WEIGHT; if (link instanceof LabeledLink && ((LabeledLink)link).getStatus() == LinkStatus.ForcedByUser) w = ModelingParams.PROPERTY_USER_PREFERRED_WEIGHT;
if (link.getStatus() == LinkStatus.ForcedByUser) return;
linkObj.put(JsonKeys.linkStatus.name(), link.getStatus() .name()); linkObj.put(JsonKeys.linkUri.name(), link.getLabel()
linkObj.put(JsonKeys.rdfsComment.name(), link.getLabel().getRdfsComment()); linkObj.put(JsonKeys.id.name(), link.getId() + ""); linkObj.put(JsonKeys.linkStatus.name(), link.getStatus() .name()); linkObj.put(JsonKeys.linkUri.name(), link.getLabel()
logger.error("cannot instanciate a link from the type: " + this.getType().toString()); newLink.setStatus(this.getStatus()); newLink.setModelIds(new HashSet<>(this.getModelIds())); newLink.setKeyType(this.getKeyType());
if (alignment.getSteinerTree() != null) { for (LabeledLink link : alignment.getSteinerTree().edgeSet()) { if ((link.getStatus() == LinkStatus.Normal || link.getStatus() == LinkStatus.PreferredByUI) && (link.getType() == LinkType.ObjectPropertyLink)) { links.add(link); ChangeInternalNodeLinksCommandFactory cinlcf = new ChangeInternalNodeLinksCommandFactory(); for (LabeledLink link : links) { if(link.getStatus() != LinkStatus.ForcedByUser) { JSONObject newEdge = new JSONObject(); newEdge.put(ChangeInternalNodeLinksCommand.LinkJsonKeys.edgeSourceId.name(), link.getSource().getId());