public final static ATermAppl getTop(final Role r) { return r.isDatatypeRole() ? TOP_LIT : TOP; }
public final static ATermAppl getTop(final Role r) { return r.isDatatypeRole() ? TOP_LIT : TOP; }
/** * @return the set of all object properties. */ default Set<ATermAppl> getDataProperties() { final Set<ATermAppl> set = new HashSet<>(); for (final Role role : getRBox().getRoles().values()) { final ATermAppl p = role.getName(); if (ATermUtils.isPrimitive(p) && role.isDatatypeRole()) set.add(p); } return set; }
/** * @return the set of all object properties. */ default Set<ATermAppl> getDataProperties() { final Set<ATermAppl> set = new HashSet<>(); for (final Role role : getRBox().getRoles().values()) { final ATermAppl p = role.getName(); if (ATermUtils.isPrimitive(p) && role.isDatatypeRole()) set.add(p); } return set; }
/** * @return the set of all properties. */ public default Set<ATermAppl> getProperties() { final Set<ATermAppl> set = new HashSet<>(); for (final Role role : getRBox().getRoles().values()) { final ATermAppl p = role.getName(); if (ATermUtils.isPrimitive(p) && (role.isObjectRole() || role.isDatatypeRole() || role.isAnnotationRole())) set.add(p); } return set; }
/** * @return the set of all properties. */ public default Set<ATermAppl> getProperties() { final Set<ATermAppl> set = new HashSet<>(); for (final Role role : getRBox().getRoles().values()) { final ATermAppl p = role.getName(); if (ATermUtils.isPrimitive(p) && (role.isObjectRole() || role.isDatatypeRole() || role.isAnnotationRole())) set.add(p); } return set; }
@Override public Bool hasObviousPropertyValue(final ATermAppl s, final ATermAppl p, final ATermAppl o) { final Role prop = getRole(p); if (prop.isDatatypeRole()) try { final Object value = o == null ? null : _dtReasoner.getValue(o); return hasObviousDataPropertyValue(s, p, value); } catch (final UnrecognizedDatatypeException e) { _logger.warning(format("Returning false for property value check (%s,%s,%s) due to datatype problem with input literal: %s", s, p, o, e.getMessage())); return Bool.FALSE; } catch (final InvalidLiteralException e) { _logger.warning(format("Returning false for property value check (%s,%s,%s) due to problem with input literal: %s", s, p, o, e.getMessage())); return Bool.FALSE; } else return hasObviousObjectPropertyValue(s, p, o); }
@Override public Bool hasObviousPropertyValue(final ATermAppl s, final ATermAppl p, final ATermAppl o) { final Role prop = getRole(p); if (prop.isDatatypeRole()) try { final Object value = o == null ? null : _dtReasoner.getValue(o); return hasObviousDataPropertyValue(s, p, value); } catch (final UnrecognizedDatatypeException e) { _logger.warning(format("Returning false for property value check (%s,%s,%s) due to datatype problem with input literal: %s", s, p, o, e.getMessage())); return Bool.FALSE; } catch (final InvalidLiteralException e) { _logger.warning(format("Returning false for property value check (%s,%s,%s) due to problem with input literal: %s", s, p, o, e.getMessage())); return Bool.FALSE; } else return hasObviousObjectPropertyValue(s, p, o); }
/** * List all subjects with a given property and property value. * * @param r * @param x If property is an object property an ATermAppl object that is the URI of the _individual, if the property is a _data property an ATerm object * that contains the literal value (See {#link #getIndividualsWithDataProperty(ATermAppl, ATermAppl)} for details) * @return List of ATermAppl objects. */ public default List<ATermAppl> getIndividualsWithProperty(final ATermAppl r, final ATermAppl x) { final Role role = getRBox().getRole(r); if (role == null) { Base.handleUndefinedEntity(r + _isNotAnKnowProperty); return Collections.emptyList(); } if (role.isObjectRole()) return getIndividualsWithObjectProperty(r, x); else if (role.isDatatypeRole()) return getIndividualsWithDataProperty(r, x); else if (role.isAnnotationRole()) return Arrays.asList(getIndividualsWithAnnotation(r, x).toArray(new ATermAppl[0])); else throw new IllegalArgumentException(); }
/** * List all subjects with a given property and property value. * * @param r * @param x If property is an object property an ATermAppl object that is the URI of the _individual, if the property is a _data property an ATerm object * that contains the literal value (See {#link #getIndividualsWithDataProperty(ATermAppl, ATermAppl)} for details) * @return List of ATermAppl objects. */ public default List<ATermAppl> getIndividualsWithProperty(final ATermAppl r, final ATermAppl x) { final Role role = getRBox().getRole(r); if (role == null) { Base.handleUndefinedEntity(r + _isNotAnKnowProperty); return Collections.emptyList(); } if (role.isObjectRole()) return getIndividualsWithObjectProperty(r, x); else if (role.isDatatypeRole()) return getIndividualsWithDataProperty(r, x); else if (role.isAnnotationRole()) return Arrays.asList(getIndividualsWithAnnotation(r, x).toArray(new ATermAppl[0])); else throw new IllegalArgumentException(); }
@Override public void visitMin(final ATermAppl term) { visitRole((ATermAppl) term.getArgument(0)); final Role role = _KB.getRole(term.getArgument(0)); final ATermAppl c = (ATermAppl) term.getArgument(2); if (!ATermUtils.isTop(c)) { if (role.isDatatypeRole()) _expressivity.setHasCardinalityD(true); else _expressivity.setHasCardinalityQ(true); } else if (role.isDatatypeRole()) _expressivity.setHasCardinalityD(true); else _expressivity.setHasCardinality(true); }
@Override public void visitMin(final ATermAppl term) { visitRole((ATermAppl) term.getArgument(0)); final Role role = _KB.getRole(term.getArgument(0)); final ATermAppl c = (ATermAppl) term.getArgument(2); if (!ATermUtils.isTop(c)) { if (role.isDatatypeRole()) _expressivity.setHasCardinalityD(true); else _expressivity.setHasCardinalityQ(true); } else if (role.isDatatypeRole()) _expressivity.setHasCardinalityD(true); else _expressivity.setHasCardinality(true); }
@Override public void visitMax(final ATermAppl term) { visitRole((ATermAppl) term.getArgument(0)); final Role role = _KB.getRole(term.getArgument(0)); final int cardinality = ((ATermInt) term.getArgument(1)).getInt(); final ATermAppl c = (ATermAppl) term.getArgument(2); if (!ATermUtils.isTop(c)) { if (role.isDatatypeRole()) _expressivity.setHasCardinalityD(true); else _expressivity.setHasCardinalityQ(true); } else if (cardinality > 1) if (role.isDatatypeRole()) _expressivity.setHasCardinalityD(true); else _expressivity.setHasCardinality(true); }
@Override public void visitMax(final ATermAppl term) { visitRole((ATermAppl) term.getArgument(0)); final Role role = _KB.getRole(term.getArgument(0)); final int cardinality = ((ATermInt) term.getArgument(1)).getInt(); final ATermAppl c = (ATermAppl) term.getArgument(2); if (!ATermUtils.isTop(c)) { if (role.isDatatypeRole()) _expressivity.setHasCardinalityD(true); else _expressivity.setHasCardinalityQ(true); } else if (cardinality > 1) if (role.isDatatypeRole()) _expressivity.setHasCardinalityD(true); else _expressivity.setHasCardinality(true); }
private static boolean block4(final BlockingContext cxt, final ATermAppl term) { final Role t = cxt._blocked.getABox().getRole(term.getArgument(0)); final int m; final ATermAppl c; if (ATermUtils.isMin(term)) { c = (ATermAppl) term.getArgument(2); m = ((ATermInt) term.getArgument(1)).getInt(); } else { c = ATermUtils.negate((ATermAppl) term.getArgument(1)); m = 1; } if (t.isDatatypeRole()) return true; if (cxt.isRSuccessor(t.getInverse()) && cxt._blocked.getParent().hasType(c)) return true; return cxt._blocker.getRSuccessors(t, c).size() >= m; } }
final ATermAppl c = (ATermAppl) min.getArgument(2); if (u.isDatatypeRole()) continue; final ATermAppl notC = (ATermAppl) some.getArgument(1); if (u.isDatatypeRole()) continue;
final ATermAppl c = (ATermAppl) min.getArgument(2); if (u.isDatatypeRole()) continue; final ATermAppl notC = (ATermAppl) some.getArgument(1); if (u.isDatatypeRole()) continue;
private static boolean block4(final BlockingContext cxt, final ATermAppl term) { final Role t = cxt._blocked.getABox().getRole(term.getArgument(0)); final int m; final ATermAppl c; if (ATermUtils.isMin(term)) { c = (ATermAppl) term.getArgument(2); m = ((ATermInt) term.getArgument(1)).getInt(); } else { c = ATermUtils.negate((ATermAppl) term.getArgument(1)); m = 1; } if (t.isDatatypeRole()) return true; if (cxt.isRSuccessor(t.getInverse()) && cxt._blocked.getParent().hasType(c)) return true; return cxt._blocker.getRSuccessors(t, c).size() >= m; } }
public void applyFunctionality(final Individual subj, final Role pred, final Node obj) { DependencySet maxCardDS = pred.isFunctional() ? pred.getExplainFunctional() : subj.hasMax1(pred); if (maxCardDS != null) _maxRule.applyFunctionalMaxRule(subj, pred, ATermUtils.getTop(pred), maxCardDS); if (pred.isDatatypeRole() && pred.isInverseFunctional()) applyFunctionalMaxRule((Literal) obj, pred, DependencySet.INDEPENDENT); else if (pred.isObjectRole()) { final Individual val = (Individual) obj; final Role invR = pred.getInverse(); maxCardDS = invR.isFunctional() ? invR.getExplainFunctional() : val.hasMax1(invR); if (maxCardDS != null) _maxRule.applyFunctionalMaxRule(val, invR, ATermUtils.TOP, maxCardDS); } }
public void applyFunctionality(final Individual subj, final Role pred, final Node obj) { DependencySet maxCardDS = pred.isFunctional() ? pred.getExplainFunctional() : subj.hasMax1(pred); if (maxCardDS != null) _maxRule.applyFunctionalMaxRule(subj, pred, ATermUtils.getTop(pred), maxCardDS); if (pred.isDatatypeRole() && pred.isInverseFunctional()) applyFunctionalMaxRule((Literal) obj, pred, DependencySet.INDEPENDENT); else if (pred.isObjectRole()) { final Individual val = (Individual) obj; final Role invR = pred.getInverse(); maxCardDS = invR.isFunctional() ? invR.getExplainFunctional() : val.hasMax1(invR); if (maxCardDS != null) _maxRule.applyFunctionalMaxRule(val, invR, ATermUtils.TOP, maxCardDS); } }