/** * @return the next element of a queue of a given type */ @Override public Individual next() { //get the next _index findNext(-1); Individual ind = _abox.getIndividual(_queue.get(_current)); ind = ind.getSame(); _current++; return ind; }
/** * @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 Individual next() { //get the next _index findNext(-1); Individual ind = _abox.getIndividual(_queue.get(_current)); ind = ind.getSame(); _current++; return ind; }
/** * @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; }
private static Set<ATermAppl> getABoxSames(final KnowledgeBase kb, final ATermAppl val) { final Individual ind = kb.getABox().getIndividual(val).getSame(); final Set<ATermAppl> samesAndMaybes = new HashSet<>(); kb.getABox().getSames(ind, samesAndMaybes, samesAndMaybes); return samesAndMaybes; }
private static Set<ATermAppl> getABoxSames(final KnowledgeBase kb, final ATermAppl val) { final Individual ind = kb.getABox().getIndividual(val).getSame(); final Set<ATermAppl> samesAndMaybes = new HashSet<>(); kb.getABox().getSames(ind, samesAndMaybes, samesAndMaybes); return samesAndMaybes; }
@Override public CachedNode getCached(final ATermAppl c) { if (ATermUtils.isNominal(c)) return getIndividual(c.getArgument(0)).getSame(); else return _cache.get(c); }
@Override public CachedNode getCached(final ATermAppl c) { if (ATermUtils.isNominal(c)) return getIndividual(c.getArgument(0)).getSame(); else return _cache.get(c); }
private void addType(final ATermAppl ind, final ATermAppl cls) { DependencySet nodeDS = _ds; Individual node = _abox.getIndividual(ind); if (node.isMerged()) { nodeDS = node.getMergeDependency(true); node = node.getSame(); } _strategy.addType(node, _negated ? ATermUtils.negate(cls) : cls, nodeDS); }
private void addType(final ATermAppl ind, final ATermAppl cls) { DependencySet nodeDS = _ds; Individual node = _abox.getIndividual(ind); if (node.isMerged()) { nodeDS = node.getMergeDependency(true); node = node.getSame(); } _strategy.addType(node, _negated ? ATermUtils.negate(cls) : cls, nodeDS); }
@Override public void apply(final Individual y) { final List<ATermAppl> types = y.getTypes(Node.NOM); final int size = types.size(); for (int j = 0; j < size; j++) { final ATermAppl nc = types.get(j); final DependencySet ds = y.getDepends(nc); if (!OpenlletOptions.MAINTAIN_COMPLETION_QUEUE && ds == null) continue; applyNominalRule(y, nc, ds); if (_strategy.getABox().isClosed()) return; if (y.isMerged()) { apply(y.getSame()); return; } } }
@Override public void apply(final Individual y) { final List<ATermAppl> types = y.getTypes(Node.NOM); final int size = types.size(); for (int j = 0; j < size; j++) { final ATermAppl nc = types.get(j); final DependencySet ds = y.getDepends(nc); if (!OpenlletOptions.MAINTAIN_COMPLETION_QUEUE && ds == null) continue; applyNominalRule(y, nc, ds); if (_strategy.getABox().isClosed()) return; if (y.isMerged()) { apply(y.getSame()); return; } } }
@Override public void getObviousTypes(final ATermAppl x, final List<ATermAppl> types, final List<ATermAppl> nonTypes) { assert isComplete() : "Initial consistency check has not been performed!"; Individual pNode = getIndividual(x); if (!pNode.getMergeDependency(true).isIndependent()) pNode = getIndividual(x); else pNode = pNode.getSame(); pNode.getObviousTypes(types, nonTypes); }
@Override public void getObviousTypes(final ATermAppl x, final List<ATermAppl> types, final List<ATermAppl> nonTypes) { assert isComplete() : "Initial consistency check has not been performed!"; Individual pNode = getIndividual(x); if (!pNode.getMergeDependency(true).isIndependent()) pNode = getIndividual(x); else pNode = pNode.getSame(); pNode.getObviousTypes(types, nonTypes); }
/** * @param name * @param nodeParam */ public CachedConceptNode(final ATermAppl name, final Individual nodeParam) { _name = name; Individual node = nodeParam; // if the _node is merged, get the representative _node and check // also if the merge depends on a _branch _isIndependent = node.getMergeDependency(true).isIndependent(); node = node.getSame(); _outEdges = copyEdgeList(node, true); _inEdges = copyEdgeList(node, false); // collect all transitive property values if (node.getABox().getKB().getExpressivity().hasNominal()) collectComplexPropertyValues(node); _types = CollectionUtils.makeIdentityMap(node.getDepends()); for (final Map.Entry<ATermAppl, DependencySet> e : _types.entrySet()) e.setValue(e.getValue().cache()); }
/** * @param name * @param nodeParam */ public CachedConceptNode(final ATermAppl name, final Individual nodeParam) { _name = name; Individual node = nodeParam; // if the _node is merged, get the representative _node and check // also if the merge depends on a _branch _isIndependent = node.getMergeDependency(true).isIndependent(); node = node.getSame(); _outEdges = copyEdgeList(node, true); _inEdges = copyEdgeList(node, false); // collect all transitive property values if (node.getABox().getKB().getExpressivity().hasNominal()) collectComplexPropertyValues(node); _types = CollectionUtils.makeIdentityMap(node.getDepends()); for (final Map.Entry<ATermAppl, DependencySet> e : _types.entrySet()) e.setValue(e.getValue().cache()); }
@Override public Bool isKnownType(final ATermAppl x, final ATermAppl c, final Collection<ATermAppl> subs) { assert isComplete() : "Initial consistency check has not been performed!"; Individual pNode = getIndividual(x); boolean isIndependent = true; if (pNode.isMerged()) { isIndependent = pNode.getMergeDependency(true).isIndependent(); pNode = pNode.getSame(); } final Bool isType = isKnownType(pNode, c, subs); if (isIndependent) return isType; else if (isType.isTrue()) return Bool.UNKNOWN; else return isType; }
@Override public Bool isKnownType(final ATermAppl x, final ATermAppl c, final Collection<ATermAppl> subs) { assert isComplete() : "Initial consistency check has not been performed!"; Individual pNode = getIndividual(x); boolean isIndependent = true; if (pNode.isMerged()) { isIndependent = pNode.getMergeDependency(true).isIndependent(); pNode = pNode.getSame(); } final Bool isType = isKnownType(pNode, c, subs); if (isIndependent) return isType; else if (isType.isTrue()) return Bool.UNKNOWN; else return isType; }
@Override public Bool hasObviousDataPropertyValue(final ATermAppl s, final ATermAppl p, final Object value) { assert isComplete() : "Initial consistency check has not been performed!"; Individual subj = getIndividual(s); final Role prop = getRole(p); if (prop.isTop()) return Bool.TRUE; else if (prop.isBottom()) return Bool.FALSE; // if onlyPositive is set then the answer returned is sound but not // complete so we cannot return negative answers boolean onlyPositive = false; if (!subj.getMergeDependency(true).isIndependent()) { onlyPositive = true; subj = getIndividual(s); } else subj = subj.getSame(); final Bool hasValue = subj.hasDataPropertyValue(prop, value); if (onlyPositive && hasValue.isFalse()) return Bool.UNKNOWN; return hasValue; }
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); } }