• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RDFParserRegistry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.rdf4j.rio.RDFParserRegistry的典型用法代码示例。如果您正苦于以下问题:Java RDFParserRegistry类的具体用法?Java RDFParserRegistry怎么用?Java RDFParserRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RDFParserRegistry类属于org.eclipse.rdf4j.rio包,在下文中一共展示了RDFParserRegistry类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getAcceptHeaderValue

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
private String getAcceptHeaderValue() {
	final Set<RDFFormat> rdfFormats = RDFParserRegistry.getInstance().getKeys();
	final Iterator<String> acceptParams = RDFFormat.getAcceptParams(rdfFormats, false, RDFFormat.TURTLE).iterator();
	if (acceptParams.hasNext()) {
		final StringBuilder sb = new StringBuilder();
		while (acceptParams.hasNext()) {
			sb.append(acceptParams.next());
			if (acceptParams.hasNext()) {
				sb.append(", ");
			}
		}
		return sb.toString();
	} else {
		return null;
	}
}
 
开发者ID:ansell,项目名称:rdf4j-schema-generator,代码行数:17,代码来源:SchemaGeneratorMojo.java


示例2: data

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的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 and RDFWriter implementations on classpath", result.isEmpty());
    return result;
}
 
开发者ID:ansell,项目名称:rdf4j-schema-generator,代码行数:19,代码来源:SchemaGeneratorTest.java


示例3: RioFileInputFormat

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
/**
 * Default constructor of RioFileInputFormat
 */
public RioFileInputFormat() {
    //this is a workaround to avoid autodetection of .xml files as TriX format and hook on .trix file extension only
    RDFParserRegistry reg = RDFParserRegistry.getInstance();
    Optional<RDFParserFactory> trixPF = reg.get(RDFFormat.TRIX);
    if (trixPF.isPresent()) {
        reg.remove(trixPF.get());
        final RDFParser trixParser = trixPF.get().getParser();
        reg.add(new RDFParserFactory() {
            @Override
            public RDFFormat getRDFFormat() {
                RDFFormat t = RDFFormat.TRIX;
                return new RDFFormat(t.getName(), t.getMIMETypes(), t.getCharset(), Arrays.asList("trix"), t.getStandardURI(), t.supportsNamespaces(), t.supportsNamespaces());
            }

            @Override
            public RDFParser getParser() {
                return trixParser;
            }
        });
    }
}
 
开发者ID:Merck,项目名称:Halyard,代码行数:25,代码来源:HalyardBulkLoad.java


示例4: initializeMetadata

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
public void initializeMetadata(Repository metadata, String filename)
        throws RepositoryException, IOException, RDFParseException
{
    RepositoryConnection conn = null;

    try {
        File file = new File(filename);
        metadata.initialize();
        conn = metadata.getConnection();
        RDFFormat fileFormat = RDFFormat.matchFileName(file.getAbsolutePath(), RDFParserRegistry.getInstance().getKeys()).orElse(RDFFormat.NTRIPLES);
        conn.add(file, file.toURI().toString(), fileFormat);
    } finally {
        if (conn != null)
            conn.close();
    }
}
 
开发者ID:semagrow,项目名称:semagrow,代码行数:17,代码来源:SemagrowSailFactory.java


