/** * returns all the new nodes that should be added to the graph due to adding the input node * @param node * @param closure: contains all the nodes that are connected to the input node * by ObjectProperty or SubClass links * @return */ private void addNodeClosure(Node node, Set<Node> newAddedNodes) { logger.debug("<enter"); if (newAddedNodes == null) newAddedNodes = new HashSet<>(); String uri = node.getUri(); if (this.uriClosure.get(uri) != null) // the closure is already computed and added to the graph. return; Set<String> uriClosure = computeUriClosure(uri); for (String c : uriClosure) { Set<Node> nodesOfSameUri = this.uriToNodesMap.get(c); if (nodesOfSameUri == null || nodesOfSameUri.isEmpty()) { // the internal node is not added to the graph before Node nn = new InternalNode(nodeIdFactory.getNodeId(c), ontologyManager.getUriLabel(c)); if (addNode(nn)) newAddedNodes.add(nn); } } logger.debug("exit>"); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SemanticTypeMapping other = (SemanticTypeMapping) obj; if (link == null) { if (other.link != null) return false; } else if (!link.equals(other.link)) return false; if (source == null) { if (other.source != null) return false; } else if (!source.equals(other.source)) return false; return true; }
public InternalNode addInternalNode(InternalNode node) { Node n = this.getNodeById(node.getId()); if (n == null) { if (this.graphBuilder.addNodeAndUpdate(node)) { this.nodeIdFactory.addNodeId(node.getId(), node.getUri()); return node; } else { logger.error("error in adding the internal node " + node.getId() + " to the graph"); return null; } } if (n instanceof InternalNode) return (InternalNode)n; return null; }
String id = this.nodeIdFactory.getNodeId(node.getUri()); InternalNode newNode = new InternalNode(id, node.getLabel()); logger.error("could not add the new node " + newNode.getId()); return null;
source = new InternalNode(nodeId, new Label(domainUri)); if (!this.graphBuilder.addNodeAndUpdate(source, addedNodes)) return null; addedNodes.add(target); String linkId = LinkIdFactory.getLinkId(propertyUri, source.getId(), target.getId()); LabeledLink link; if (propertyUri.equalsIgnoreCase(ClassInstanceLink.getFixedLabel().getUri()))
nodeId = nodeUri + (alignment.getLastIndexOfNodeUri(nodeUri) + 1); InternalNode node = new InternalNode(nodeId, ontMgr.getUriLabel(nodeUri)); Node addedNode = alignment.addInternalNode(node); if (addedNode != null) nodeLabel = node.getDisplayId();
public boolean addNode(InternalNode n) { if (this.nodes.contains(n)) return false; this.nodes.add(n); this.nodeCoherence.updateCoherence(n); if (n.getModelIds() == null || n.getModelIds().isEmpty()) this.nonModelNodesCount ++; this.computeScore(); return true; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((link == null) ? 0 : link.hashCode()); result = prime * result + ((source == null) ? 0 : source.hashCode()); return result; }
source = new InternalNode(nodeId, new Label(domainUri)); if (!this.graphBuilder.addNodeAndUpdate(source, addedNodes)) return null; addedNodes.add(target); String linkId = LinkIdFactory.getLinkId(propertyUri, source.getId(), target.getId()); LabeledLink link; if (propertyUri.equalsIgnoreCase(ClassInstanceLink.getFixedLabel().getUri()))
this.nodes.add(n1); this.nodeCoherence.updateCoherence(n1); if (n1.getModelIds() == null || n1.getModelIds().isEmpty()) this.nonModelNodesCount ++;
public InternalNode addInternalNode(Label label) { String id = nodeIdFactory.getNodeId(label.getUri()); InternalNode node = new InternalNode(id, label); if (this.graphBuilder.addNodeAndUpdate(node)) return node; return null; }
private void addInternalNodes(SemanticModel model, Set<InternalNode> addedNodes) { if (model == null || model.getGraph() == null) return; if (addedNodes == null) addedNodes = new HashSet<>(); HashMap<String, Integer> uriCount = new HashMap<>(); for (Node n : model.getGraph().vertexSet()) { if (n instanceof InternalNode) { Integer count = uriCount.get(n.getUri()); if (count == null) uriCount.put(n.getUri(), 1); else uriCount.put(n.getUri(), count.intValue() + 1); } } for (Map.Entry<String, Integer> stringIntegerEntry : uriCount.entrySet()) { int modelNodeCount = stringIntegerEntry.getValue(); Set<Node> matchedNodes = this.graphBuilder.getUriToNodesMap().get(stringIntegerEntry.getKey()); int graphNodeCount = matchedNodes == null ? 0 : matchedNodes.size(); for (int i = 0; i < modelNodeCount - graphNodeCount; i++) { String id = this.nodeIdFactory.getNodeId(stringIntegerEntry.getKey()); Node n = new InternalNode(id, new Label(stringIntegerEntry.getKey())); if (this.graphBuilder.addNode(n)) addedNodes.add((InternalNode)n); } } }
Node n = new InternalNode(id, new Label(stringIntegerEntry.getKey())); if (this.graphBuilder.addNode(n)) addedNodes.add((InternalNode)n);
n = new InternalNode(id, label); } else if (type == NodeType.ColumnNode) { n = new ColumnNode(id, hNodeId, columnName, rdfLiteralType, language);
private void initialGraph() { logger.debug("<enter"); ModelingConfiguration modelingConfiguration = ModelingConfigurationRegistry.getInstance().getModelingConfiguration(ContextParametersRegistry.getInstance().getContextParameters(ontologyManager.getContextId()).getKarmaHome()); // Add Thing to the Graph if (modelingConfiguration.getThingNode()) { String id = nodeIdFactory.getNodeId(Uris.THING_URI); Label label = new Label(Uris.THING_URI, Namespaces.OWL, Prefixes.OWL); Node thing = new InternalNode(id, label); addNode(thing); } logger.debug("exit>"); }
if (steinerTreeNodeIds.contains(nodeId)) alreadyInTheModel = true; InternalNode node = new InternalNode(nodeId, nodeLabel); nodeSet.put(node, alreadyInTheModel);
n1 = new InternalNode(id, new Label(sourceUri)); if (this.graphBuilder.addNode(n1)) { mapping.put(source, n1); n2 = new InternalNode(id, new Label(targetUri)); if (this.graphBuilder.addNode(n2)) { mapping.put(target, n2);
sourceNode = alignment.addInternalNode(new InternalNode(sourceId, sourceLabel)); targetNode = alignment.addInternalNode(new InternalNode(targetId, targetLabel));
Node n1 = new InternalNode("n1", new Label("http://erlangen-crm.org/current/E55_Type")); Node n2 = new InternalNode("n2", new Label("http://erlangen-crm.org/current/E70_Thing")); Node n3 = new InternalNode("n3", new Label("http://erlangen-crm.org/current/E39_Actor")); Node n4 = new InternalNode("n4", new Label("http://erlangen-crm.org/current/E74_Group"));
source = new InternalNode(sourceId, edgelabel); source = alignment.addInternalNode((InternalNode)source); if (source == null) {