当前位置: 首页>>代码示例>>Java>>正文


Java LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG属性代码示例

本文整理汇总了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)));
    }
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:26,代码来源:NQuadsParserIteratorTest.java

示例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();
    }
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:18,代码来源:NQuadsParserIteratorTest.java

示例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));
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:27,代码来源:NQuadsParserIteratorTest.java

示例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();
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:12,代码来源:NQuadsParserIteratorTest.java


注:本文中的cz.cuni.mff.odcleanstore.fusiontool.config.LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。