/** * Tries to match a MIME type against the list of boolean query result formats that can be parsed. * * @param mimeType * A MIME type, e.g. "application/sparql-results+xml". * @return An RDFFormat object if a match was found, or {@link Optional#empty()} otherwise. * @see #getBooleanParserFormatForMIMEType(String, BooleanQueryResultFormat) */ public static Optional<QueryResultFormat> getBooleanParserFormatForMIMEType(String mimeType) { return BooleanQueryResultParserRegistry.getInstance().getFileFormatForMIMEType(mimeType); }
/** * Tries to match a MIME type against the list of boolean query result formats that can be parsed. * * @param mimeType * A MIME type, e.g. "application/sparql-results+xml". * @return An RDFFormat object if a match was found, or {@link Optional#empty()} otherwise. * @see #getBooleanParserFormatForMIMEType(String, BooleanQueryResultFormat) */ public static Optional<QueryResultFormat> getBooleanParserFormatForMIMEType(String mimeType) { return BooleanQueryResultParserRegistry.getInstance().getFileFormatForMIMEType(mimeType); }
/** * Tries to match the extension of a file name against the list of RDF formats that can be parsed. * * @param fileName * A file name. * @return An BooleanQueryResultFormat object if a match was found, or {@link Optional#empty()} otherwise. * @see #getBooleanParserFormatForFileName(String, BooleanQueryResultFormat) */ public static Optional<QueryResultFormat> getBooleanParserFormatForFileName(String fileName) { return BooleanQueryResultParserRegistry.getInstance().getFileFormatForFileName(fileName); }
/** * Tries to match the extension of a file name against the list of RDF formats that can be parsed. * * @param fileName * A file name. * @return An BooleanQueryResultFormat object if a match was found, or {@link Optional#empty()} otherwise. * @see #getBooleanParserFormatForFileName(String, BooleanQueryResultFormat) */ public static Optional<QueryResultFormat> getBooleanParserFormatForFileName(String fileName) { return BooleanQueryResultParserRegistry.getInstance().getFileFormatForFileName(fileName); }
private boolean readExpectedBooleanQueryResult() throws Exception { Optional<QueryResultFormat> bqrFormat = BooleanQueryResultParserRegistry.getInstance().getFileFormatForFileName(resultFileURL); if (bqrFormat.isPresent()) { InputStream in = new URL(resultFileURL).openStream(); try { return QueryResultIO.parseBoolean(in, bqrFormat.get()); } finally { in.close(); } } else { Set<Statement> resultGraph = readExpectedGraphQueryResult(); return DAWGTestResultSetUtil.toBooleanQueryResult(resultGraph); } }
/** * Convenience methods for creating BooleanQueryResultParser objects. This method uses the registry * returned by {@link BooleanQueryResultParserRegistry#getInstance()} to get a factory for the specified * format and uses this factory to create the appropriate parser. * * @return A BooleanQueryResultParser matching the given format. * @throws UnsupportedQueryResultFormatException * If no parser is available for the specified boolean query result format. */ public static BooleanQueryResultParser createBooleanParser(QueryResultFormat format) throws UnsupportedQueryResultFormatException { BooleanQueryResultParserFactory factory = BooleanQueryResultParserRegistry.getInstance().get( format).orElseThrow( () -> new UnsupportedQueryResultFormatException( "No parser factory available for boolean query result format " + format)); return factory.getParser(); }
/** * Convenience methods for creating BooleanQueryResultParser objects. This method uses the registry * returned by {@link BooleanQueryResultParserRegistry#getInstance()} to get a factory for the specified * format and uses this factory to create the appropriate parser. * * @return A BooleanQueryResultParser matching the given format. * @throws UnsupportedQueryResultFormatException * If no parser is available for the specified boolean query result format. */ public static BooleanQueryResultParser createBooleanParser(QueryResultFormat format) throws UnsupportedQueryResultFormatException { BooleanQueryResultParserFactory factory = BooleanQueryResultParserRegistry.getInstance().get( format).orElseThrow( () -> new UnsupportedQueryResultFormatException( "No parser factory available for boolean query result format " + format)); return factory.getParser(); }
Set<QueryResultFormat> booleanFormats = BooleanQueryResultParserRegistry.getInstance().getKeys(); if (booleanFormats.isEmpty()) { throw new RepositoryException("No boolean query result parsers have been registered");
Set<QueryResultFormat> booleanFormats = BooleanQueryResultParserRegistry.getInstance().getKeys(); if (booleanFormats.isEmpty()) { throw new RepositoryException("No boolean query result parsers have been registered");
Set<QueryResultFormat> booleanFormats = BooleanQueryResultParserRegistry.getInstance().getKeys(); if (booleanFormats.isEmpty()) { throw new RepositoryException("No boolean query result parsers have been registered");