本文整理汇总了Java中cz.cuni.mff.odcleanstore.fusiontool.config.LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG属性的典型用法代码示例。如果您正苦于以下问题:Java LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG属性的具体用法?Java LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG怎么用?Java LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类cz.cuni.mff.odcleanstore.fusiontool.config.LDFTConfigConstants
的用法示例。
在下文中一共展示了LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iteratesOverStatementsWhenParsingValidFile
@Test
public void iteratesOverStatementsWhenParsingValidFile() throws Exception {
// Arrange
ArrayList<Statement> statements = new ArrayList<Statement>();
statements.add(createHttpStatement("s1", "p1", "o1", "g1"));
statements.add(createHttpStatement("s2", "p1", "o1", "g2"));
statements.add(createHttpStatement("s3", "p1", "o3", "g1"));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Rio.write(statements, outputStream, RDFFormat.NQUADS);
outputStream.close();
// Act
Reader inputReader = new InputStreamReader(new ByteArrayInputStream(outputStream.toByteArray()));
NQuadsParserIterator parserIterator = new NQuadsParserIterator(inputReader, LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG);
ArrayList<Statement> result = new ArrayList<Statement>();
while (parserIterator.hasNext()) {
result.add(parserIterator.next());
}
// Assert
assertThat(result.size(), equalTo(statements.size()));
for (int i = 0; i < result.size(); i++) {
assertThat(result.get(i), contextAwareStatementIsEqual(statements.get(i)));
}
}
示例2: throwsExceptionOnSyntacticError
@Test(expected = Exception.class)
public void throwsExceptionOnSyntacticError() throws Exception {
// Arrange
ArrayList<Statement> statements = new ArrayList<Statement>();
statements.add(createHttpStatement("s1", "p1", "o1", "g1"));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Rio.write(statements, outputStream, RDFFormat.NQUADS);
outputStream.write(";".getBytes());
outputStream.close();
// Act
Reader inputReader = new InputStreamReader(new ByteArrayInputStream(outputStream.toByteArray()));
NQuadsParserIterator parserIterator = new NQuadsParserIterator(inputReader, LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG);
while (parserIterator.hasNext()) {
parserIterator.next();
}
}
示例3: iteratesOverStatementsWhenCommentIsInTheMiddle
@Test
public void iteratesOverStatementsWhenCommentIsInTheMiddle() throws Exception {
// Arrange
Statement statement1 = createHttpStatement("s1", "p1", "o1", "g1");
Statement statement2 = createHttpStatement("s2", "p1", "o1", "g2");
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
RDFWriter writer = Rio.createWriter(RDFFormat.NQUADS, outputStream);
writer.startRDF();
writer.handleStatement(statement1);
writer.handleComment("comment");
writer.handleStatement(statement2);
writer.endRDF();
outputStream.close();
// Act
Reader inputReader = new InputStreamReader(new ByteArrayInputStream(outputStream.toByteArray()));
NQuadsParserIterator parserIterator = new NQuadsParserIterator(inputReader, LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG);
ArrayList<Statement> result = new ArrayList<Statement>();
while (parserIterator.hasNext()) {
result.add(parserIterator.next());
}
// Assert
assertThat(result.size(), equalTo(2));
assertThat(result.get(0), contextAwareStatementIsEqual(statement1));
assertThat(result.get(1), contextAwareStatementIsEqual(statement2));
}
示例4: closesInputStreamWhenClosed
@Test
public void closesInputStreamWhenClosed() throws Exception {
// Arrange
Reader inputReader = mock(Reader.class);
// Act
NQuadsParserIterator parserIterator = new NQuadsParserIterator(inputReader, LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG);
parserIterator.close();
// Assert
verify(inputReader).close();
}