本文整理了Java中org.eclipse.rdf4j.rio.Rio.unsupportedFormat
方法的一些代码示例,展示了Rio.unsupportedFormat
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rio.unsupportedFormat
方法的具体详情如下:
包路径:org.eclipse.rdf4j.rio.Rio
类名称:Rio
方法名:unsupportedFormat
[英]Helper method to use to create a lambda for Optional#orElseThrow(Supplier) to indicate a format is unsupported.
[中]Helper方法用于为可选的#orelsetrow(供应商)创建lambda,以指示不支持格式。
代码示例来源:origin: org.apache.any23/apache-any23-core
/**
* Parses the content of the <code>resource</code> file
* guessing the content format from the extension.
*
* @param resource resource name.
* @return the statements declared within the resource file.
* @throws java.io.IOException if an error occurs while reading file.
*/
public static Statement[] parseRDF(String resource) throws IOException {
final int extIndex = resource.lastIndexOf('.');
if(extIndex == -1)
throw new IllegalArgumentException("Error while detecting the extension in resource name " + resource);
final String extension = resource.substring(extIndex + 1);
return parseRDF( getFormatByExtension(extension).orElseThrow(Rio.unsupportedFormat(extension))
, RDFUtils.class.getResourceAsStream(resource) );
}
代码示例来源:origin: eclipse/rdf4j
@Override
public void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts)
throws IOException, RDFParseException, RepositoryException
{
if (baseURI == null) {
// default baseURI to file
baseURI = file.toURI().toString();
}
if (dataFormat == null) {
dataFormat = Rio.getParserFormatForFileName(file.getName()).orElseThrow(
Rio.unsupportedFormat(file.getName()));
}
try (InputStream in = new FileInputStream(file)) {
add(in, baseURI, dataFormat, contexts);
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
public void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts)
throws IOException, RDFParseException, RepositoryException
{
if (baseURI == null) {
// default baseURI to file
baseURI = file.toURI().toString();
}
if (dataFormat == null) {
dataFormat = Rio.getParserFormatForFileName(file.getName()).orElseThrow(
Rio.unsupportedFormat(file.getName()));
}
InputStream in = new FileInputStream(file);
try {
add(in, baseURI, dataFormat, contexts);
}
finally {
in.close();
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-http
public void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts)
throws IOException, RDFParseException, RepositoryException
{
if (baseURI == null) {
// default baseURI to file
baseURI = file.toURI().toString();
}
if (dataFormat == null) {
dataFormat = Rio.getParserFormatForFileName(file.getName()).orElseThrow(
Rio.unsupportedFormat(file.getName()));
}
InputStream in = new FileInputStream(file);
try {
add(in, baseURI, dataFormat, contexts);
}
finally {
in.close();
}
}
代码示例来源:origin: org.apache.any23/apache-any23-cli
@Override
public RDFFormat convert(String value) {
return RDFWriterRegistry.getInstance().getFileFormatForMIMEType(value).orElseThrow(Rio.unsupportedFormat(value));
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
*/
public static RDFWriter createWriter(RDFFormat format, OutputStream out)
throws UnsupportedRDFormatException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(out);
}
代码示例来源:origin: eclipse/rdf4j
/**
* Convenience methods for creating RDFParser objects. This method uses the registry returned by
* {@link RDFParserRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate parser.
*
* @throws UnsupportedRDFormatException
* If no parser is available for the specified RDF format.
*/
public static RDFParser createParser(RDFFormat format)
throws UnsupportedRDFormatException
{
RDFParserFactory factory = RDFParserRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getParser();
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* Convenience methods for creating RDFParser objects. This method uses the registry returned by
* {@link RDFParserRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate parser.
*
* @throws UnsupportedRDFormatException
* If no parser is available for the specified RDF format.
*/
public static RDFParser createParser(RDFFormat format)
throws UnsupportedRDFormatException
{
RDFParserFactory factory = RDFParserRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getParser();
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
*/
public static RDFWriter createWriter(RDFFormat format, Writer writer)
throws UnsupportedRDFormatException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(writer);
}
代码示例来源:origin: eclipse/rdf4j
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
*/
public static RDFWriter createWriter(RDFFormat format, OutputStream out)
throws UnsupportedRDFormatException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(out);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-rio-api
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
*/
public static RDFWriter createWriter(RDFFormat format, Writer writer)
throws UnsupportedRDFormatException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(writer);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-rio-api
/**
* Convenience methods for creating RDFParser objects. This method uses the registry returned by
* {@link RDFParserRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate parser.
*
* @throws UnsupportedRDFormatException
* If no parser is available for the specified RDF format.
*/
public static RDFParser createParser(RDFFormat format)
throws UnsupportedRDFormatException
{
RDFParserFactory factory = RDFParserRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getParser();
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-rio-api
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
*/
public static RDFWriter createWriter(RDFFormat format, OutputStream out)
throws UnsupportedRDFormatException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(out);
}
代码示例来源:origin: eclipse/rdf4j
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
*/
public static RDFWriter createWriter(RDFFormat format, Writer writer)
throws UnsupportedRDFormatException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(writer);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-rio-api
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
* @throws URISyntaxException
* If the baseURI is invalid
*/
public static RDFWriter createWriter(RDFFormat format, OutputStream out, String baseURI)
throws UnsupportedRDFormatException,
URISyntaxException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(out, baseURI);
}
代码示例来源:origin: eclipse/rdf4j
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
* @throws URISyntaxException
* If the baseURI is invalid
*/
public static RDFWriter createWriter(RDFFormat format, Writer writer, String baseURI)
throws UnsupportedRDFormatException,
URISyntaxException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(writer, baseURI);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-rio-api
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
* @throws URISyntaxException
* If the baseURI is invalid
*/
public static RDFWriter createWriter(RDFFormat format, Writer writer, String baseURI)
throws UnsupportedRDFormatException,
URISyntaxException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(writer, baseURI);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
* @throws URISyntaxException
* If the baseURI is invalid
*/
public static RDFWriter createWriter(RDFFormat format, Writer writer, String baseURI)
throws UnsupportedRDFormatException,
URISyntaxException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(writer, baseURI);
}
代码示例来源:origin: eclipse/rdf4j
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
* @throws URISyntaxException
* If the baseURI is invalid
*/
public static RDFWriter createWriter(RDFFormat format, OutputStream out, String baseURI)
throws UnsupportedRDFormatException,
URISyntaxException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(out, baseURI);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* Convenience methods for creating RDFWriter objects. This method uses the registry returned by
* {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory
* to create the appropriate writer.
*
* @throws UnsupportedRDFormatException
* If no writer is available for the specified RDF format.
* @throws URISyntaxException
* If the baseURI is invalid
*/
public static RDFWriter createWriter(RDFFormat format, OutputStream out, String baseURI)
throws UnsupportedRDFormatException,
URISyntaxException
{
RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow(
Rio.unsupportedFormat(format));
return factory.getWriter(out, baseURI);
}
内容来源于网络,如有侵权,请联系作者删除!