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--; } }
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 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; }
continue; id = LinkIdFactory.getLinkId(uri, sourceId, targetId); label = new Label(ontologyManager.getUriLabel(uri));
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; }
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; }
if(initialEdgeProv && !newEdgeProv) { String linkId = LinkIdFactory.getLinkId( newEdge.getString(LinkJsonKeys.edgeId.name()), newEdge.getString(LinkJsonKeys.edgeSourceId.name()),
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); } } } }
String id = LinkIdFactory.getLinkId(Uris.DEFAULT_LINK_URI, source.getId(), target.getId()); l = new CompactObjectPropertyLink(id, ObjectPropertyType.None);
addedNodes.add(target); String linkId = LinkIdFactory.getLinkId(propertyUri, source.getId(), target.getId()); LabeledLink link = new DataPropertyLink(linkId, new Label(propertyUri)); if (!this.graphBuilder.addLink(source, target, link)) continue;;
addedNodes.add(target); String linkId = LinkIdFactory.getLinkId(propertyUri, source.getId(), target.getId()); LabeledLink link; if (propertyUri.equalsIgnoreCase(ClassInstanceLink.getFixedLabel().getUri()))
addedNodes.add(target); String linkId = LinkIdFactory.getLinkId(propertyUri, source.getId(), target.getId()); LabeledLink link; if (propertyUri.equalsIgnoreCase(ClassInstanceLink.getFixedLabel().getUri()))
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; } }
targets.add(link.getTarget()); id = LinkIdFactory.getLinkId(lf1.getLinkUri(), link.getSource().getId(), link.getTarget().getId()); if (link instanceof ObjectPropertyLink) newLinks.add(new ObjectPropertyLink(id, new Label(lf1.getLinkUri()), ((ObjectPropertyLink) link).getObjectPropertyType())); targets.add(link.getSource()); id = LinkIdFactory.getLinkId(lf2.getLinkUri(), link.getSource().getId(), link.getTarget().getId()); if (link instanceof ObjectPropertyLink) newLinks.add(new ObjectPropertyLink(id, new Label(lf2.getLinkUri()), ((ObjectPropertyLink) link).getObjectPropertyType()));
continue; String id = LinkIdFactory.getLinkId(l.getUri(), source.getId(), target.getId()); LabeledLink newLink = l.copy(id);
if (source instanceof ColumnNode) continue; target = newNode; newId = LinkIdFactory.getLinkId(l.getUri(), source.getId(), target.getId()); DefaultLink copyLink = l.getCopy(newId); this.addLink(source, target, copyLink, l.getWeight()); target = l.getTarget(); if (!copyLinksToColumnNodes && target instanceof ColumnNode) continue; // skip links to column nodes newId = LinkIdFactory.getLinkId(l.getUri(), source.getId(), target.getId()); DefaultLink copyLink = l.getCopy(newId); this.addLink(source, target, copyLink, l.getWeight());
HashMap<String, SemanticType> semanticIdMap = new HashMap<>(); for(SemanticType type : oldSemanticTypes) { String semId = LinkIdFactory.getLinkId(type.getType().getUri(), type.getDomainId(), type.getHNodeId()); semanticIdMap.put(semId, type);