本文整理汇总了Java中org.openrdf.rio.UnsupportedRDFormatException类的典型用法代码示例。如果您正苦于以下问题:Java UnsupportedRDFormatException类的具体用法?Java UnsupportedRDFormatException怎么用?Java UnsupportedRDFormatException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnsupportedRDFormatException类属于org.openrdf.rio包,在下文中一共展示了UnsupportedRDFormatException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: data
import org.openrdf.rio.UnsupportedRDFormatException; //导入依赖的package包/类
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
Collection<Object[]> result = new ArrayList<>();
for (RDFFormat nextParserFormat : RDFParserRegistry.getInstance().getKeys()) {
try {
// Try to create a writer, as not all formats (RDFa for example) have writers,
// and we can't automatically test those formats like this
OutputStream out = new ByteArrayOutputStream();
Rio.createWriter(nextParserFormat, out);
// If the writer creation did not throw an exception, add it to the list
result.add(new Object[]{nextParserFormat});
} catch(UnsupportedRDFormatException e) {
// Ignore to drop this format from the list
}
}
assertFalse("No RDFFormats found with RDFParser implementations on classpath", result.isEmpty());
return result;
}
开发者ID:tkurz,项目名称:sesame-vocab-builder,代码行数:19,代码来源:VocabBuilderTest.java
示例2: test_invalidFile
import org.openrdf.rio.UnsupportedRDFormatException; //导入依赖的package包/类
@Test(expected = UnsupportedRDFormatException.class)
public void test_invalidFile() throws Exception {
try(final Producer<?, VisibilityStatement> producer =
KafkaTestUtil.makeProducer(rule, StringSerializer.class, VisibilityStatementSerializer.class)) {
final KafkaLoadStatements command = new KafkaLoadStatements(rule.getKafkaTopicName(), producer);
command.fromFile(INVALID, "a|b|c");
}
}
开发者ID:apache,项目名称:incubator-rya,代码行数:9,代码来源:KafkaLoadStatementsIT.java
示例3: main
import org.openrdf.rio.UnsupportedRDFormatException; //导入依赖的package包/类
public static void main(String[] args) throws RDFParseException, UnsupportedRDFormatException, IOException,
RepositoryException, ReferringExpressionException, RDFHandlerException {
Options options = new Options();
new JCommander(options, args);
FileInputStream in = new FileInputStream(options.rdf);
Model m = Rio.parse(in, "http://localhost/", RDFFormat.NTRIPLES);
ReferringExpressionAlgorithm algorithm = null;
if (options.algorithm.equals(DaleReiterAlgorithm.class.getName())) {
algorithm = new DaleReiterAlgorithm(TypePriorities.dbPediaPriorities, TypePriorities.dbPediaIgnored);
if (options.verbose)
((ch.qos.logback.classic.Logger) DaleReiterAlgorithm.logger).setLevel(Level.DEBUG);
} else if (options.algorithm.equals(GardentAlgorithm.class.getName())) {
algorithm = new GardentAlgorithm(TypePriorities.dbPediaPriorities, TypePriorities.dbPediaIgnored);
if (options.verbose)
((ch.qos.logback.classic.Logger) GardentAlgorithm.logger).setLevel(Level.DEBUG);
} else if (options.algorithm.equals(GraphAlgorithm.class.getName())) {
algorithm = new GraphAlgorithm(TypePriorities.dbPediaPriorities, TypePriorities.dbPediaIgnored);
if (options.verbose)
((ch.qos.logback.classic.Logger) GraphAlgorithm.logger).setLevel(Level.DEBUG);
} else {
System.err.println("Unknown algorithm '" + options.algorithm + "'");
System.exit(-1);
}
Repository rep = new SailRepository(new MemoryStore());
rep.initialize();
ValueFactory f = rep.getValueFactory();
List<URI> confusors = new ArrayList<URI>(options.confusors.size());
for (String confusor : options.confusors)
confusors.add(f.createURI(confusor));
RepositoryConnection conn = rep.getConnection();
try {
conn.add(m);
URI referent = f.createURI(options.referent);
if (options.type != null)
conn.add(referent, RDF.TYPE, f.createURI(options.type));
ReferringExpression r = algorithm.resolve(referent, confusors, conn);
System.out.println(r);
} finally {
conn.close();
}
}
开发者ID:DrDub,项目名称:Alusivo,代码行数:53,代码来源:Main.java
示例4: RdfWriter
import org.openrdf.rio.UnsupportedRDFormatException; //导入依赖的package包/类
public RdfWriter(RDFFormat format, OutputStream output)
throws UnsupportedRDFormatException {
this.writer = Rio.createWriter(format, output);
}
开发者ID:Wikidata,项目名称:Wikidata-Toolkit,代码行数:5,代码来源:RdfWriter.java
示例5: rdfStringMatches
import org.openrdf.rio.UnsupportedRDFormatException; //导入依赖的package包/类
/**
* Wrap a {@link org.apache.marmotta.commons.sesame.test.base.AbstractRepositoryConnectionMatcher} with a {@link org.apache.marmotta.commons.sesame.test.base.RdfStringMatcher},
* to match the provided matcher against an serialized RDF-String.
*
* @param mimeType the MimeType used to guess the RDFFormat for de-serializing the RDF
* @param baseUri the baseUri used for de-serializing the RDF
* @param matchers the Matchers to wrap
* @see Rio#getParserFormatForMIMEType(String)
* @see org.apache.marmotta.commons.sesame.test.base.RdfStringMatcher#wrap(org.openrdf.rio.RDFFormat, String, org.hamcrest.Matcher)
*/
@SafeVarargs
public static <T extends String, V extends RepositoryConnection> Matcher<T> rdfStringMatches(String mimeType, String baseUri, Matcher<V>... matchers) {
final RDFFormat format = Rio.getParserFormatForMIMEType(mimeType);
if (format == null) throw new UnsupportedRDFormatException(mimeType);
return RdfStringMatcher.wrap(format, baseUri, CoreMatchers.allOf(matchers));
}
开发者ID:apache,项目名称:marmotta,代码行数:17,代码来源:SesameMatchers.java
注:本文中的org.openrdf.rio.UnsupportedRDFormatException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论