public boolean addLink(Node source, Node target, DefaultLink link, Double weight) { if (addLink(source, target, link)) { if (weight != null) changeLinkWeight(link, weight); return true; } return false; }
public SubClassLink addSubClassOfLink(Node source, Node target) { String id = LinkIdFactory.getLinkId(Uris.RDFS_SUBCLASS_URI, source.getId(), target.getId()); SubClassLink link = new SubClassLink(id); if (this.graphBuilder.addLink(source, target, link)) return link; return null; }
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 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 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 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; }
Node source = l.getSource(); 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
if (!this.graphBuilder.addLink(source, target, link)) continue;;
link = new DataPropertyLink(linkId, label); if (!this.graphBuilder.addLink(source, target, link)) return null;
link = new DataPropertyLink(linkId, label); if (!this.graphBuilder.addLink(source, target, link)) return null;
if (allowedChangingGraph) this.graphBuilder.addLink(link.getSource(), link.getTarget(), newLink);
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; } }
for (int i = 0; i < newLinks.size(); i++) { newLink = newLinks.get(i); this.graphBuilder.addLink(sources.get(i), targets.get(i), newLink); this.graphBuilder.changeLinkWeight(newLink, weights.get(i));
this.getGraphBuilder().addLink(source, target, newLink); // returns false if link already exists tree.addEdge(source, target, newLink); tree.setEdgeWeight(newLink, l.getWeight());
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); }
newId = LinkIdFactory.getLinkId(l.getUri(), source.getId(), target.getId()); DefaultLink copyLink = l.getCopy(newId); this.addLink(source, target, copyLink, l.getWeight()); newId = LinkIdFactory.getLinkId(l.getUri(), source.getId(), target.getId()); DefaultLink copyLink = l.getCopy(newId); this.addLink(source, target, copyLink, l.getWeight());