private ImmutableMap<IRI, Datatype> getDescendentNodesPartialMap(ClassifiedTBox reasoner, DataRangeExpression node, Equivalences<DataRangeExpression> nodeSet) { if (node instanceof Datatype) { return reasoner.dataRangesDAG().getSub(nodeSet).stream() .map(Equivalences::getRepresentative) .filter(d -> d != node) .map(this::getPredicateIRI) .filter(Optional::isPresent) .collect(ImmutableCollectors.toMap( Optional::get, d -> (Datatype) node )); } return ImmutableMap.of(); }
private ImmutableMap<Predicate, Datatype> getDescendentNodesPartialMap(ClassifiedTBox reasoner, DataRangeExpression node, Equivalences<DataRangeExpression> nodeSet) { if (node instanceof Datatype) { return reasoner.dataRangesDAG().getSub(nodeSet).stream() .map(Equivalences::getRepresentative) .filter(d -> d != node) .map(this::getPredicate) .filter(Optional::isPresent) .collect(ImmutableCollectors.toMap( Optional::get, d -> (Datatype) node )); } return ImmutableMap.of(); }
/** * Produces a map from datatypeProperty to corresponding datatype according to the ontology (the datatype may * be inferred). * This is a rewriting of method: * it.unibz.inf.ontop.owlrefplatform.core.mappingprocessing.MappingDataTypeRepair#getDataTypeFromOntology * from Ontop v 1.18.1 */ private ImmutableMultimap<IRI, Datatype> computeDataTypeMap(ClassifiedTBox reasoner) { // TODO: switch to guava > 2.1, and replace by Streams.stream(iterable) return StreamSupport.stream(reasoner.dataRangesDAG().spliterator(), false) .flatMap(n -> getPartialPredicateToDatatypeMap(n, reasoner).entrySet().stream()) .collect(ImmutableCollectors.toMultimap( e -> e.getKey(), Map.Entry::getValue)); }
/** * Produces a map from datatypeProperty to corresponding datatype according to the ontology (the datatype may * be inferred). * This is a rewriting of method: * it.unibz.inf.ontop.owlrefplatform.core.mappingprocessing.MappingDataTypeRepair#getDataTypeFromOntology * from Ontop v 1.18.1 */ private ImmutableMultimap<String, Datatype> computeDataTypeMap(ClassifiedTBox reasoner) { // TODO: switch to guava > 2.1, and replace by Streams.stream(iterable) return StreamSupport.stream(reasoner.dataRangesDAG().spliterator(), false) .flatMap(n -> getPartialPredicateToDatatypeMap(n, reasoner).entrySet().stream()) .collect(ImmutableCollectors.toMultimap( e -> e.getKey().getName(), Map.Entry::getValue)); }