示例5: supportsNQuadsUdDeletions

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
@Test
public void supportsNQuadsUdDeletions() throws Exception {
  RDFParserRegistry.getInstance().add(new NquadsUdParserFactory());
  RdfProcessor rdfProcessor = mock(RdfProcessor.class);
  StringReader reader =
    new StringReader("-<http://example.org/subject1> <http://pred> \"12\"^^<http://number> <http://some_graph> .");
  Rdf4jRdfParser instance = new Rdf4jRdfParser();

  instance.importRdf(rdfPatchLog(reader, File.createTempFile("test", "rdf")), "", "", rdfProcessor);

  verify(rdfProcessor).onQuad(
    DELETE,
    "http://example.org/subject1",
    "http://pred",
    "12",
    "http://number",
    null,
    "http://some_graph"
  );
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:21,代码来源:Rdf4jRdfParserTest.java


示例6: handlesBlankNodeSubjectProperly

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
@Test
public void handlesBlankNodeSubjectProperly() throws Exception {
  RDFParserRegistry.getInstance().add(new NquadsUdParserFactory());
  RdfProcessor rdfProcessor = mock(RdfProcessor.class);
  StringReader reader =
    new StringReader("+_:alice <http://pred> \"12\"^^<http://number> <http://some_graph> .");
  Rdf4jRdfParser instance = new Rdf4jRdfParser();

  File tempFile = File.createTempFile("test", "rdf");
  instance.importRdf(rdfPatchLog(reader, tempFile), "", "http://example.com/test.rdf", rdfProcessor);

  verify(rdfProcessor).onQuad(
    ADD,
    "BlankNode:" + tempFile.getName() + "/alice",
    "http://pred",
    "12",
    "http://number",
    null,
    "http://some_graph"
  );
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:22,代码来源:Rdf4jRdfParserTest.java


示例7: handlesBlankNodeObjectProperly

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
@Test
public void handlesBlankNodeObjectProperly() throws Exception {
  RDFParserRegistry.getInstance().add(new NquadsUdParserFactory());
  RdfProcessor rdfProcessor = mock(RdfProcessor.class);
  StringReader reader =
    new StringReader("+_:alice <http://pred> _:bob <http://some_graph> .");
  Rdf4jRdfParser instance = new Rdf4jRdfParser();

  File tempFile = File.createTempFile("test", "rdf");
  instance.importRdf(rdfPatchLog(reader, tempFile), "", "http://example.com/test.rdf", rdfProcessor);

  verify(rdfProcessor).onQuad(
    ADD,
    "BlankNode:" + tempFile.getName() + "/alice",
    "http://pred",
    "BlankNode:" + tempFile.getName() + "/bob",
    null,
    null,
    "http://some_graph"
  );
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:22,代码来源:Rdf4jRdfParserTest.java


示例8: getOutputFormats

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
private static Map<String, RDFFormat> getOutputFormats() {
    final Map<String, RDFFormat> outputFormats = new HashMap<String, RDFFormat>();

    for (final RDFFormat format : RDFParserRegistry.getInstance().getKeys()) {
        outputFormats.put(
                format.getName().replaceAll("-", "").replaceAll("/", "").toLowerCase(), format);
    }

    return outputFormats;
}
 
开发者ID:jsonld-java,项目名称:jsonld-java-tools,代码行数:11,代码来源:Playground.java


示例9: setConfiguration

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
@Override
protected void setConfiguration(FilesToParliamentConfig_V1 config) throws DPUConfigException {
    endpointURL.setValue(config.getEndpointURL());
    String format = config.getRdfFileFormat();
    if (auto.getName().equals(format)) {
        selectRdfFormat.setValue(auto);    
    } else {
        Set<RDFFormat> rdfFormats = RDFParserRegistry.getInstance().getKeys();
        selectRdfFormat.setValue((RDFFormat) RDFFormat.matchFileName(format, rdfFormats).get());
    }        
    clearDestinationGraph.setValue(config.isClearDestinationGraph());
    perGraph.setValue(StringUtils.isEmpty(config.getTargetGraphName()));
    targetGraphName.setValue(config.getTargetGraphName());
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:15,代码来源:FilesToParliamentVaadinDialog.java


示例10: innerExecute

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
@Override
protected void innerExecute() throws DPUException {

    Set<RDFFormat> rdfFormats = RDFParserRegistry.getInstance().getKeys();

    rdfFormat = selectFormat(config.getRdfFileFormat(), rdfFormats); //RDFFormat.matchFileName(config.getRdfFileFormat(), rdfFormats).get();
    if (rdfFormat == null) {
        throw ContextUtils.dpuException(ctx, "rdfToFiles.error.rdfFortmat.null");
    }

    final List<RDFDataUnit.Entry> graphs = FaultToleranceUtils.getEntries(faultTolerance, inRdfData,
            RDFDataUnit.Entry.class);

    if (graphs.size() > 0) {

        // Create output file.
        final String outputFileName = config.getOutFileName() + "." + rdfFormat.getDefaultFileExtension();
        // Prepare output file entity.
        final FilesDataUnit.Entry outputFile = faultTolerance.execute(new FaultTolerance.ActionReturn<FilesDataUnit.Entry>() {

            @Override
            public FilesDataUnit.Entry action() throws Exception {
                return FilesDataUnitUtils.createFile(outFilesData, outputFileName);
            }
        });

        exportGraph(graphs, outputFile);
    } else {
        //no data to be exported, no file being produced. 
        ContextUtils.sendMessage(ctx, MessageType.INFO, "rdfToFiles.nodata", "");
    }

}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:34,代码来源:RdfToFiles.java


示例11: buildDialogLayout

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
@Override
protected void buildDialogLayout() {
    // top-level component properties
    setSizeFull();

    Panel panel = new Panel();
    panel.setSizeFull();

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setImmediate(false);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("-1px");

    comboOutputGraph = new ComboBox(ctx.tr("FilesToRDFVaadinDialog.comboOutputGraph"));
    comboOutputGraph.addItem(FilesToRDFConfig_V1.USE_INPUT_SYMBOLIC_NAME);
    comboOutputGraph.setItemCaption(FilesToRDFConfig_V1.USE_INPUT_SYMBOLIC_NAME, ctx.tr("FilesToRDFVaadinDialog.comboOutputGraph.USE_INPUT_SYMBOLIC_NAME"));
    comboOutputGraph.addItem(FilesToRDFConfig_V1.USE_FIXED_SYMBOLIC_NAME);
    comboOutputGraph.setItemCaption(FilesToRDFConfig_V1.USE_FIXED_SYMBOLIC_NAME, ctx.tr("FilesToRDFVaadinDialog.comboOutputGraph.USE_FIXED_SYMBOLIC_NAME"));
    comboOutputGraph.setInvalidAllowed(false);
    comboOutputGraph.setNullSelectionAllowed(false);
    comboOutputGraph.setImmediate(true);

    comboTypeOfGraph = new ComboBox(ctx.tr("FilesToRDFVaadinDialog.comboTypeOfGraph"));
    comboTypeOfGraph.addItem("AUTO");

    Set<RDFFormat> rdfFormats = RDFParserRegistry.getInstance().getKeys();

    for (RDFFormat o : rdfFormats) {  //RDFFormat.values()
        comboTypeOfGraph.addItem(o.getDefaultMIMEType());
        comboTypeOfGraph.setItemCaption(o.getDefaultMIMEType(), o.getName());
    }
    comboTypeOfGraph.setInvalidAllowed(false);
    comboTypeOfGraph.setNullSelectionAllowed(false);
    comboTypeOfGraph.setImmediate(true);

    comboFailPolicy = new ComboBox(ctx.tr("FilesToRDFVaadinDialog.comboFailPolicy"));
    comboFailPolicy.addItem(FilesToRDFConfig_V1.SKIP_CONTINUE_NEXT_FILE_ERROR_HANDLING);
    comboFailPolicy.setItemCaption(FilesToRDFConfig_V1.SKIP_CONTINUE_NEXT_FILE_ERROR_HANDLING, ctx.tr("FilesToRDFVaadinDialog.comboFailPolicy.SKIP_CONTINUE_NEXT_FILE_ERROR_HANDLING"));
    comboFailPolicy.addItem(FilesToRDFConfig_V1.STOP_EXTRACTION_ERROR_HANDLING);
    comboFailPolicy.setItemCaption(FilesToRDFConfig_V1.STOP_EXTRACTION_ERROR_HANDLING, ctx.tr("FilesToRDFVaadinDialog.comboFailPolicy.STOP_EXTRACTION_ERROR_HANDLING"));
    comboFailPolicy.setInvalidAllowed(false);
    comboFailPolicy.setNullSelectionAllowed(false);

    txtSymbolicName = new TextField(ctx.tr("FilesToRDFVaadinDialog.txtSymbolicName"));
    txtSymbolicName.setDescription(ctx.tr("FilesToRDFVaadinDialog.txtSymbolicName.description"));
    //txtSymbolicName.setWidth("100%");
    //txtSymbolicName.setInputPrompt("custom");
    txtSymbolicName.setNullSettingAllowed(true);
    txtSymbolicName.setNullRepresentation("");

    mainLayout.addComponent(comboTypeOfGraph);
    TextField tfCommitSize = new TextField(ctx.tr("FilesToRDFVaadinDialog.commitSize"), commitSize);
    tfCommitSize.setDescription(ctx.tr("FilesToRDFVaadinDialog.commitSize.description"));
    tfCommitSize.setVisible(false);
    mainLayout.addComponent(tfCommitSize);
    mainLayout.addComponent(comboFailPolicy);
    mainLayout.addComponent(comboOutputGraph);
    mainLayout.addComponent(txtSymbolicName);

    chkVirtualGraph = new CheckBox(ctx.tr("FilesToRDFVaadinDialog.chkVirtualGraph.caption"));
    chkVirtualGraph.setDescription(ctx.tr("FilesToRDFVaadinDialog.chkVirtualGraph.description"));
    mainLayout.addComponent(chkVirtualGraph);

    comboOutputGraph.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            txtSymbolicName.setEnabled(FilesToRDFConfig_V1.USE_FIXED_SYMBOLIC_NAME.equals(event.getProperty().getValue()));
            chkVirtualGraph.setEnabled(!FilesToRDFConfig_V1.USE_FIXED_SYMBOLIC_NAME.equals(event.getProperty().getValue()));
        }
    });

    panel.setContent(mainLayout);
    setCompositionRoot(panel);
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:78,代码来源:FilesToRDFVaadinDialog.java


示例12: Rdf4jIoFactory

import org.eclipse.rdf4j.rio.RDFParserRegistry; //导入依赖的package包/类
public Rdf4jIoFactory() {
  RDFParserRegistry.getInstance().add(new NquadsUdParserFactory());
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:4,代码来源:Rdf4jIoFactory.java



注:本文中的org.eclipse.rdf4j.rio.RDFParserRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RegistrySimple类代码示例发布时间:2022-05-23
下一篇:
Java PartitionQuery类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap