/** * Select parsers by MIME type and format of the input source, if known. If format and MIME type * are not known or not matched by any parser, return all known parsers. * * @param documentSource document source * @param parsers parsers * @return selected parsers */ private static PriorityCollection<OWLParserFactory> getParsers( OWLOntologyDocumentSource documentSource, PriorityCollection<OWLParserFactory> parsers) { if (parsers.isEmpty()) { return parsers; } Optional<OWLDocumentFormat> format = documentSource.getFormat(); Optional<String> mimeType = documentSource.getMIMEType(); if (!format.isPresent() && !mimeType.isPresent()) { return parsers; } PriorityCollection<OWLParserFactory> candidateParsers = parsers; if (format.isPresent()) { candidateParsers = getParsersByFormat(format.get(), parsers); } if (candidateParsers.isEmpty() && mimeType.isPresent()) { candidateParsers = getParserCandidatesByMIME(mimeType.get(), parsers); } if (candidateParsers.isEmpty()) { return parsers; } return candidateParsers; }
/** * Select parsers by MIME type and format of the input source, if known. If format and MIME type * are not known or not matched by any parser, return all known parsers. * * @param documentSource document source * @param parsers parsers * @return selected parsers */ private static PriorityCollection<OWLParserFactory> getParsers( OWLOntologyDocumentSource documentSource, PriorityCollection<OWLParserFactory> parsers) { if (parsers.isEmpty()) { return parsers; } Optional<OWLDocumentFormat> format = documentSource.getFormat(); Optional<String> mimeType = documentSource.getMIMEType(); if (!format.isPresent() && !mimeType.isPresent()) { return parsers; } PriorityCollection<OWLParserFactory> candidateParsers = parsers; if (format.isPresent()) { candidateParsers = getParsersByFormat(format.get(), parsers); } if (candidateParsers.isEmpty() && mimeType.isPresent()) { candidateParsers = getParserCandidatesByMIME(mimeType.get(), parsers); } if (candidateParsers.isEmpty()) { return parsers; } return candidateParsers; }
/** * Select parsers by MIME type and format of the input source, if known. If format and MIME type * are not known or not matched by any parser, return all known parsers. * * @param documentSource document source * @param parsers parsers * @return selected parsers */ private static PriorityCollection<OWLParserFactory> getParsers( OWLOntologyDocumentSource documentSource, PriorityCollection<OWLParserFactory> parsers) { if (parsers.isEmpty()) { return parsers; } Optional<OWLDocumentFormat> format = documentSource.getFormat(); Optional<String> mimeType = documentSource.getMIMEType(); if (!format.isPresent() && !mimeType.isPresent()) { return parsers; } PriorityCollection<OWLParserFactory> candidateParsers = parsers; if (format.isPresent()) { candidateParsers = getParsersByFormat(format.get(), parsers); } if (candidateParsers.isEmpty() && mimeType.isPresent()) { candidateParsers = getParserCandidatesByMIME(mimeType.get(), parsers); } if (candidateParsers.isEmpty()) { return parsers; } return candidateParsers; }
/** * Select parsers by MIME type and format of the input source, if known. If format and MIME type * are not known or not matched by any parser, return all known parsers. * * @param documentSource document source * @param parsers parsers * @return selected parsers */ private static PriorityCollection<OWLParserFactory> getParsers( OWLOntologyDocumentSource documentSource, PriorityCollection<OWLParserFactory> parsers) { if (parsers.isEmpty()) { return parsers; } Optional<OWLDocumentFormat> format = documentSource.getFormat(); Optional<String> mimeType = documentSource.getMIMEType(); if (!format.isPresent() && !mimeType.isPresent()) { return parsers; } PriorityCollection<OWLParserFactory> candidateParsers = parsers; if (format.isPresent()) { candidateParsers = getParsersByFormat(format.get(), parsers); } if (candidateParsers.isEmpty() && mimeType.isPresent()) { candidateParsers = getParserCandidatesByMIME(mimeType.get(), parsers); } if (candidateParsers.isEmpty()) { return parsers; } return candidateParsers; }