public LabeledLink getLinkById(String linkId) { return this.graphBuilder.getIdToLinkMap().get(linkId); }
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 boolean contains(DirectedWeightedMultigraph<Node, LabeledLink> graph) { if (graph == null || this.graphBuilder == null || this.graphBuilder.getGraph() == null) return false; Set<String> commonModelIds = null; LabeledLink matchedLink = null; boolean firstVisit = true; for (LabeledLink l : graph.edgeSet()) { matchedLink = this.graphBuilder.getIdToLinkMap().get(l.getId()); if (matchedLink == null) return false; if (firstVisit) { commonModelIds = matchedLink.getModelIds(); firstVisit = false; } else { if (commonModelIds == null || matchedLink.getModelIds() == null) return false; commonModelIds = Sets.intersection(matchedLink.getModelIds(), commonModelIds); if (commonModelIds.isEmpty()) // no intersection return false; } } return true; } }
public ObjectPropertyLink addObjectPropertyLink(Node source, Node target, Label label) { String id = LinkIdFactory.getLinkId(label.getUri(), source.getId(), target.getId()); ObjectPropertyLink link = new ObjectPropertyLink(id, label, this.graphBuilder.getOntologyManager().getObjectPropertyType(source.getLabel().getUri(), target.getLabel().getUri(), label.getUri())); if (this.graphBuilder.addLink(source, target, link)) { return link; } else if(this.graphBuilder.getIdToLinkMap().containsKey(link.getId())) { return (ObjectPropertyLink) this.graphBuilder.getIdToLinkMap().get(link.getId()); } else { return null; } }
Node target = l.getTarget(); if (!this.graphBuilder.addLink(source, target, l)) { LabeledLink existingLink = this.graphBuilder.getIdToLinkMap().get(l.getId()); if (existingLink != null) { // the link already exist, but it may not be forced by user this.graphBuilder.changeLinkStatus(existingLink, LinkStatus.ForcedByUser);
LabeledLink l = this.graphBuilder.getIdToLinkMap().get(id); if (l != null) { this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT);
LabeledLink l = this.graphBuilder.getIdToLinkMap().get(id); if (l != null) { int numOfPatterns = l.getModelIds().size();
LabeledLink l = this.graphBuilder.getIdToLinkMap().get(id); if (l != null) { int numOfPatterns = l.getModelIds().size();