private Optional<IRI> getPredicateIRI(DataRangeExpression expression) { if (expression instanceof Datatype) { return Optional.of(((Datatype) expression).getIRI()); } if (expression instanceof DataPropertyRangeExpression) { return Optional.of(((DataPropertyRangeExpression) expression).getProperty().getIRI()); } return Optional.empty(); }
private Optional<Predicate> getPredicate(DataRangeExpression expression) { if (expression instanceof Datatype) { return Optional.of(((Datatype) expression).getPredicate()); } if (expression instanceof DataPropertyRangeExpression) { return Optional.of(((DataPropertyRangeExpression) expression).getProperty().getPredicate()); } return Optional.empty(); }
/** * Creates a data property assertion * <p> * DataPropertyAssertion := 'DataPropertyAssertion' '(' axiomAnnotations * DataPropertyExpression sourceIndividual targetValue ')' * <p> * Implements rule [D4]: * - ignore (return null) if the property is top * - inconsistency if the property is bot */ public static DataPropertyAssertion createDataPropertyAssertion(DataPropertyExpression dpe, ObjectConstant o1, ValueConstant o2) throws InconsistentOntologyException { if (dpe.isTop()) return null; if (dpe.isBottom()) throw new InconsistentOntologyException(); return new DataPropertyAssertionImpl(dpe, o1, o2); }
if (!reasonerDag.dataProperties().contains(dpe.getName())) continue; termFactory.getImmutableUriTemplate(termFactory.getConstantLiteral(dpe.getIRI().getIRIString())) , view.getId().getType1(), view.getId().getType2()); SQLPPTriplesMap basicmapping = new OntopNativeSQLPPTriplesMap(MAPPING_FACTORY.getSQLQuery(sourceQuery),
representative = propRep.getRange();
for (DataSomeValuesFrom dom : role.getAllDomainRestrictions()) graph.addVertex(dom); DataPropertyExpression child = dataPropertyGraph.getEdgeSource(edge); DataPropertyExpression parent = dataPropertyGraph.getEdgeTarget(edge); graph.addEdge(child.getDomainRestriction(DatatypeImpl.rdfsLiteral), parent.getDomainRestriction(DatatypeImpl.rdfsLiteral));
/** * (19) * * DataPropertyDomain := 'DataPropertyDomain' '(' axiomAnnotations DataPropertyExpression superClassExpression ')' * * replaced by SubClassOfAxiom (rule [R2]) */ @Override public void visit(OWLDataPropertyDomainAxiom ax) { try { DataPropertyExpression role = getPropertyExpression(ax.getProperty(), builder.dataProperties()); addSubClassAxioms(role.getDomainRestriction(DatatypeImpl.rdfsLiteral), ax.getDomain()); } catch (TranslationException e) { log.warn(NOT_SUPPORTED_EXT, ax, e.getMessage()); } catch (InconsistentOntologyException e) { log.warn(INCONSISTENT_ONTOLOGY, ax); throw new RuntimeException(INCONSISTENT_ONTOLOGY_EXCEPTION_MESSAGE + ax); } }
@Override public boolean isTop() { return property.isTop(); } }
@Override public boolean isBottom() { return property.isBottom(); }
/** * Creates a data property assertion * <p> * DataPropertyAssertion := 'DataPropertyAssertion' '(' axiomAnnotations * DataPropertyExpression sourceIndividual targetValue ')' * <p> * Implements rule [D4]: * - ignore (return null) if the property is top * - inconsistency if the property is bot */ public static DataPropertyAssertion createDataPropertyAssertion(DataPropertyExpression dpe, ObjectConstant o1, ValueConstant o2) throws InconsistentOntologyException { if (dpe.isTop()) return null; if (dpe.isBottom()) throw new InconsistentOntologyException(); return new DataPropertyAssertionImpl(dpe, o1, o2); }
private static DefaultDirectedGraph<DataRangeExpression,DefaultEdge> getDataRangeGraph (OntologyImpl.UnclassifiedOntologyTBox ontology, DefaultDirectedGraph<DataPropertyExpression,DefaultEdge> dataPropertyGraph) { DefaultDirectedGraph<DataRangeExpression,DefaultEdge> dataRangeGraph = new DefaultDirectedGraph<>(DefaultEdge.class); // ranges of roles for (DataPropertyExpression role : dataPropertyGraph.vertexSet()) dataRangeGraph.addVertex(role.getRange()); // edges between the ranges for sub-properties for (DefaultEdge edge : dataPropertyGraph.edgeSet()) { DataPropertyExpression child = dataPropertyGraph.getEdgeSource(edge); DataPropertyExpression parent = dataPropertyGraph.getEdgeTarget(edge); dataRangeGraph.addEdge(child.getRange(), parent.getRange()); } // data range inclusions from the ontology for (BinaryAxiom<DataRangeExpression> clsIncl : ontology.getSubDataRangeAxioms()) { dataRangeGraph.addVertex(clsIncl.getSuper()); // Datatype is not among the vertices from the start dataRangeGraph.addEdge(clsIncl.getSub(), clsIncl.getSuper()); } return dataRangeGraph; }
for (DataSomeValuesFrom dom : role.getAllDomainRestrictions()) graph.addVertex(dom); DataPropertyExpression child = dataPropertyGraph.getEdgeSource(edge); DataPropertyExpression parent = dataPropertyGraph.getEdgeTarget(edge); graph.addEdge(child.getDomainRestriction(DatatypeImpl.rdfsLiteral), parent.getDomainRestriction(DatatypeImpl.rdfsLiteral));
private ClassExpression getDataSomeValuesFrom(OWLDataPropertyExpression owlDPE, OWLDataRange owlDR) throws TranslationException { OWL2Datatype owlDatatype = getCanonicalDatatype(owlDR); if (owlDatatype == null) { // rule [DT1.2] return ClassImpl.owlNothing; } else { Datatype datatype = builder.getDatatype(owlDatatype.getIRI().toString()); //if (!datatype.equals(DatatypeImpl.rdfsLiteral)) // System.err.println("QDD: " + owlDPE + "." + owlDR); DataPropertyExpression dpe = getPropertyExpression(owlDPE, builder.dataProperties()); return dpe.getDomainRestriction(datatype); } }
@Override public boolean isTop() { return property.isTop(); } }
@Override public boolean isBottom() { return property.isBottom(); }
private DataAtom<AtomPredicate> translate(DataPropertyExpression property, String x, String y) { Variable varX = termFactory.getVariable(x); Variable varY = termFactory.getVariable(y); return atomFactory.getIntensionalTripleAtom(varX, property.getIRI(), varY); }
/** * Normalizes and adds a data property range axiom * <p> * DataPropertyRange := 'DataPropertyRange' '(' axiomAnnotations DataPropertyExpression DataRange ')' * <p> * Implements rule [D3]: * - ignore if the property is bot or the range is rdfs:Literal (top datatype) * - inconsistency if the property is top but the range is not rdfs:Literal * * @throws InconsistentOntologyException */ @Override public void addDataPropertyRangeAxiom(DataPropertyRangeExpression range, Datatype datatype) throws InconsistentOntologyException { checkSignature(range); checkSignature(datatype); if (datatype.equals(DatatypeImpl.rdfsLiteral)) return; // otherwise the datatype is not top if (range.getProperty().isBottom()) return; if (range.getProperty().isTop()) throw new InconsistentOntologyException(); BinaryAxiom<DataRangeExpression> ax = new BinaryAxiomImpl<>(range, datatype); subDataRangeAxioms.add(ax); }