representative = propRep.getRange();
representative = propRep.getRange();
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; }
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; }
/** * (20) * * DataPropertyRange := 'DataPropertyRange' '(' axiomAnnotations DataPropertyExpression DataRange ')' * * replaced by data property inclusion with bottomDataProperty if DataRange is empty (rule [DT1.1]) * */ @Override public void visit(OWLDataPropertyRangeAxiom ax) { DataPropertyExpression dpe = getPropertyExpression(ax.getProperty(), builder.dataProperties()); try { OWL2Datatype owlDatatype = getCanonicalDatatype(ax.getRange()); if (owlDatatype == null) { // range is empty (rule [DT1.1]) builder.addSubPropertyOfAxiom(dpe, DataPropertyExpressionImpl.owlBottomDataProperty); } else { Datatype datatype = builder.getDatatype(owlDatatype.getIRI().toString()); builder.addDataPropertyRangeAxiom(dpe.getRange(), datatype); } } 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); } }