@Override public int compareTo(Node node) { //compare id return this.id.compareTo(node.getId()); }
@Override public int hashCode() { return this.getId().hashCode(); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != this.getClass()) { return false; } Node node = (Node) obj; return this.id.equals(node.getId()); }
public void printLevels() { for (Entry<Node, Integer> entry : this.nodesLevel.entrySet()) { logger.debug(entry.getKey().getId() + " ---> " + entry.getValue().intValue()); } }
public void printSpans() { for (Entry<Node, Set<ColumnNode>> entry : this.nodesSpan.entrySet()) { logger.debug(entry.getKey().getId() + " spans ---> "); if (entry.getValue() != null) for (ColumnNode columnNode : entry.getValue()) { logger.debug("\t" + columnNode.getColumnName()); } } }
public void printModel(DirectedWeightedMultigraph<Node, LabeledLink> model) { logger.debug("Vertices: "); for(Node n : model.vertexSet()) { logger.debug("\t" + n.getId()); } logger.debug("Edges: "); for(LabeledLink l : model.edgeSet()) { logger.debug("\t" + l.getSource().getId() + " --> " + l.getTarget().getId()); } }
public DataPropertyOfColumnLink addDataPropertyOfColumnLink(Node source, Node target, String specializedColumnHNodeId, String specializedLinkId) { String id = LinkIdFactory.getLinkId(Uris.DATAPROPERTY_OF_COLUMN_LINK_URI, source.getId(), target.getId()); DataPropertyOfColumnLink link = new DataPropertyOfColumnLink(id, specializedColumnHNodeId, specializedLinkId); if (this.graphBuilder.addLink(source, target, link)) return link; return null; }
public ClassInstanceLink addClassInstanceLink(Node source, Node target, LinkKeyInfo keyInfo) { String id = LinkIdFactory.getLinkId(Uris.CLASS_INSTANCE_LINK_URI, source.getId(), target.getId()); ClassInstanceLink link = new ClassInstanceLink(id, keyInfo); if (this.graphBuilder.addLink(source, target, link)) return link; return null; }
public ObjectPropertySpecializationLink addObjectPropertySpecializationLink(Node source, Node target, String specializedLinkId) { String id = LinkIdFactory.getLinkId(Uris.OBJECTPROPERTY_SPECIALIZATION_LINK_URI, source.getId(), target.getId()); ObjectPropertySpecializationLink link = new ObjectPropertySpecializationLink(id, specializedLinkId); if (this.graphBuilder.addLink(source, target, link)) return link; return null; }
public ColumnSubClassLink addColumnSubClassOfLink(Node source, Node target) { String id = LinkIdFactory.getLinkId(Uris.COLUMN_SUBCLASS_LINK_URI, source.getId(), target.getId()); ColumnSubClassLink link = new ColumnSubClassLink(id); if (this.graphBuilder.addLink(source, target, link)) return link; return null; }
public DataPropertyLink addDataPropertyLink(Node source, Node target, Label label, boolean isProvenance) { String id = LinkIdFactory.getLinkId(label.getUri(), source.getId(), target.getId()); DataPropertyLink link = new DataPropertyLink(id, label, isProvenance); if (this.graphBuilder.addLink(source, target, link)) return link; return null; }
public boolean addNode(Node node) { if (super.addNode(node)) { SteinerNode n = new SteinerNode(node.getId()); getTopKGraphNodes().put(n.getNodeId(), n); getTopKGraph().put(n, new TreeSet<SteinerEdge>()); return true; } else return false; }
public boolean addLink(Node source, Node target, DefaultLink link, Double weight) { if (super.addLink(source, target, link, weight)) { SteinerNode n1 = new SteinerNode(source.getId()); SteinerNode n2 = new SteinerNode(target.getId()); SteinerEdge e = new SteinerEdge(n1, link.getId(), n2, (float)weight.doubleValue()); if (link instanceof LabeledLink) { e.setModelIds(((LabeledLink)link).getModelIds()); } // getTopKGraph().get(n1).add(e); getTopKGraph().get(n2).add(e); // each node only stores its incoming links return true; } else return false; }
public boolean removeLink(DefaultLink link) { if (super.removeLink(link)) { SteinerNode n1 = new SteinerNode(link.getSource().getId()); SteinerNode n2 = new SteinerNode(link.getTarget().getId()); SteinerEdge e = new SteinerEdge(n1, link.getId(), n2, (float)link.getWeight()); // getTopKGraph().get(n1).remove(e); getTopKGraph().get(n2).remove(e); return true; } else return false; }
private void createTripleMaps() { Set<Node> nodes = alignmentGraph.vertexSet(); for (Node node:nodes) { if (node instanceof InternalNode) { // Create a TriplesMap corresponding to the Internal node SubjectMap subjMap = r2rmlMapping.getSubjectMapIndex().get(node.getId()); TriplesMap trMap = new TriplesMap(TriplesMap.getNewId(), subjMap); r2rmlMapping.getTriplesMapIndex().put(node.getId(), trMap); this.r2rmlMapping.addTriplesMap(trMap); r2rmlMapping.getAuxInfo().getTriplesMapGraph().addTriplesMap(trMap); } } }
private LabeledLink getMainProvenanceLink(Alignment alignment, LabeledLink link) { String edgeUri = link.getUri(); for(LabeledLink otherLink : alignment.getCurrentIncomingLinksToNode(link.getTarget().getId())) { if(otherLink.getUri().equals(edgeUri) && otherLink.isMainProvenanceLink()) return otherLink; } return null; }
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); } }
public static String gethNodeId(String alignmentId, String columnUri) { Alignment alignment = AlignmentManager.Instance().getAlignment(alignmentId); Set<LabeledLink> tmp = alignment.getCurrentOutgoingLinksToNode(columnUri); String hNodeId = null; for (LabeledLink link : tmp) { if (link.getKeyType() == LinkKeyInfo.UriOfInstance) { hNodeId = link.getTarget().getId(); } } return hNodeId; }