public DisjunctionBranch(final DisjunctionBranch dr, final ABox abox) { super(abox, dr._allDisjonctions.length, dr); _node = abox.getNode(dr._node.getName()); _disjunction = dr._disjunction; _allDisjonctions = dr._allDisjonctions; _prevDS = new DependencySet[dr._allDisjonctions.length]; System.arraycopy(dr._prevDS, 0, _prevDS, 0, dr._allDisjonctions.length); _order = new int[dr._allDisjonctions.length]; System.arraycopy(dr._order, 0, _order, 0, dr._allDisjonctions.length); }
public DisjunctionBranch(final DisjunctionBranch dr, final ABox abox) { super(abox, dr._allDisjonctions.length, dr); _node = abox.getNode(dr._node.getName()); _disjunction = dr._disjunction; _allDisjonctions = dr._allDisjonctions; _prevDS = new DependencySet[dr._allDisjonctions.length]; System.arraycopy(dr._prevDS, 0, _prevDS, 0, dr._allDisjonctions.length); _order = new int[dr._allDisjonctions.length]; System.arraycopy(dr._order, 0, _order, 0, dr._allDisjonctions.length); }
private void findNext() { for (; _index < _stop; _index++) { final Node node = _abox.getNode(_nodeList.get(_index)); if (!node.isPruned() && node.isIndividual()) break; } }
private void findNext() { for (; _index < _stop; _index++) { final Node node = _abox.getNode(_nodeList.get(_index)); if (!node.isPruned() && node.isIndividual()) break; } }
/** * @return the next element of a queue of a given type */ @Override public Node nextLiteral() { //get the next _index findNext(-1); Node node = _abox.getNode(_queue.get(_current)); node = node.getSame(); _current++; return node; }
/** * @return the next element of a _queue of a given type */ @Override public Individual next() { //get the next _index findNext(_currentType); Individual ind = (Individual) _abox.getNode(_queue[_currentType].get(_current[_currentType])); ind = ind.getSame(); _current[_currentType]++; return ind; }
/** * @return the next element of a _queue of a given type */ @Override public Node nextLiteral() { //get the next _index findNext(_currentType); Node node = _abox.getNode(_queue[_currentType].get(_current[_currentType])); node = node.getSame(); _current[_currentType]++; return node; }
public Stream<Individual> nodes() { return new ArrayList<>(_nodeList) //.stream() .parallelStream()// .filter(term -> { final Node node = _abox.getNode(term); return !node.isPruned() && node.isIndividual(); })// .map(_abox::getIndividual); }
/** * @return the next element of a queue of a given type */ @Override public Node nextLiteral() { //get the next _index findNext(-1); Node node = _abox.getNode(_queue.get(_current)); node = node.getSame(); _current++; return node; }
/** * @return the next element of a _queue of a given type */ @Override public Individual next() { //get the next _index findNext(_currentType); Individual ind = (Individual) _abox.getNode(_queue[_currentType].get(_current[_currentType])); ind = ind.getSame(); _current[_currentType]++; return ind; }
public Stream<Individual> nodes() { return new ArrayList<>(_nodeList) //.stream() .parallelStream()// .filter(term -> { final Node node = _abox.getNode(term); return !node.isPruned() && node.isIndividual(); })// .map(_abox::getIndividual); }
/** * @return the next element of a _queue of a given type */ @Override public Node nextLiteral() { //get the next _index findNext(_currentType); Node node = _abox.getNode(_queue[_currentType].get(_current[_currentType])); node = node.getSame(); _current[_currentType]++; return node; }
/** * Find the next _individual in a given _queue * * @param type */ @Override protected void findNext(final int type) { for (; _current[type] < _cutOff[type]; _current[type]++) { Node node = _abox.getNode(_queue[type].get(_current[type])); //because we do not maitain the _queue during restore this _node could be non-existent if (node == null) continue; node = node.getSame(); if (node != null) if ((node instanceof Literal && isAllowLiterals() || node instanceof Individual && !isAllowLiterals()) && !node.isPruned()) break; } }
/** * Find the next _individual in a given _queue * * @param type */ @Override protected void findNext(final int type) { for (; _current[type] < _cutOff[type]; _current[type]++) { Node node = _abox.getNode(_queue[type].get(_current[type])); //because we do not maitain the _queue during restore this _node could be non-existent if (node == null) continue; node = node.getSame(); if (node != null) if ((node instanceof Literal && isAllowLiterals() || node instanceof Individual && !isAllowLiterals()) && !node.isPruned()) break; } }
/** * Find the next _individual in a given queue * * @param type */ @Override protected void findNext(final int type) { for (; _current < _cutOff; _current++) { Node node = _abox.getNode(_queue.get(_current)); //because we do not maitain the _queue during restore this _node could be non-existent if (node == null) continue; node = node.getSame(); if ((node.isLiteral() && isAllowLiterals() || node.isIndividual() && !isAllowLiterals()) && !node.isPruned()) break; } }
/** * Find the next _individual in a given queue * * @param type */ @Override protected void findNext(final int type) { for (; _current < _cutOff; _current++) { Node node = _abox.getNode(_queue.get(_current)); //because we do not maitain the _queue during restore this _node could be non-existent if (node == null) continue; node = node.getSame(); if ((node.isLiteral() && isAllowLiterals() || node.isIndividual() && !isAllowLiterals()) && !node.isPruned()) break; } }
@Test public void testMerge3() { classes(_person, _man, _dog); objectProperties(_sibling, _owns); individuals(_mary, _chris, _victor, _john, _bill); _kb.addPropertyValue(_sibling, _bill, _mary); _kb.addPropertyValue(_sibling, _bill, _john); _kb.addSubClass(_man, some(_owns, _dog)); assertTrue(_kb.isConsistent()); assertFalse(_kb.getABox().getNode(_mary).isSame(_kb.getABox().getNode(_john))); _kb.addType(_bill, max(_sibling, 1, TOP)); _kb.addType(_mary, or(_man, _dog)); _kb.addType(_chris, or(_man, _dog)); assertTrue(_kb.isConsistent()); assertTrue(_kb.getABox().getNode(_mary).isSame(_kb.getABox().getNode(_john))); _kb.removeType(_bill, max(_sibling, 1, TOP)); assertTrue(_kb.isConsistent()); assertFalse(_kb.getABox().getNode(_mary).isSame(_kb.getABox().getNode(_john))); assertFalse(_kb.getABox().getNode(_john).hasType(_man) || _kb.getABox().getNode(_john).hasType(_dog)); assertTrue(_kb.getABox().getNode(_mary).hasType(_man) || _kb.getABox().getNode(_mary).hasType(_dog)); }
@Override protected void updateNodeReferences() { super.updateNodeReferences(); if (_parent != null) _parent = _abox.getIndividual(_parent.getName()); if (isPruned()) { final EdgeList oldEdges = _outEdges; _outEdges = new EdgeList(oldEdges.size()); for (int i = 0; i < oldEdges.size(); i++) { final Edge edge = oldEdges.get(i); final Node to = _abox.getNode(edge.getTo().getName()); final Edge newEdge = new DefaultEdge(edge.getRole(), this, to, edge.getDepends()); _outEdges.add(newEdge); } } }
@Override protected void updateNodeReferences() { super.updateNodeReferences(); if (_parent != null) _parent = _abox.getIndividual(_parent.getName()); if (isPruned()) { final EdgeList oldEdges = _outEdges; _outEdges = new EdgeList(oldEdges.size()); for (int i = 0; i < oldEdges.size(); i++) { final Edge edge = oldEdges.get(i); final Node to = _abox.getNode(edge.getTo().getName()); final Edge newEdge = new DefaultEdge(edge.getRole(), this, to, edge.getDepends()); _outEdges.add(newEdge); } } }
private void addEdge(final ATermAppl p, final ATermAppl s, final ATermAppl o) { DependencySet edgeDS = _ds; Individual node1 = _abox.getIndividual(s); if (node1.isMerged()) { edgeDS = node1.getMergeDependency(true); node1 = node1.getSame(); } if (_negated) { final ATermAppl cls = all(p, not(value(o))); _strategy.addType(node1, cls, _ds); } else { Node node2 = _abox.getNode(o); if (node2.isMerged()) { edgeDS = node2.getMergeDependency(true); node2 = node2.getSame(); } _strategy.addEdge(node1, _abox.getRole(p), node2, edgeDS); } }